Compare commits

...

108 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7) ec58cefefb Moodle release 3.10 2020-11-07 17:24:12 +01:00
Eloy Lafuente (stronk7) e4cda88e76 Moodle release 3.10rc2 2020-11-06 22:56:08 +01:00
Víctor Déniz 8752df87ed Merge branch 'MDL-70137-310-2' of git://github.com/andrewnicols/moodle into MOODLE_310_STABLE 2020-11-06 19:16:52 +00:00
Andrew Nicols 511dab1cd3 MDL-70137 cache: Write config to temp file and move into place 2020-11-06 19:16:51 +00:00
Andrew Nicols b26a5e5e08 MDL-70137 cache: Use sensible default when reading MUC config
When we read the MUC configuration, a file which exists but is empty
will not error, but will cause all configuration to be empty.

We already perform an {{is_array()}} check on the {{$configuration}}
variable, but the default value for {{$configuration}} is an empty
array. In the case where the file exists, but is empty, no errors occur
when the file is loaded, and the initial {{$configuration}} value is
not overwritten, leading to the file being replaced with an empty copy.
2020-11-06 19:16:44 +00:00
Eloy Lafuente (stronk7) fcb699808c Merge branch 'MDL-70143-310' of git://github.com/marinaglancy/moodle into MOODLE_310_STABLE 2020-11-06 19:51:54 +01:00
Eloy Lafuente (stronk7) f9dc16ca05 Merge branch 'MDL-70139-310' of git://github.com/sarjona/moodle into MOODLE_310_STABLE 2020-11-06 18:56:00 +01:00
Marina Glancy a350376b65 MDL-70143 tool_uploaduser: fix wrong cache reference 2020-11-06 18:07:24 +01:00
Sara Arjona 29f7a9a210 MDL-70139 core_badges: fix invalid request when sending to backpack
Having mixed $data in badge exporters is causing some issues.
As all these exporters are using $data as an object, $data can be
converted to object in the constructor, to avoid errors and get
the expected behaviour always.
2020-11-06 16:36:52 +01:00
Jun Pataleta 022a019637 Merge branch 'MDL-70130-310' of git://github.com/andrewnicols/moodle into MOODLE_310_STABLE 2020-11-06 11:27:54 +08:00
Andrew Nicols 50f5563c1f MDL-70130 core: Compare realpaths for file attachment checks
Rather than using the provided path, the `realpath` must be used to
ensure that the use of symlinks in paths is normalised.
2020-11-06 11:00:30 +08:00
Andrew Nicols 1c0b8f8c50 MDL-70130 core: Simplify attachment handling in email_to_suer 2020-11-06 11:00:29 +08:00
Marina Glancy c879cb24df MDL-70130 core: allow to attach files from localrequestdir to emails
Co-authored-by: Paul Holden <paulh@moodle.com>
2020-11-06 11:00:29 +08:00
Andrew Nicols 6890ad18e3 Merge branch 'MDL-70131-310' of git://github.com/marinaglancy/moodle into MOODLE_310_STABLE 2020-11-06 09:27:33 +08:00
Andrew Nicols b88679e3a1 Merge branch 'MDL-70120-assign-stamp-expires-MOODLE_310_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_310_STABLE 2020-11-06 09:26:01 +08:00
Marina Glancy 8c1917588d MDL-70131 cli: only allow to negate existing keys 2020-11-05 18:10:13 +01:00
Eloy Lafuente (stronk7) c50c904c9e Moodle release 3.10rc1 2020-11-05 12:16:53 +01:00
Jun Pataleta 9023021ae0 Merge branch 'MDL-70075-310-2' of git://github.com/andrewnicols/moodle into MOODLE_310_STABLE 2020-11-05 12:51:23 +08:00
Andrew Nicols 919ead58fe Merge branch 'MDL-70066-310' of git://github.com/lameze/moodle into MOODLE_310_STABLE 2020-11-05 10:01:18 +08:00
Andrew Nicols 27de77007b MDL-70075 core: Autocomplete selection should always have an active item
Ensure that there is always one active element in the list of selected
autocomplete elements.

Without this we have issues beacuse clicking on the link makes the first
one active if one is not already active, and this turns a click event
into a drag event, which means that it is not deleted.
2020-11-05 09:05:38 +08:00
Andrew Nicols 34d1c23668 MDL-70075 core: Do not return a value in an event handler
Returning a value of `false` in an event handler has the effect of
calling event.preventDefault() and event.stopPropagation().

This is neither obvious, nor desirable in this situation.
2020-11-05 09:05:38 +08:00
Andrew Nicols dc7ca062ca MDL-70075 core: jQuery.attr() does not accept a bool value
The documented values that jQuery.attr() accepts are String, Number, or
null. For some reason, when we pass a Boolean value, the subsequent
click handler does not work in some situations.

Changing this to take a Number, and unsetting it when empty, resolves
this issue.
2020-11-05 09:05:38 +08:00
Andrew Nicols 8100d46f85 MDL-70075 core: Listen for change in accessibleChange event
The accessibleChange custom interaction event was only listening for
blur and focus, however some OS/browser combinations do not emit these
events until the element is explicitly blurred. This is notably
different on Firefox on some Operating Systems.

Recent changes in MDL-68167 explicitly moved the user participants page
filter module to use the accessibleChange event, which means that the
selections are now only triggered on an explicit blur when using
Firefox. This highlight a bug whereby, when the mouse is used to make a
selection, the event is not triggered until the element is blurred.

This change modifies the accessibleChange event to ignore the `change`
event where it was triggered by the keyboard and where that keybaord
event was not a [return] or [escape] keypress, but to otherwise respect
the native change event.
2020-11-05 09:05:38 +08:00
Andrew Nicols f4dfe66ea8 MDL-70075 core: Listen for the focus and blur events again
The `blur` event does not bubble, but the `focusout` events are not
available in all supported versions of Firefox.

Rather than switching event, this patch using event capture to
effectively achieve the same result and bubble the event up through the
DOM to the delegated listener.

There should be no functional change with this patch, except to support
Firefox fully.
2020-11-05 09:05:38 +08:00
Eloy Lafuente (stronk7) e92c6b19b8 Merge branch 'MDL-70100-310' of git://github.com/bmbrands/moodle into MOODLE_310_STABLE 2020-11-04 22:40:54 +01:00
Víctor Déniz fa79a1876c Merge branch 'MDL-70112_310' of https://github.com/timhunt/moodle into MOODLE_310_STABLE 2020-11-04 19:17:34 +00:00
Sara Arjona c9ab02b0cc Merge branch 'MDL-70114-310' of git://github.com/bmbrands/moodle into MOODLE_310_STABLE 2020-11-04 20:15:04 +01:00
Víctor Déniz 9c2241dee4 Merge branch 'MDL-68749-310-2' of git://github.com/mickhawkins/moodle into MOODLE_310_STABLE 2020-11-04 15:24:08 +00:00
Sara Arjona 8028bf10dc Merge branch 'MDL-70119-310' of git://github.com/ferranrecio/moodle into MOODLE_310_STABLE 2020-11-04 15:19:44 +01:00
Bas Brands 04704c2108 MDL-70114 mod_data: add border for to textarea 2020-11-04 13:30:11 +00:00
Brendan Heywood fbe13d55f3 MDL-70120 assignfeedback_editpdf: Stamp files should be cached 2020-11-04 23:06:02 +11:00
Ferran Recio 75d6582fef MDL-70119 core_badges: fix tab names 2020-11-04 12:57:30 +01:00
Simey Lameze 7ca4fd97d9 MDL-70066 badges: change usages of array_key_exists to isset 2020-11-04 16:05:45 +08:00
Jun Pataleta 940ed72017 Merge branch 'MDL-70089_310' of https://github.com/stronk7/moodle into MOODLE_310_STABLE 2020-11-04 13:05:47 +08:00
Jake Dallimore 477cd8b5fe Merge branch 'MOODLE_310_MDL-70093' of https://github.com/golenkovm/moodle into MOODLE_310_STABLE 2020-11-04 09:00:26 +08:00
Tim Hunt a8efb07714 MDL-70112 drag-drop qtypes: fix form preview 2020-11-03 21:36:00 +00:00
Eloy Lafuente (stronk7) 51c9ea5194 MDL-70089 versions: main version bump 2020-11-03 19:38:27 +01:00
Eloy Lafuente (stronk7) b0a1b4ce8b MDL-70089 versions: bump all versions and requires near release
version = 2020110900 release version
requires= 2020110300 current beta+ (week6roll1) version

Note that, because we are under parallel development period,
this is being done in the branch that is going to be released
(MOODLE_310_STABLE already existing) for Moodle 3.10.0 and
not in master, that is the one getting the bump under normal
(non-parallel) periods.
2020-11-03 19:34:52 +01:00
Mihail Geshoski 3d9175f6f1 MDL-67837 backup: Add unit tests 2020-11-03 12:34:28 +01:00
Mihail Geshoski fd2427746f MDL-67837 backup: Verify caps before unenrolling users on course restore 2020-11-03 12:34:28 +01:00
andreasschenkel 49afa008f4 MDL-69844 user: Fix no email in download_participants_table
Only include eMail in download_participants_table 
if selected in showuseridentity 
($identityfieldsselect)
2020-11-03 12:34:28 +01:00
Juan Leyva 551892e2a7 MDL-67015 mod_data: Prevent users adding entries to other groups 2020-11-03 12:34:28 +01:00
Amaia Anabitarte 45c339ef09 MDL-69046 core_contentbank: Escape quotes when showing name 2020-11-03 12:34:28 +01:00
Ferran Recio e9fe9f4ae3 MDL-69378 tool_uploadcourse: fix enrolment methods uploads 2020-11-03 12:34:28 +01:00
Peter Dias 1d1b148ca9 MDL-56310 restore: Confirm user has permission to change capabilities 2020-11-03 12:34:28 +01:00
Eloy Lafuente (stronk7) 15b4174a9f on-demand release 3.10beta+ 2020-11-03 12:23:48 +01:00
Bas Brands 99ab172211 MDL-70100 theme_boost: quiztimer zindex fix 2020-11-03 10:36:11 +01:00
Michael Hawkins 5cc9f3448c MDL-68749 theme: Fix bootstrap toggle switches in RTL layout
Co-authored-by: Bas Brands <bas@moodle.com>
2020-11-03 14:47:58 +08:00
Andrew Nicols 4dd870de20 Merge branch 'MDL-70059-310' of git://github.com/sarjona/moodle into MOODLE_310_STABLE 2020-11-03 12:05:19 +08:00
Jun Pataleta c353963ef8 Merge branch 'MDL-70033-310-2' of git://github.com/mickhawkins/moodle into MOODLE_310_STABLE 2020-11-03 12:01:33 +08:00
Michael Hawkins 60585523ad MDL-70033 course: Update download content event handling for Classic 2020-11-03 11:54:56 +08:00
Michael Hawkins eeaf19eb5c MDL-70033 core: Update tree.js event handlers to replace stopPropagation
Also added support to allow links to override action keys (enter/space)

Co-authored-by: Andrew Nicols <andrew@nicols.co.uk>
2020-11-03 11:54:56 +08:00
Juan Leyva 63da614e4f MDL-70081 airnotifier: Add missing device type in token registration 2020-11-03 01:25:57 +01:00
Jun Pataleta 73372330a9 Merge branch 'MDL-69975_310' of https://github.com/stronk7/moodle into MOODLE_310_STABLE 2020-11-03 00:00:25 +08:00
Sara Arjona 5f3de24306 Merge branch 'MDL-69973_310' of https://github.com/stronk7/moodle into MOODLE_310_STABLE 2020-11-02 15:44:54 +01:00
Mikhail Golenkov c15eac212b MDL-70093 dataformat_pdf: Fix row height calculation with high cells 2020-11-02 22:25:24 +11:00
Sara Arjona 01c8c8828b MDL-70059 core_badges: avoid duplicate key error
When 2 or more backpack were created without credentials,
a "Duplicate key value violates unique constraint" error
was raised because externalbackpackid was not taking the
correct value.
Other improvements have been done to the code too in order
to make it more readable.
2020-11-02 10:48:06 +01:00
Jake Dallimore 2dbe5f54f1 Merge branch 'MDL-70073-310' of git://github.com/peterRd/moodle into MOODLE_310_STABLE 2020-11-02 13:57:35 +08:00
Jun Pataleta bcf59d235b Merge branch 'MDL-70074-add-authendpoint-310' of https://github.com/cengage/moodle into MOODLE_310_STABLE 2020-11-02 10:04:31 +08:00
Peter Dias 32574e9cae MDL-70073 badges: Fix the backpack-add to match current master 2020-11-01 22:33:28 +08:00
Brendan Heywood 256f8a261c MDL-69975 core: Fix paths longer than 260 chars on windows
Also, ensure that remove_dir() only processes directories,
because sometimes it was being called by shutdown managers
with files, leading to PHP warnings.

Co-authored-by: Eloy Lafuente (stronk7) <stronk7@moodle.org>
Co-authored-by: Jun Pataleta <jun@moodle.com>
2020-11-01 11:09:39 +01:00
Claude Vervoort 60232d2b9b MDL-70074 mod_lti: add authorization_endpoint 2020-10-30 18:08:18 -04:00
Eloy Lafuente (stronk7) 864ddb77c5 MDL-69973 xmldb: Ensure all reports use fresh metadata (not cached) 2020-10-30 19:27:14 +01:00
Eloy Lafuente (stronk7) 462fe3e925 MDL-69973 xmldb: Fix problem with MariaDB >= 10.2.7 metadata defaults
With MariaDB 10.2.7 the driver was incorrectly returning '' (empty
string) as default for all the columns having null (meaning, no
default).

Also, cover the case in unit tests, it seems that we were already
testing other defaults but not the null case.
2020-10-30 19:27:14 +01:00
Eloy Lafuente (stronk7) 6bb7478e8d on-demand release 3.10beta+ 2020-10-30 13:49:20 +01:00
Jun Pataleta 03960b96cb Merge branch 'MDL-68167-310' of git://github.com/rezaies/moodle into MOODLE_310_STABLE 2020-10-30 13:16:55 +08:00
Shamim Rezaie 4d00ebae7a MDL-68167 lib: autocomplete focos should not be removed on blur
See https://www.w3.org/TR/wai-aria-practices-1.1/examples/listbox/listbox-rearrangeable.html
2020-10-30 16:08:56 +11:00
Shamim Rezaie 352e2f7787 MDL-68167 lib: Do not set aria-expanded if it should not be set 2020-10-30 16:08:56 +11:00
Shamim Rezaie 2d2b8d9170 MDL-68167 user: Fix missing label for participants filter input fields 2020-10-30 16:08:56 +11:00
Shamim Rezaie 53f2acb263 MDL-68167 lib: Clear single-select autocomplete elements with keyboard
Following MDL-57680, it should be possible to clear the selected option
using keyboard as well.
2020-10-30 16:08:56 +11:00
Shamim Rezaie 3ea25c3b77 MDL-68167 user: Fix a hardcoded string to be read from lang pack 2020-10-30 16:08:55 +11:00
Shamim Rezaie 7931148cbb MDL-68167 lib: Fix label for autocomplete selection/suggestion box
The content of the autocomplete selection div is purged by javascript
so we have to move its label outside of it. aria-labeledby is the way
to go.

Each time the suggestion box is expanded, autocomplete js renders the
autocomplete suggestions template. So the label cannot be outside the
suggestions ul.
2020-10-30 16:08:40 +11:00
Shamim Rezaie 1031836d89 MDL-68167 user: filter elements should listen to accessibleChange event 2020-10-30 15:01:39 +11:00
Shamim Rezaie ec1e1fd01a MDL-68167 lib: The accessibleChange custom event now supports bubbling
The change event bubbles so the accessibleChange shoud bubble as well.
2020-10-30 15:01:39 +11:00
Shamim Rezaie b5a04a9fe2 MDL-68167 theme_boost: make focus outline accessible for autocompletes 2020-10-30 15:01:39 +11:00
Shamim Rezaie be7b73a24b MDL-68167 lib: Autocomplete selection to use listbox aria role
The aria-selected state cannot be used for the listitem role. The
autocomplete widget highly uses the aria-selected state internally.
2020-10-30 14:59:50 +11:00
Shamim Rezaie 0c438b4d3e MDL-68167 user: Improve keyboard navigation on autocomplete fields 2020-10-30 14:59:50 +11:00
Shamim Rezaie 3f0373cb7e Merge branch 'MDL-69390-310' of git://github.com/bmbrands/moodle into MDL-69390-310-test 2020-10-30 14:59:34 +11:00
Andrew Nicols 6a64b9c5b7 Merge branch 'MDL-69156_310' of https://github.com/ffhs/moodle into MOODLE_310_STABLE 2020-10-30 11:52:07 +08:00
Víctor Déniz 04569f819f Merge branch 'MDL-70032-310-2' of git://github.com/junpataleta/moodle into MOODLE_310_STABLE 2020-10-29 22:26:35 +00:00
Paul Holden a850fa5de8 MDL-69156 backup: correct behaviour of course copy idnumber field.
When a given user doesn't have the capability to change the idnumber
field during course copy, freeze the field value.
2020-10-29 14:15:04 +01:00
Adrian Perez 8d0d0b1f59 MDL-69156 course_copy: set defaults for idnumber when not permitted 2020-10-29 14:15:00 +01:00
Jun Pataleta 8ea746fa79 MDL-70032 qtype_multichoice: Use custom partial named selector
* With the removal of the label element, Behat now has to click on the
answer text. In order to achieve this, the custom partial named selector
"qtype_multichoice > Answer" was now added and have replaced the
instances where the label of the answer's checkbox/radio button is
being clicked.
2020-10-29 16:21:53 +08:00
Jun Pataleta 5d7bd0208a MDL-70032 qtype_multichoice: Fix answer labelling
* Discard the use of the label element in order to be able to render
multiple choice answers as they are and have these act as the radio
button/checkbox' label through the aria-labelledby attribute.
* New JS module qtype_multichoice/answers that listens for click events
on the answer text container and selects the appropriate answer radio
button/checkbox.
2020-10-29 16:21:53 +08:00
Andrew Nicols 52ad601de1 Merge branch 'MDL-68722-310' of https://github.com/matt-catalyst/moodle into MOODLE_310_STABLE 2020-10-29 14:03:15 +08:00
Jake Dallimore 2e02b4d678 Merge branch 'MDL-69716-310' of git://github.com/aanabit/moodle into MOODLE_310_STABLE 2020-10-29 12:40:06 +08:00
Jake Dallimore 859578b0d5 Merge branch 'MDL-70041-310' of git://github.com/mihailges/moodle into MOODLE_310_STABLE 2020-10-29 11:49:20 +08:00
Adrian Greeve 761b8a95f9 Merge branch 'm310_MDL-70042_Progress_Bar_Upgrade_Message_Popup' of https://github.com/scara/moodle into MOODLE_310_STABLE 2020-10-29 08:33:33 +08:00
Matteo Scaramuccia 4ca3d0a0ae MDL-70042 message_popup: Trivial savepoint comment cleanup 2020-10-28 23:00:48 +01:00
Matteo Scaramuccia 75c793f830 MDL-70042 message_popup: progress bar on upgrade only when necessary 2020-10-28 23:00:32 +01:00
Jun Pataleta d546f308d2 Merge branch 'MDL-69390-310' of git://github.com/bmbrands/moodle into MOODLE_310_STABLE 2020-10-28 22:44:08 +08:00
Bas Brands 74f37f98ad MDL-69390 theme_boost: dropdown menu accessibility
- display a dot before the active element
- use the active colour for the hover colour
2020-10-28 14:03:06 +01:00
Jun Pataleta aead807ce6 Merge branch 'MDL-69815-310' of git://github.com/andrewnicols/moodle into MOODLE_310_STABLE 2020-10-28 14:19:23 +08:00
Andrew Nicols f7ad3eaca3 Merge branch 'MDL-70004-310' of git://github.com/junpataleta/moodle into MOODLE_310_STABLE 2020-10-28 13:14:12 +08:00
Jake Dallimore da4fc1e256 Merge branch 'MDL-64723-310' of git://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-28 12:10:47 +08:00
Mihail Geshoski 35364e22fc MDL-70041 filepicker: Make sure the user has a recently used license 2020-10-28 12:06:34 +08:00
Jake Dallimore b1ef67ba62 Merge branch 'MDL-65792-310' of git://github.com/bmbrands/moodle into MOODLE_310_STABLE 2020-10-28 12:00:16 +08:00
Jake Dallimore 461bf54590 Merge branch 'MDL-70010_310' of https://github.com/stronk7/moodle into MOODLE_310_STABLE 2020-10-28 11:07:52 +08:00
Andrew Nicols 6ba76c0097 MDL-69815 core: Bump Node to v14.15.0 (LTS/Fermium) 2020-10-28 09:34:31 +08:00
Eloy Lafuente (stronk7) 323ea697c3 Merge branch 'MDL-69998-310-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_310_STABLE 2020-10-28 00:42:05 +01:00
David Mudrák 05679468c5 MDL-69998 lang: Fix reworded strings in Behat test scenarios 2020-10-27 11:20:03 +01:00
Helen Foster 0a64b2ed99 MDL-69998 lang: Import fixed English strings (en_fix) 2020-10-27 11:20:03 +01:00
Bas Brands a5fa563757 MDL-65792 mod_forum: show release time on timed posts 2020-10-27 08:41:28 +01:00
Jun Pataleta c978fa26e2 MDL-70004 qtype_multichoice: Set appropriate clear my choice role 2020-10-27 09:57:32 +08:00
Paul Holden 8813318d61 MDL-64723 tool_mobile: workaround for invalid certificate parsing.
This is to account for specific server configuration that are affected
by one of the following issues, which results in certificate signature
algorithms being incorrectly parsed:

 * https://bugs.php.net/bug.php?id=77548
 * https://github.com/curl/curl/issues/3706
2020-10-26 23:04:43 +00:00
Matt Clarkson adeaafd59d MDL-68722 atto_equation: fix for form elements with special characters
Element id's containing characters such as ':' would break the tab
selector in bootstrap.

This specifically affects the essay question type.
2020-10-27 11:10:58 +13:00
Eloy Lafuente (stronk7) 7e5f0e1fe6 MDL-70010 core: reconcile MOODLE_310_STABLE and master
There are some unexpected differences between 310 and master,
better reconcile them now. Note this is not 100% critical but,
as far as nothing exclusively for 4.0 has landed to master yet
only branch/version differences should exist.
2020-10-26 11:03:40 +01:00
Amaia Anabitarte e66e3740a7 MDL-69716 mod_quiz: No timestamp for in progress attempts 2020-10-23 16:02:25 +02:00
559 changed files with 2442 additions and 1469 deletions
+1 -1
View File
@@ -1 +1 @@
v14.0.0
v14.15.0
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_analytics'; // Full name of the plugin (used for diagnostics).
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->component = 'tool_availabilityconditions';
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'tool_behat'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_capability'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -25,8 +25,8 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_cohortroles'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = array(
@@ -33,8 +33,8 @@ $string['checkoutinprogress'] = 'Loading language pack';
$string['cliexportfileexists'] = 'File for {$a->lang} already exists, skipping. If you want to overwrite add the --override=true option.';
$string['cliexportheading'] = 'Starting to export lang files.';
$string['cliexportnofilefoundforlang'] = 'No file found to export. Skipping export for this language.';
$string['cliexportfilenotfoundforcomponent'] = 'File {$a->filepath} not found for language {$a->lang}.Skipping this file.';
$string['cliexportstartexport'] = 'Exporting language "{$a}"';
$string['cliexportfilenotfoundforcomponent'] = 'File {$a->filepath} not found for language {$a->lang}. Skipping this file.';
$string['cliexportstartexport'] = 'Exporting language {$a}';
$string['cliexportzipdone'] = 'Zip created: {$a}';
$string['cliexportzipfail'] = 'Cannot create zip {$a}';
$string['clifiles'] = 'Files to import into {$a}';
+2 -2
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020101300;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->component = 'tool_customlang'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2020061501;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->component = 'tool_dataprivacy';
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_dbtransfer'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->component = 'tool_filetypes';
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->component = 'tool_generator';
+2 -2
View File
@@ -25,8 +25,8 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'tool_health'; // Full name of the plugin (used for diagnostics)
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_httpsreplace'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'tool_innodb'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'tool_installaddon';
$plugin->version = 2020061500;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->maturity = MATURITY_STABLE;
+2 -2
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'tool_langimport'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,8 +24,8 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500;
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900;
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_licensemanager';
$plugin->maturity = MATURITY_STABLE;
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'logstore_database'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'logstore_legacy'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'logstore_standard'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_log'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_lp'; // Full name of the plugin (used for diagnostics).
+3 -3
View File
@@ -25,8 +25,8 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_lpimportcsv'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = array('tool_lp' => 2020060900);
$plugin->dependencies = array('tool_lp' => 2020110300);
+2 -2
View File
@@ -24,8 +24,8 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_lpmigrate'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = array(
'tool_lp' => ANY_VERSION
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->component = 'tool_messageinbound';
+14 -1
View File
@@ -603,8 +603,21 @@ class api {
$timenow = time();
$expectedissuer = null;
foreach ($info['certinfo'] as $cert) {
// Due to a bug in certain curl/openssl versions the signature algorithm isn't always correctly parsed.
// See https://github.com/curl/curl/issues/3706 for reference.
if (!array_key_exists('Signature Algorithm', $cert)) {
// The malformed field that does contain the algorithm we're looking for looks like the following:
// <WHITESPACE>Signature Algorithm: <ALGORITHM><CRLF><ALGORITHM>.
preg_match('/\s+Signature Algorithm: (?<algorithm>[^\s]+)/', $cert['Public Key Algorithm'], $matches);
$signaturealgorithm = $matches['algorithm'] ?? '';
} else {
$signaturealgorithm = $cert['Signature Algorithm'];
}
// Check if the signature algorithm is weak (Android won't work with SHA-1).
if ($cert['Signature Algorithm'] == 'sha1WithRSAEncryption' || $cert['Signature Algorithm'] == 'sha1WithRSA') {
if ($signaturealgorithm == 'sha1WithRSAEncryption' || $signaturealgorithm == 'sha1WithRSA') {
$warnings[] = ['insecurealgorithmwarning', 'tool_mobile'];
}
// Check certificate start date.
+1 -1
View File
@@ -64,7 +64,7 @@ $string['downloadcourses'] = 'Download courses';
$string['enablesmartappbanners'] = 'Enable App Banners';
$string['enablesmartappbanners_desc'] = 'If enabled, a banner promoting the mobile app will be displayed when accessing the site using a mobile browser.';
$string['filetypeexclusionlist'] = 'File type exclusion list';
$string['filetypeexclusionlist_desc'] = 'List of file types that we don\'t want users to try and open in the app. These files will still be listed on the app\'s course screen, but attempting to open them on iOS or Android would display a warning to the user indicating that this file type is not intended for use on a mobile device. They can then either cancel the open, or ignore the warning and open anyway.';
$string['filetypeexclusionlist_desc'] = 'Select all file types which are not for use on a mobile device. Such files will be listed in the course, then if a user attempts to open them, a warning will be displayed advising that the file type is not intended for use on a mobile device. The user can then cancel or ignore the warning and open the file anyway.';
$string['filetypeexclusionlistplaceholder'] = 'Mobile file type exclusion list';
$string['forcedurlscheme'] = 'If you want to allow only your custom branded app to be opened via a browser window, then specify its URL scheme here. If you want to allow only the official app, then set the default value. Leave the field empty if you want to allow any app.';
$string['forcedurlscheme_key'] = 'URL scheme';
+3 -3
View File
@@ -23,9 +23,9 @@
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061501; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_mobile'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = array(
'webservice_rest' => 2020060900
'webservice_rest' => 2020110300
);
+2 -2
View File
@@ -26,6 +26,6 @@
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_monitor'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'tool_moodlenet';
$plugin->version = 2020090700;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->maturity = MATURITY_ALPHA;
+2 -2
View File
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'tool_multilangupgrade'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_oauth2'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'tool_phpunit'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_policy'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'tool_profiling'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_recyclebin'; // Full name of the plugin (used for diagnostics).
+1 -1
View File
@@ -23,7 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['additionalskiptables'] = 'Additional skip tables';
$string['additionalskiptables_desc'] = 'Please specify the additional tables (comma separated list) you want to skip while running DB search and replace.';
$string['additionalskiptables_desc'] = 'A list of tables (separated by commas) which should be skipped when running the database search and replace.';
$string['cannotfit'] = 'The replacement is longer than the original and shortening is not allowed; cannot continue.';
$string['disclaimer'] = 'I understand the risks of this operation';
$string['doit'] = 'Yes, do it!';
+2 -2
View File
@@ -25,8 +25,8 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'tool_replace'; // Full name of the plugin (used for diagnostics)
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
+2 -2
View File
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->component = 'tool_spamcleaner'; // Full name of the plugin (used for diagnostics)
+3 -3
View File
@@ -22,9 +22,9 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['adhoc'] = 'Ad-hoc';
$string['adhoctaskid'] = 'Ad-hoc task id: {$a}';
$string['adhoctasks'] = 'Ad-hoc tasks';
$string['adhoc'] = 'Ad hoc';
$string['adhoctaskid'] = 'Ad hoc task ID: {$a}';
$string['adhoctasks'] = 'Ad hoc tasks';
$string['asap'] = 'ASAP';
$string['adhocempty'] = 'Ad hoc task queue is empty';
$string['adhocqueuesize'] = 'Ad hoc task queue has {$a} tasks';
@@ -28,13 +28,13 @@ Feature: See running scheduled tasks
And I should see "1914" in the "Automated backups" "table_row"
# Check the "asynchronous_backup_task" adhoc task details.
And I should see "Ad-hoc" in the "\core\task\asynchronous_backup_task" "table_row"
And I should see "Ad hoc" in the "\core\task\asynchronous_backup_task" "table_row"
And I should see "2 hours" in the "core\task\asynchronous_backup_task" "table_row"
And I should see "c69335460f7f" in the "core\task\asynchronous_backup_task" "table_row"
And I should see "1915" in the "core\task\asynchronous_backup_task" "table_row"
# Check the "asynchronous_restore_task" adhoc task details.
And I should see "Ad-hoc" in the "\core\task\asynchronous_restore_task" "table_row"
And I should see "Ad hoc" in the "\core\task\asynchronous_restore_task" "table_row"
And I should see "2 days" in the "core\task\asynchronous_restore_task" "table_row"
And I should see "c69335460f7f" in the "core\task\asynchronous_restore_task" "table_row"
And I should see "1916" in the "core\task\asynchronous_restore_task" "table_row"
+2 -2
View File
@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061501; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'tool_task'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -21,6 +21,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_templatelibrary'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'tool_unsuproles'; // Full name of the plugin (used for diagnostics)
+32 -39
View File
@@ -980,55 +980,48 @@ class tool_uploadcourse_course {
unset($method['delete']);
unset($method['disable']);
if (!empty($instance) && $todelete) {
if ($todelete) {
// Remove the enrolment method.
foreach ($instances as $instance) {
if ($instance->enrol == $enrolmethod) {
$plugin = $enrolmentplugins[$instance->enrol];
if ($instance) {
$plugin = $enrolmentplugins[$instance->enrol];
// Ensure user is able to delete the instance.
if ($plugin->can_delete_instance($instance)) {
$plugin->delete_instance($instance);
} else {
$this->error('errorcannotdeleteenrolment',
new lang_string('errorcannotdeleteenrolment', 'tool_uploadcourse',
$plugin->get_instance_name($instance)));
}
break;
}
}
} else if (!empty($instance) && $todisable) {
// Disable the enrolment.
foreach ($instances as $instance) {
if ($instance->enrol == $enrolmethod) {
$plugin = $enrolmentplugins[$instance->enrol];
// Ensure user is able to toggle instance status.
if ($plugin->can_hide_show_instance($instance)) {
$plugin->update_status($instance, ENROL_INSTANCE_DISABLED);
} else {
$this->error('errorcannotdisableenrolment',
new lang_string('errorcannotdisableenrolment', 'tool_uploadcourse',
$plugin->get_instance_name($instance)));
}
break;
// Ensure user is able to delete the instance.
if ($plugin->can_delete_instance($instance)) {
$plugin->delete_instance($instance);
} else {
$this->error('errorcannotdeleteenrolment',
new lang_string('errorcannotdeleteenrolment', 'tool_uploadcourse',
$plugin->get_instance_name($instance)));
}
}
} else {
// Create/update enrolment.
$plugin = $enrolmentplugins[$enrolmethod];
// Ensure user is able to create/update instance.
$status = ($todisable) ? ENROL_INSTANCE_DISABLED : ENROL_INSTANCE_ENABLED;
// Create a new instance if necessary.
if (empty($instance) && $plugin->can_add_instance($course->id)) {
$instance = new stdClass();
$instance->id = $plugin->add_default_instance($course);
$instanceid = $plugin->add_default_instance($course);
$instance = $DB->get_record('enrol', ['id' => $instanceid]);
$instance->roleid = $plugin->get_config('roleid');
$instance->status = ENROL_INSTANCE_ENABLED;
} else if (!empty($instance) && $plugin->can_edit_instance($instance)) {
$plugin->update_status($instance, ENROL_INSTANCE_ENABLED);
} else {
// On creation the user can decide the status.
$plugin->update_status($instance, $status);
}
// Check if the we need to update the instance status.
if ($instance && $status != $instance->status) {
if ($plugin->can_hide_show_instance($instance)) {
$plugin->update_status($instance, $status);
} else {
$this->error('errorcannotdisableenrolment',
new lang_string('errorcannotdisableenrolment', 'tool_uploadcourse',
$plugin->get_instance_name($instance)));
break;
}
}
if (empty($instance) || !$plugin->can_edit_instance($instance)) {
$this->error('errorcannotcreateorupdateenrolment',
new lang_string('errorcannotcreateorupdateenrolment', 'tool_uploadcourse',
$plugin->get_instance_name($instance)));
@@ -0,0 +1,114 @@
@tool @tool_uploadcourse @_file_upload
Feature: An admin can update courses enrolments using a CSV file
In order to update courses enrolments using a CSV file
As an admin
I need to be able to upload a CSV file with enrolment methods for the courses
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
@javascript
Scenario: Creating enrolment method by enable it
Given I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I click on "Delete" "link" in the "Guest access" "table_row"
And I click on "Continue" "button"
And I should not see "Guest access" in the "generaltable" "table"
And I navigate to "Courses > Upload courses" in site administration
And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_enable.csv" file to "File" filemanager
And I set the field "Upload mode" to "Only update existing courses"
And I set the field "Update mode" to "Update with CSV data only"
And I set the field "Allow deletes" to "Yes"
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And "Disable" "icon" should exist in the "Guest access" "table_row"
@javascript
Scenario: Creating enrolment method by disabling it
Given I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I click on "Delete" "link" in the "Guest access" "table_row"
And I click on "Continue" "button"
And I should not see "Guest access" in the "generaltable" "table"
And I navigate to "Courses > Upload courses" in site administration
And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_disable.csv" file to "File" filemanager
And I set the field "Upload mode" to "Only update existing courses"
And I set the field "Update mode" to "Update with CSV data only"
And I set the field "Allow deletes" to "Yes"
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And "Enable" "icon" should exist in the "Guest access" "table_row"
@javascript
Scenario: Enabling enrolment method
Given I navigate to "Courses > Upload courses" in site administration
And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_enable.csv" file to "File" filemanager
And I set the field "Upload mode" to "Only update existing courses"
And I set the field "Update mode" to "Update with CSV data only"
And I set the field "Allow deletes" to "Yes"
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And "Disable" "icon" should exist in the "Guest access" "table_row"
@javascript
Scenario: Disable an enrolment method
Given I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I click on "Enable" "link" in the "Guest access" "table_row"
And "Disable" "icon" should exist in the "Guest access" "table_row"
And I navigate to "Courses > Upload courses" in site administration
And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_disable.csv" file to "File" filemanager
And I set the field "Upload mode" to "Only update existing courses"
And I set the field "Update mode" to "Update with CSV data only"
And I set the field "Allow deletes" to "Yes"
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And "Enable" "icon" should exist in the "Guest access" "table_row"
@javascript
Scenario: Delete an enrolment method
Given I navigate to "Courses > Upload courses" in site administration
And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_delete.csv" file to "File" filemanager
And I set the field "Upload mode" to "Only update existing courses"
And I set the field "Update mode" to "Update with CSV data only"
And I set the field "Allow deletes" to "Yes"
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I should not see "Guest access" in the "generaltable" "table"
@javascript
Scenario: Delete an unexistent enrolment method (nothing should change)
Given I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I click on "Delete" "link" in the "Guest access" "table_row"
And I click on "Continue" "button"
And I should not see "Guest access" in the "generaltable" "table"
And I navigate to "Courses > Upload courses" in site administration
And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_delete.csv" file to "File" filemanager
And I set the field "Upload mode" to "Only update existing courses"
And I set the field "Update mode" to "Update with CSV data only"
And I set the field "Allow deletes" to "Yes"
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I should not see "Guest access" in the "generaltable" "table"
@@ -0,0 +1,2 @@
shortname,category,enrolment_1,enrolment_1_delete
C1,1,guest,1
1 shortname category enrolment_1 enrolment_1_delete
2 C1 1 guest 1
@@ -0,0 +1,2 @@
shortname,category,enrolment_1,enrolment_1_disable
C1,1,guest,1
1 shortname category enrolment_1 enrolment_1_disable
2 C1 1 guest 1
@@ -0,0 +1,2 @@
shortname,category,enrolment_1,enrolment_1_disable
C1,1,guest,0
1 shortname category enrolment_1 enrolment_1_disable
2 C1 1 guest 0
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_uploadcourse'; // Full name of the plugin (used for diagnostics).
+18 -18
View File
@@ -1119,10 +1119,10 @@ class process {
$this->upt->track('enrolments', get_string('unknowncourse', 'error', s($shortname)), 'error');
continue;
}
$ccache[$shortname] = $course;
$ccache[$shortname]->groups = null;
$this->ccache[$shortname] = $course;
$this->ccache[$shortname]->groups = null;
}
$courseid = $ccache[$shortname]->id;
$courseid = $this->ccache[$shortname]->id;
$coursecontext = \context_course::instance($courseid);
if (!isset($this->manualcache[$courseid])) {
$this->manualcache[$courseid] = false;
@@ -1241,41 +1241,41 @@ class process {
continue;
}
// Build group cache.
if (is_null($ccache[$shortname]->groups)) {
$ccache[$shortname]->groups = array();
if (is_null($this->ccache[$shortname]->groups)) {
$this->ccache[$shortname]->groups = array();
if ($groups = groups_get_all_groups($courseid)) {
foreach ($groups as $gid => $group) {
$ccache[$shortname]->groups[$gid] = new \stdClass();
$ccache[$shortname]->groups[$gid]->id = $gid;
$ccache[$shortname]->groups[$gid]->name = $group->name;
$this->ccache[$shortname]->groups[$gid] = new \stdClass();
$this->ccache[$shortname]->groups[$gid]->id = $gid;
$this->ccache[$shortname]->groups[$gid]->name = $group->name;
if (!is_numeric($group->name)) { // Only non-numeric names are supported!!!
$ccache[$shortname]->groups[$group->name] = new \stdClass();
$ccache[$shortname]->groups[$group->name]->id = $gid;
$ccache[$shortname]->groups[$group->name]->name = $group->name;
$this->ccache[$shortname]->groups[$group->name] = new \stdClass();
$this->ccache[$shortname]->groups[$group->name]->id = $gid;
$this->ccache[$shortname]->groups[$group->name]->name = $group->name;
}
}
}
}
// Group exists?
$addgroup = $user->{'group'.$i};
if (!array_key_exists($addgroup, $ccache[$shortname]->groups)) {
if (!array_key_exists($addgroup, $this->ccache[$shortname]->groups)) {
// If group doesn't exist, create it.
$newgroupdata = new \stdClass();
$newgroupdata->name = $addgroup;
$newgroupdata->courseid = $ccache[$shortname]->id;
$newgroupdata->courseid = $this->ccache[$shortname]->id;
$newgroupdata->description = '';
$gid = groups_create_group($newgroupdata);
if ($gid) {
$ccache[$shortname]->groups[$addgroup] = new \stdClass();
$ccache[$shortname]->groups[$addgroup]->id = $gid;
$ccache[$shortname]->groups[$addgroup]->name = $newgroupdata->name;
$this->ccache[$shortname]->groups[$addgroup] = new \stdClass();
$this->ccache[$shortname]->groups[$addgroup]->id = $gid;
$this->ccache[$shortname]->groups[$addgroup]->name = $newgroupdata->name;
} else {
$this->upt->track('enrolments', get_string('unknowngroup', 'error', s($addgroup)), 'error');
continue;
}
}
$gid = $ccache[$shortname]->groups[$addgroup]->id;
$gname = $ccache[$shortname]->groups[$addgroup]->name;
$gid = $this->ccache[$shortname]->groups[$addgroup]->id;
$gname = $this->ccache[$shortname]->groups[$addgroup]->name;
try {
if (groups_add_member($gid, $user->id)) {
+2 -2
View File
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'tool_uploaduser'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020082701; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'tool_usertours'; // Full name of the plugin (used for diagnostics).
@@ -149,7 +149,7 @@ abstract class XMLDBCheckAction extends XMLDBAction {
continue;
}
// Fetch metadata from physical DB. All the columns info.
if (!$metacolumns = $DB->get_columns($xmldb_table->getName())) {
if (!$metacolumns = $DB->get_columns($xmldb_table->getName(), false)) {
// / Skip table if no metacolumns is available for it
continue;
}
+2 -2
View File
@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'tool_xmldb'; // Full name of the plugin (used for diagnostics)
+3 -3
View File
@@ -26,8 +26,8 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020081700; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'auth_cas'; // Full name of the plugin (used for diagnostics)
$plugin->dependencies = array('auth_ldap' => 2020060900);
$plugin->dependencies = array('auth_ldap' => 2020110300);
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'auth_db'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'auth_email'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020081700; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'auth_ldap'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'auth_lti'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'auth_manual'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'auth_mnet'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'auth_nologin'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'auth_none'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'auth_oauth2'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'auth_shibboleth'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'auth_webservice'; // Full name of the plugin (used for diagnostics)
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->component = 'availability_completion';
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->component = 'availability_date';
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->component = 'availability_grade';
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->component = 'availability_group';
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->component = 'availability_grouping';
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->component = 'availability_profile';
+1 -1
View File
@@ -156,7 +156,7 @@ abstract class backup implements checksumable {
* point is backup when some behavior/approach channged, in order to allow
* conditional coding based on it.
*/
const VERSION = 2020061500;
const VERSION = 2020110900;
/**
* Usually same than major release zero version, mainly for informative/historic purposes.
*/
@@ -369,6 +369,7 @@ class restore_controller extends base_controller {
$options = array();
$options['keep_roles_and_enrolments'] = $this->get_setting_value('keep_roles_and_enrolments');
$options['keep_groups_and_groupings'] = $this->get_setting_value('keep_groups_and_groupings');
$options['userid'] = $this->userid;
restore_dbops::delete_course_content($this->get_courseid(), $options);
}
// If this is not a course restore or single activity restore (e.g. duplicate), inform the plan we are not
+33 -7
View File
@@ -2121,14 +2121,29 @@ class restore_ras_and_caps_structure_step extends restore_structure_step {
$data = (object)$data;
// Check roleid is one of the mapped ones
$newroleid = $this->get_mappingid('role', $data->roleid);
$newrole = $this->get_mapping('role', $data->roleid);
$newroleid = $newrole->newitemid ?? false;
$userid = $this->task->get_userid();
// If newroleid and context are valid assign it via API (it handles dupes and so on)
if ($newroleid && $this->task->get_contextid()) {
if (!get_capability_info($data->capability)) {
if (!$capability = get_capability_info($data->capability)) {
$this->log("Capability '{$data->capability}' was not found!", backup::LOG_WARNING);
} else {
// TODO: assign_capability() needs one userid param to be able to specify our restore userid.
assign_capability($data->capability, $data->permission, $newroleid, $this->task->get_contextid());
$context = context::instance_by_id($this->task->get_contextid());
$overrideableroles = get_overridable_roles($context, ROLENAME_SHORT);
$safecapability = is_safe_capability($capability);
// Check if the new role is an overrideable role AND if the user performing the restore has the
// capability to assign the capability.
if (in_array($newrole->info['shortname'], $overrideableroles) &&
($safecapability && has_capability('moodle/role:safeoverride', $context, $userid) ||
!$safecapability && has_capability('moodle/role:override', $context, $userid))
) {
assign_capability($data->capability, $data->permission, $newroleid, $this->task->get_contextid());
} else {
$this->log("Insufficient capability to assign capability '{$data->capability}' to role!", backup::LOG_WARNING);
}
}
}
}
@@ -2148,11 +2163,22 @@ class restore_default_enrolments_step extends restore_execution_step {
}
$course = $DB->get_record('course', array('id'=>$this->get_courseid()), '*', MUST_EXIST);
// Return any existing course enrolment instances.
$enrolinstances = enrol_get_instances($course->id, false);
if ($enrolinstances) {
// Something already added instances.
// Get the existing enrolment methods in the course.
$enrolmethods = array_map(function($enrolinstance) {
return $enrolinstance->enrol;
}, $enrolinstances);
if ($DB->record_exists('enrol', array('courseid'=>$this->get_courseid(), 'enrol'=>'manual'))) {
// Something already added instances, do not add default instances.
$plugins = enrol_get_plugins(true);
foreach ($plugins as $plugin) {
foreach ($plugins as $pluginname => $plugin) {
// Make sure all default enrolment methods exist in the course.
if (!in_array($pluginname, $enrolmethods)) {
$plugin->course_updated(true, $course, null);
}
$plugin->restore_sync_course($course);
}
+5 -4
View File
@@ -152,13 +152,14 @@ class copy_form extends \moodleform {
$mform->addHelpButton('relativedatesmodegroup', 'relativedatesmode');
}
// Course id number.
// Course ID number (default to the current course ID number; blank for users who can't change ID numbers).
$mform->addElement('text', 'idnumber', get_string('idnumbercourse'), 'maxlength="100" size="10"');
$mform->setDefault('idnumber', $course->idnumber);
$mform->addHelpButton('idnumber', 'idnumbercourse');
$mform->setType('idnumber', PARAM_RAW);
if (!empty($course->id) and !has_capability('moodle/course:changeidnumber', $coursecontext)) {
if (!has_capability('moodle/course:changeidnumber', $coursecontext)) {
$mform->hardFreeze('idnumber');
$mform->setConstants('idnumber', $course->idnumber);
$mform->setConstant('idnumber', '');
}
// Keep source course user data.
@@ -172,7 +173,7 @@ class copy_form extends \moodleform {
);
if (!has_all_capabilities($requiredcapabilities, $coursecontext)) {
$mform->hardFreeze('userdata');
$mform->setConstants('userdata', 0);
$mform->setConstant('userdata', 0);
}
// Keep manual enrolments.
+1 -1
View File
@@ -98,7 +98,7 @@ if (!empty($issuedbadge->recipient->id)) {
$assertionid
);
if (!$assertionentityid && strpos($sitebackpack->backpackapiurl, 'badgr')) {
if ($assertionentityid && strpos($sitebackpack->backpackapiurl, 'badgr')) {
$assertionentityid = badges_generate_badgr_open_url(
$sitebackpack,
OPEN_BADGES_V2_TYPE_ASSERTION,
+20 -6
View File
@@ -39,6 +39,20 @@ use stdClass;
*/
class assertion_exporter extends exporter {
/**
* Constructor - saves the persistent object, and the related objects.
*
* @param mixed $data - Either an stdClass or an array of values.
* @param array $related - An optional list of pre-loaded objects related to this object.
*/
public function __construct($data, $related = array()) {
// Having mixed $data is causing some issues. As this class is treating $data as an object everywhere, it can be converted
// to object at this point, to avoid errors and get the expected behaviour always.
// $data is an array when this class is a request exporter in backpack_api_mapping, but it is an object when this is
// used as a response exporter.
parent::__construct((object) $data, $related);
}
/**
* Map from a request response data to the internal structure.
*
@@ -104,16 +118,16 @@ class assertion_exporter extends exporter {
global $DB;
$result = [];
if (array_key_exists('related_badge', $this->data)) {
$exporter = new badgeclass_exporter($this->data['related_badge'], $this->related);
if (property_exists($this->data, 'related_badge')) {
$exporter = new badgeclass_exporter($this->data->related_badge, $this->related);
$result['badge'] = $exporter->export($output);
}
if (array_key_exists('related_recipient', $this->data)) {
$exporter = new recipient_exporter($this->data['related_recipient'], $this->related);
if (property_exists($this->data, 'related_recipient')) {
$exporter = new recipient_exporter($this->data->related_recipient, $this->related);
$result['recipient'] = $exporter->export($output);
}
if (array_key_exists('related_verify', $this->data)) {
$exporter = new verification_exporter($this->data['related_verify'], $this->related);
if (property_exists($this->data, 'related_verify')) {
$exporter = new verification_exporter($this->data->related_verify, $this->related);
$result['verification'] = $exporter->export($output);
}
return $result;
+14 -8
View File
@@ -45,6 +45,12 @@ class badgeclass_exporter extends exporter {
* @param array $related - An optional list of pre-loaded objects related to this object.
*/
public function __construct($data, $related = array()) {
// Having mixed $data is causing some issues. As this class is treating $data as an object everywhere, it can be converted
// to object at this point, to avoid errors and get the expected behaviour always.
// $data is an array when this class is a request exporter in backpack_api_mapping, but it is an object when this is
// used as a response exporter.
$data = (object) $data;
$pick = $this->pick_related();
foreach ($pick as $one) {
$isarray = false;
@@ -54,28 +60,28 @@ class badgeclass_exporter extends exporter {
$isarray = true;
}
$prefixed = 'related_' . $one;
if (array_key_exists($one, $data) && !array_key_exists($one, $related)) {
if (property_exists($data, $one) && !array_key_exists($one, $related)) {
if ($isarray) {
$newrelated = [];
foreach ($data[$one] as $item) {
foreach ($data->$one as $item) {
$newrelated[] = (object) $item;
}
$related[$one] = $newrelated;
} else {
$related[$one] = (object) $data[$one];
$related[$one] = (object) $data->$one;
}
unset($data[$one]);
} else if (array_key_exists($prefixed, $data) && !array_key_exists($one, $related)) {
unset($data->$one);
} else if (property_exists($data, $prefixed) && !array_key_exists($one, $related)) {
if ($isarray) {
$newrelated = [];
foreach ($data[$prefixed] as $item) {
foreach ($data->$prefixed as $item) {
$newrelated[] = (object) $item;
}
$related[$one] = $newrelated;
} else {
$related[$one] = (object) $data[$prefixed];
$related[$one] = (object) $data->$prefixed;
}
unset($data[$prefixed]);
unset($data->$prefixed);
} else if (!array_key_exists($one, $related)) {
$related[$one] = null;
}
+2 -2
View File
@@ -805,7 +805,7 @@ class core_badges_renderer extends plugin_renderer_base {
);
if (has_capability('moodle/badges:configuredetails', $context)) {
$row[] = new tabobject('details',
$row[] = new tabobject('badge',
new moodle_url('/badges/edit.php', array('id' => $badgeid, 'action' => 'badge')),
get_string('bdetails', 'badges')
);
@@ -856,7 +856,7 @@ class core_badges_renderer extends plugin_renderer_base {
if (has_capability('moodle/badges:configuredetails', $context)) {
$alignments = $DB->count_records_sql("SELECT COUNT(bc.id)
FROM {badge_alignment} bc WHERE bc.badgeid = :badgeid", array('badgeid' => $badgeid));
$row[] = new tabobject('balignment',
$row[] = new tabobject('alignment',
new moodle_url('/badges/alignment.php', array('id' => $badgeid)),
get_string('balignment', 'badges', $alignments)
);
+79 -33
View File
@@ -1012,41 +1012,40 @@ class core_badges_badgeslib_testcase extends advanced_testcase {
];
}
/**
* Test badges_save_external_backpack without any auth details and also tests duplicate entries.
* Test badges_save_external_backpack.
*
* @param boolean $withauth Test with authentication details provided
* @param boolean $duplicates Test for duplicates
* @dataProvider test_badges_save_external_backpack_provider
* @throws dml_exception
* @dataProvider badges_save_external_backpack_provider
* @param array $data Backpack data to save.
* @param bool $adduser True if a real user has to be used for creating the backpack; false otherwise.
* @param bool $duplicates True if duplicates has to be tested too; false otherwise.
*/
public function test_badges_save_external_backpack($withauth, $duplicates) {
public function test_badges_save_external_backpack(array $data, bool $adduser, bool $duplicates) {
global $DB;
$this->resetAfterTest();
$user = $this->getDataGenerator()->create_user();
$data = [
'userid' => $user->id,
'apiversion' => 2,
'backpackapiurl' => 'https://api.ca.badgr.io/v2',
'backpackweburl' => 'https://ca.badgr.io',
];
if ($withauth) {
$data['backpackemail'] = 'test@test.com';
$data['password'] = 'test';
$userid = 0;
if ($adduser) {
$user = $this->getDataGenerator()->create_user();
$userid = $user->id;
$data['userid'] = $user->id;
}
$result = badges_save_external_backpack((object) $data);
$this->assertNotEquals(0, $result);
$record = $DB->get_record('badge_external_backpack', ['id' => $result]);
$this->assertEquals($record->backpackweburl, $data['backpackweburl']);
$this->assertEquals($record->backpackapiurl, $data['backpackapiurl']);
$record = $DB->get_record('badge_backpack', ['userid' => $user->id]);
if (!$withauth) {
$record = $DB->get_record('badge_backpack', ['externalbackpackid' => $result]);
if (!array_key_exists('backpackemail', $data) && !array_key_exists('password', $data)) {
$this->assertEmpty($record);
$total = $DB->count_records('badge_backpack');
$this->assertEquals(0, $total);
} else {
$this->assertNotEmpty($record);
$this->assertEquals($record->userid, $userid);
}
if ($duplicates) {
@@ -1061,19 +1060,66 @@ class core_badges_badgeslib_testcase extends advanced_testcase {
*
* @return array
*/
public function test_badges_save_external_backpack_provider() {
public function badges_save_external_backpack_provider() {
$data = [
'apiversion' => 2,
'backpackapiurl' => 'https://api.ca.badgr.io/v2',
'backpackweburl' => 'https://ca.badgr.io',
];
return [
"Test without any auth details and duplicates" => [
false, true
'Test without user and auth details. Check duplicates too' => [
'data' => $data,
'adduser' => false,
'duplicates' => true,
],
"Test without any auth details and without duplicates" => [
false, false
'Test without user and auth details. No duplicates' => [
'data' => $data,
'adduser' => false,
'duplicates' => false,
],
"Test with auth details and duplicates" => [
true, true
'Test with user and without auth details' => [
'data' => $data,
'adduser' => true,
'duplicates' => false,
],
"Test with any auth details and duplicates" => [
true, false
'Test with user and without auth details. Check duplicates too' => [
'data' => $data,
'adduser' => true,
'duplicates' => true,
],
'Test with empty backpackemail, password and id' => [
'data' => array_merge($data, [
'backpackemail' => '',
'password' => '',
'id' => 0,
]),
'adduser' => false,
'duplicates' => false,
],
'Test with empty backpackemail, password and id but with user' => [
'data' => array_merge($data, [
'backpackemail' => '',
'password' => '',
'id' => 0,
]),
'adduser' => true,
'duplicates' => false,
],
'Test with auth details but without user' => [
'data' => array_merge($data, [
'backpackemail' => 'test@test.com',
'password' => 'test',
]),
'adduser' => false,
'duplicates' => false,
],
'Test with auth details and user' => [
'data' => array_merge($data, [
'backpackemail' => 'test@test.com',
'password' => 'test',
]),
'adduser' => true,
'duplicates' => false,
],
];
}
@@ -1083,7 +1129,7 @@ class core_badges_badgeslib_testcase extends advanced_testcase {
*
* @param boolean $isadmin
* @param boolean $updatetest
* @dataProvider test_badges_create_site_backpack_provider
* @dataProvider badges_create_site_backpack_provider
*/
public function test_badges_create_site_backpack($isadmin, $updatetest) {
global $DB;
@@ -1129,7 +1175,7 @@ class core_badges_badgeslib_testcase extends advanced_testcase {
/**
* Provider for test_badges_(create/update)_site_backpack
*/
public function test_badges_create_site_backpack_provider() {
public function badges_create_site_backpack_provider() {
return [
"Test as admin user - creation test" => [true, true],
"Test as admin user - update test" => [true, false],
@@ -1253,7 +1299,7 @@ class core_badges_badgeslib_testcase extends advanced_testcase {
* Test the badges_get_site_primary_backpack function
*
* @param boolean $withauth Testing with authentication or not.
* @dataProvider test_badges_get_site_primary_backpack_provider
* @dataProvider badges_get_site_primary_backpack_provider
*/
public function test_badges_get_site_primary_backpack($withauth) {
$data = [
@@ -1289,7 +1335,7 @@ class core_badges_badgeslib_testcase extends advanced_testcase {
*
* @return array
*/
public function test_badges_get_site_primary_backpack_provider() {
public function badges_get_site_primary_backpack_provider() {
return [
"Test with auth details" => [true],
"Test without auth details" => [false],
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'block_activity_modules'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'block_activity_results'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'block_admin_bookmarks'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'block_badges';
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'block_blog_menu'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'block_blog_recent'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'block_blog_tags'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'block_calendar_month'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'block_calendar_upcoming'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'block_comments'; // Full name of the plugin (used for diagnostics)
+3 -3
View File
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020110300; // Requires this Moodle version.
$plugin->component = 'block_completionstatus';
$plugin->dependencies = array('report_completion' => 2020060900);
$plugin->dependencies = array('report_completion' => 2020110300);
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'block_course_list'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'block_course_summary'; // Full name of the plugin (used for diagnostics)
+3 -3
View File
@@ -24,8 +24,8 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'block_feedback'; // Full name of the plugin (used for diagnostics)
$plugin->dependencies = array('mod_feedback' => 2020060900);
$plugin->dependencies = array('mod_feedback' => 2020110300);
+2 -2
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2020061500;
$plugin->requires = 2020060900;
$plugin->version = 2020110900;
$plugin->requires = 2020110300;
$plugin->component = 'block_globalsearch';
+3 -3
View File
@@ -24,8 +24,8 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'block_glossary_random'; // Full name of the plugin (used for diagnostics)
$plugin->dependencies = array('mod_glossary' => 2020060900);
$plugin->dependencies = array('mod_glossary' => 2020110300);
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020060900; // Requires this Moodle version
$plugin->version = 2020110900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2020110300; // Requires this Moodle version
$plugin->component = 'block_html'; // Full name of the plugin (used for diagnostics)

Some files were not shown because too many files have changed in this diff Show More