--- /dev/null
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Payment gateway admin setting.
+ *
+ * @package core_admin
+ * @copyright 2020 Shamim Rezaie <shamim@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core_admin\local\settings;
+
+/**
+ * Generic class for managing plugins in a table that allows re-ordering and enable/disable of each plugin.
+ */
+class manage_payment_gateway_plugins extends \admin_setting_manage_plugins {
+ /**
+ * Get the admin settings section title (use get_string).
+ *
+ * @return string
+ */
+ public function get_section_title() {
+ return get_string('type_paygw_plural', 'plugin');
+ }
+
+ /**
+ * Get the type of plugin to manage.
+ *
+ * @return string
+ */
+ public function get_plugin_type() {
+ return 'paygw';
+ }
+
+ /**
+ * Get the name of the second column.
+ *
+ * @return string
+ */
+ public function get_info_column_name() {
+ return get_string('supportedcurrencies', 'core_payment');
+ }
+
+ /**
+ * Get the type of plugin to manage.
+ *
+ * @param plugininfo The plugin info class.
+ * @return string
+ */
+ public function get_info_column($plugininfo) {
+ $codes = $plugininfo->get_supported_currencies();
+
+ $currencies = [];
+ foreach ($codes as $c) {
+ $currencies[$c] = new \lang_string($c, 'core_currencies');
+ }
+
+ return implode(get_string('listsep', 'langconfig') . ' ', $currencies);
+ }
+}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+use core_admin\local\settings\filesize;
+
$capabilities = array(
'moodle/backup:backupcourse',
'moodle/category:manage',
$temp->add(new admin_setting_configselect('moodlecourse/visible', new lang_string('visible'), new lang_string('visible_help'),
1, $choices));
+ // Enable/disable download course content.
+ $choices = [
+ DOWNLOAD_COURSE_CONTENT_DISABLED => new lang_string('no'),
+ DOWNLOAD_COURSE_CONTENT_ENABLED => new lang_string('yes'),
+ ];
+ $downloadcontentsitedefault = new admin_setting_configselect('moodlecourse/downloadcontentsitedefault',
+ new lang_string('enabledownloadcoursecontent', 'course'),
+ new lang_string('downloadcoursecontent_help', 'course'), 0, $choices);
+ $downloadcontentsitedefault->add_dependent_on('downloadcoursecontentallowed');
+ $temp->add($downloadcontentsitedefault);
+
// Course format.
$temp->add(new admin_setting_heading('courseformathdr', new lang_string('type_format', 'plugin'), ''));
$ADMIN->add('courses', $temp);
+ // Download course content.
+ $downloadcoursedefaulturl = new moodle_url('/admin/settings.php', ['section' => 'coursesettings']);
+ $temp = new admin_settingpage('downloadcoursecontent', new lang_string('downloadcoursecontent', 'course'));
+ $temp->add(new admin_setting_configcheckbox('downloadcoursecontentallowed',
+ new lang_string('downloadcoursecontentallowed', 'admin'),
+ new lang_string('downloadcoursecontentallowed_desc', 'admin', $downloadcoursedefaulturl->out()), 0));
+
+ // 50MB default maximum size per file when downloading course content.
+ $defaultmaxdownloadsize = 50 * filesize::UNIT_MB;
+ $temp->add(new filesize('maxsizeperdownloadcoursefile', new lang_string('maxsizeperdownloadcoursefile', 'admin'),
+ new lang_string('maxsizeperdownloadcoursefile_desc', 'admin'), $defaultmaxdownloadsize, filesize::UNIT_MB));
+ $temp->hide_if('maxsizeperdownloadcoursefile', 'downloadcoursecontentallowed');
+
+ $ADMIN->add('courses', $temp);
+
// "courserequests" settingpage.
$temp = new admin_settingpage('courserequest', new lang_string('courserequest'));
$temp->add(new admin_setting_configcheckbox('enablecourserequests',
--- /dev/null
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Adds payments links to the admin tree
+ *
+ * @package core
+ * @copyright 2020 Marina Glancy
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$ADMIN->add('payment', new admin_externalpage(
+ 'paymentaccounts',
+ new lang_string('paymentaccounts', 'payment'),
+ new moodle_url("/payment/accounts.php"),
+ ['moodle/payment:manageaccounts', 'moodle/payment:viewpayments']));
$plugin->load_settings($ADMIN, 'mediaplayers', $hassiteconfig);
}
+ // Payment gateway plugins.
+ $ADMIN->add('modules', new admin_category('paymentgateways', new lang_string('type_paygw_plural', 'plugin')));
+ $temp = new admin_settingpage('managepaymentgateways', new lang_string('type_paygwmanage', 'plugin'));
+ $temp->add(new \core_admin\local\settings\manage_payment_gateway_plugins());
+ $temp->add(new admin_setting_description(
+ 'managepaymentgatewayspostfix',
+ '',
+ new lang_string('gotopaymentaccounts', 'payment',
+ html_writer::link(new moodle_url('/payment/accounts.php'), get_string('paymentaccounts', 'payment')))
+ ));
+ $ADMIN->add('paymentgateways', $temp);
+
+ $plugins = core_plugin_manager::instance()->get_plugins_of_type('paygw');
+ core_collator::asort_objects_by_property($plugins, 'displayname');
+ foreach ($plugins as $plugin) {
+ /** @var \core\plugininfo\paygw $plugin */
+ $plugin->load_settings($ADMIN, 'paymentgateways', $hassiteconfig);
+ }
+
// Data format settings.
$ADMIN->add('modules', new admin_category('dataformatsettings', new lang_string('dataformats')));
$temp = new admin_settingpage('managedataformats', new lang_string('managedataformats'));
$ADMIN->add('root', new admin_category('location', new lang_string('location','admin')));
$ADMIN->add('root', new admin_category('language', new lang_string('language')));
$ADMIN->add('root', new admin_category('messaging', new lang_string('messagingcategory', 'admin')));
+$ADMIN->add('root', new admin_category('payment', new lang_string('payments', 'payment')));
$ADMIN->add('root', new admin_category('modules', new lang_string('plugins', 'admin')));
$ADMIN->add('root', new admin_category('security', new lang_string('security','admin')));
$ADMIN->add('root', new admin_category('appearance', new lang_string('appearance','admin')));
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).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2020110900;
+$plugin->requires = 2020110300;
$plugin->component = 'tool_availabilityconditions';
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)
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).
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
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(
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
$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}';
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)
upgrade_plugin_savepoint(true, 2020061501, 'tool', 'dataprivacy');
}
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2020061501;
-$plugin->requires = 2020060900;
+$plugin->version = 2020110900;
+$plugin->requires = 2020110300;
$plugin->component = 'tool_dataprivacy';
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).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2020110900;
+$plugin->requires = 2020110300;
$plugin->component = 'tool_filetypes';
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2020110900;
+$plugin->requires = 2020110300;
$plugin->component = 'tool_generator';
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
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).
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)
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'tool_installaddon';
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2020110900;
+$plugin->requires = 2020110300;
$plugin->maturity = MATURITY_STABLE;
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)
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;
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
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).
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).
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
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).
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).
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).
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);
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
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2020110900;
+$plugin->requires = 2020110300;
$plugin->component = 'tool_messageinbound';
$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.
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
$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';
*/
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
);
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
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).
upgrade_plugin_savepoint(true, 2020090700, 'tool', 'moodlenet');
}
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'tool_moodlenet';
-$plugin->version = 2020090700;
-$plugin->requires = 2020060900;
+$plugin->version = 2020110900;
+$plugin->requires = 2020110300;
$plugin->maturity = MATURITY_ALPHA;
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)
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).
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)
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
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).
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)
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).
* @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!';
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
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)
* @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';
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"
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)
* @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).
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)
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];
-
- // 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)));
- }
+ if ($instance) {
+ $plugin = $enrolmentplugins[$instance->enrol];
- 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)));
--- /dev/null
+@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"
--- /dev/null
+shortname,category,enrolment_1,enrolment_1_delete
+C1,1,guest,1
\ No newline at end of file
--- /dev/null
+shortname,category,enrolment_1,enrolment_1_disable
+C1,1,guest,1
\ No newline at end of file
--- /dev/null
+shortname,category,enrolment_1,enrolment_1_disable
+C1,1,guest,0
\ No newline at end of file
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).
$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;
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)) {
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)
upgrade_plugin_savepoint(true, 2020082700, 'tool', 'usertours');
}
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
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).
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;
}
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)
upgrade_plugin_savepoint(true, 2020081700, 'auth', 'cas');
}
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
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);
continue;
}
try {
- $id = user_create_user($user, false); // It is truly a new user.
+ $id = user_create_user($user, false, false); // It is truly a new user.
$trace->output(get_string('auth_dbinsertuser', 'auth_db', array('name'=>$user->username, 'id'=>$id)), 1);
} catch (moodle_exception $e) {
$trace->output(get_string('auth_dbinsertusererror', 'auth_db', $user->username), 1);
// Make sure user context is present.
context_user::instance($id);
+
+ \core\event\user_created::create_from_userid($id)->trigger();
}
unset($add_users);
}
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
$table->add_field('email', XMLDB_TYPE_CHAR, '255', null, null, null);
$table->add_field('firstname', XMLDB_TYPE_CHAR, '255', null, null, null);
$table->add_field('lastname', XMLDB_TYPE_CHAR, '255', null, null, null);
+ $table->add_field('animal', XMLDB_TYPE_CHAR, '255', null, null, null);
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
if ($dbman->table_exists($table)) {
$dbman->drop_table($table);
set_config('field_updateremote_email', '0', 'auth_db');
set_config('field_lock_email', 'unlocked', 'auth_db');
+ // Create a user profile field and add mapping to it.
+ $DB->insert_record('user_info_field', ['shortname' => 'pet', 'name' => 'Pet', 'required' => 0,
+ 'visible' => 1, 'locked' => 0, 'categoryid' => 1, 'datatype' => 'text']);
+
+ set_config('field_map_profile_field_pet', 'animal', 'auth_db');
+ set_config('field_updatelocal_profile_field_pet', 'oncreate', 'auth_db');
+ set_config('field_updateremote_profile_field_pet', '0', 'auth_db');
+ set_config('field_lock_profile_field_pet', 'unlocked', 'auth_db');
+
// Init the rest of settings.
set_config('passtype', 'plaintext', 'auth_db');
set_config('changepasswordurl', '', 'auth_db');
public function test_plugin() {
global $DB, $CFG;
+ require_once($CFG->dirroot . '/user/profile/lib.php');
$this->resetAfterTest(true);
// Test bulk user account creation.
- $user2 = (object)array('name'=>'u2', 'pass'=>'heslo', 'email'=>'u2@example.com');
+ $user2 = (object)['name' => 'u2', 'pass' => 'heslo', 'email' => 'u2@example.com', 'animal' => 'cat'];
$user2->id = $DB->insert_record('auth_db_users', $user2);
$user3 = (object)array('name'=>'admin', 'pass'=>'heslo', 'email'=>'admin@example.com'); // Should be skipped.
$this->assertCount(2, $DB->get_records('user'));
$trace = new null_progress_trace();
+
+ // Sync users and make sure that two events user_created werer triggered.
+ $sink = $this->redirectEvents();
$auth->sync_users($trace, false);
+ $events = $sink->get_events();
+ $sink->close();
+ $this->assertCount(2, $events);
+ $this->assertTrue($events[0] instanceof \core\event\user_created);
+ $this->assertTrue($events[1] instanceof \core\event\user_created);
+ // Assert the two users were created.
$this->assertEquals(4, $DB->count_records('user'));
$u1 = $DB->get_record('user', array('username'=>$user1->name, 'auth'=>'db'));
$this->assertSame($user1->email, $u1->email);
+ $this->assertEmpty(profile_user_record($u1->id)->pet);
$u2 = $DB->get_record('user', array('username'=>$user2->name, 'auth'=>'db'));
$this->assertSame($user2->email, $u2->email);
+ $this->assertSame($user2->animal, profile_user_record($u2->id)->pet);
$admin = $DB->get_record('user', array('username'=>'admin', 'auth'=>'manual'));
$this->assertNotEmpty($admin);
$user2b = clone($user2);
$user2b->email = 'u2b@example.com';
+ $user2b->animal = 'dog';
$DB->update_record('auth_db_users', $user2b);
$auth->sync_users($trace, false);
$this->assertEquals(4, $DB->count_records('user'));
$u2 = $DB->get_record('user', array('username'=>$user2->name));
$this->assertSame($user2->email, $u2->email);
+ $this->assertSame($user2->animal, profile_user_record($u2->id)->pet);
$auth->sync_users($trace, true);
$this->assertEquals(4, $DB->count_records('user'));
set_config('field_updatelocal_email', 'onlogin', 'auth_db');
$auth->config->field_updatelocal_email = 'onlogin';
+ set_config('field_updatelocal_profile_field_pet', 'onlogin', 'auth_db');
+ $auth->config->field_updatelocal_profile_field_pet = 'onlogin';
$auth->sync_users($trace, false);
$this->assertEquals(4, $DB->count_records('user'));
$this->assertEquals(4, $DB->count_records('user'));
$u2 = $DB->get_record('user', array('username'=>$user2->name));
$this->assertSame($user2b->email, $u2->email);
+ $this->assertSame($user2b->animal, profile_user_record($u2->id)->pet);
// Test sync deletes and suspends.
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)
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
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)
upgrade_plugin_savepoint(true, 2020081700, 'auth', 'ldap');
}
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
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)
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).
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
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)
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
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)
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)
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
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)
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
+ // Automatically generated Moodle v3.10.0 release upgrade line.
+ // Put any upgrade step following this.
+
return true;
}
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 = 2020