Compare commits
108 Commits
v3.10.0-beta
...
v3.10.0
| Author | SHA1 | Date | |
|---|---|---|---|
| ec58cefefb | |||
| e4cda88e76 | |||
| 8752df87ed | |||
| 511dab1cd3 | |||
| b26a5e5e08 | |||
| fcb699808c | |||
| f9dc16ca05 | |||
| a350376b65 | |||
| 29f7a9a210 | |||
| 022a019637 | |||
| 50f5563c1f | |||
| 1c0b8f8c50 | |||
| c879cb24df | |||
| 6890ad18e3 | |||
| b88679e3a1 | |||
| 8c1917588d | |||
| c50c904c9e | |||
| 9023021ae0 | |||
| 919ead58fe | |||
| 27de77007b | |||
| 34d1c23668 | |||
| dc7ca062ca | |||
| 8100d46f85 | |||
| f4dfe66ea8 | |||
| e92c6b19b8 | |||
| fa79a1876c | |||
| c9ab02b0cc | |||
| 9c2241dee4 | |||
| 8028bf10dc | |||
| 04704c2108 | |||
| fbe13d55f3 | |||
| 75d6582fef | |||
| 7ca4fd97d9 | |||
| 940ed72017 | |||
| 477cd8b5fe | |||
| a8efb07714 | |||
| 51c9ea5194 | |||
| b0a1b4ce8b | |||
| 3d9175f6f1 | |||
| fd2427746f | |||
| 49afa008f4 | |||
| 551892e2a7 | |||
| 45c339ef09 | |||
| e9fe9f4ae3 | |||
| 1d1b148ca9 | |||
| 15b4174a9f | |||
| 99ab172211 | |||
| 5cc9f3448c | |||
| 4dd870de20 | |||
| c353963ef8 | |||
| 60585523ad | |||
| eeaf19eb5c | |||
| 63da614e4f | |||
| 73372330a9 | |||
| 5f3de24306 | |||
| c15eac212b | |||
| 01c8c8828b | |||
| 2dbe5f54f1 | |||
| bcf59d235b | |||
| 32574e9cae | |||
| 256f8a261c | |||
| 60232d2b9b | |||
| 864ddb77c5 | |||
| 462fe3e925 | |||
| 6bb7478e8d | |||
| 03960b96cb | |||
| 4d00ebae7a | |||
| 352e2f7787 | |||
| 2d2b8d9170 | |||
| 53f2acb263 | |||
| 3ea25c3b77 | |||
| 7931148cbb | |||
| 1031836d89 | |||
| ec1e1fd01a | |||
| b5a04a9fe2 | |||
| be7b73a24b | |||
| 0c438b4d3e | |||
| 3f0373cb7e | |||
| 6a64b9c5b7 | |||
| 04569f819f | |||
| a850fa5de8 | |||
| 8d0d0b1f59 | |||
| 8ea746fa79 | |||
| 5d7bd0208a | |||
| 52ad601de1 | |||
| 2e02b4d678 | |||
| 859578b0d5 | |||
| 761b8a95f9 | |||
| 4ca3d0a0ae | |||
| 75c793f830 | |||
| d546f308d2 | |||
| 74f37f98ad | |||
| aead807ce6 | |||
| f7ad3eaca3 | |||
| da4fc1e256 | |||
| 35364e22fc | |||
| b1ef67ba62 | |||
| 461bf54590 | |||
| 6ba76c0097 | |||
| 323ea697c3 | |||
| 05679468c5 | |||
| 0a64b2ed99 | |||
| a5fa563757 | |||
| c978fa26e2 | |||
| 8813318d61 | |||
| adeaafd59d | |||
| 7e5f0e1fe6 | |||
| e66e3740a7 |
@@ -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';
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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}';
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2020061501;
|
||||
$plugin->requires = 2020060900;
|
||||
$plugin->version = 2020110900;
|
||||
$plugin->requires = 2020110300;
|
||||
$plugin->component = 'tool_dataprivacy';
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2020061500;
|
||||
$plugin->requires = 2020060900;
|
||||
$plugin->version = 2020110900;
|
||||
$plugin->requires = 2020110300;
|
||||
$plugin->component = 'tool_filetypes';
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2020061500;
|
||||
$plugin->requires = 2020060900;
|
||||
$plugin->version = 2020110900;
|
||||
$plugin->requires = 2020110300;
|
||||
$plugin->component = 'tool_generator';
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2020061500;
|
||||
$plugin->requires = 2020060900;
|
||||
$plugin->version = 2020110900;
|
||||
$plugin->requires = 2020110300;
|
||||
$plugin->component = 'tool_messageinbound';
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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).
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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!';
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
@@ -0,0 +1,2 @@
|
||||
shortname,category,enrolment_1,enrolment_1_disable
|
||||
C1,1,guest,1
|
||||
|
@@ -0,0 +1,2 @@
|
||||
shortname,category,enrolment_1,enrolment_1_disable
|
||||
C1,1,guest,0
|
||||
|
@@ -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).
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2020061500;
|
||||
$plugin->requires = 2020060900;
|
||||
$plugin->version = 2020110900;
|
||||
$plugin->requires = 2020110300;
|
||||
$plugin->component = 'availability_date';
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2020061500;
|
||||
$plugin->requires = 2020060900;
|
||||
$plugin->version = 2020110900;
|
||||
$plugin->requires = 2020110300;
|
||||
$plugin->component = 'availability_grade';
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2020061500;
|
||||
$plugin->requires = 2020060900;
|
||||
$plugin->version = 2020110900;
|
||||
$plugin->requires = 2020110300;
|
||||
$plugin->component = 'availability_group';
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2020061500;
|
||||
$plugin->requires = 2020060900;
|
||||
$plugin->version = 2020110900;
|
||||
$plugin->requires = 2020110300;
|
||||
$plugin->component = 'availability_grouping';
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2020061500;
|
||||
$plugin->requires = 2020060900;
|
||||
$plugin->version = 2020110900;
|
||||
$plugin->requires = 2020110300;
|
||||
$plugin->component = 'availability_profile';
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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)
|
||||
);
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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).
|
||||
@@ -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)
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2020061500;
|
||||
$plugin->requires = 2020060900;
|
||||
$plugin->version = 2020110900;
|
||||
$plugin->requires = 2020110300;
|
||||
$plugin->component = 'block_globalsearch';
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
Reference in New Issue
Block a user