MDL-78496 upgrade: remove all the < 4.1.0 upgrade steps
Also includes an upgrade step to prevent upgrading from any version < 2021112802 (v4.1.0) as anti-cheating measure.
This commit is contained in:
@@ -33,20 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_tool_cohortroles_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
if ($oldversion < 2020020600) {
|
||||
// Delete any tool_cohortroles mappings for roles which no longer exist.
|
||||
$DB->delete_records_select('tool_cohortroles', 'roleid NOT IN (SELECT id FROM {role})');
|
||||
|
||||
// Cohortroles savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2020020600, 'tool', 'cohortroles');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,14 +27,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_tool_customlang_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -35,55 +35,6 @@ function xmldb_tool_dataprivacy_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2020061501) {
|
||||
|
||||
// Define field commentsformat to be added to tool_dataprivacy_request.
|
||||
$table = new xmldb_table('tool_dataprivacy_request');
|
||||
$field = new xmldb_field('commentsformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'comments');
|
||||
|
||||
// Conditionally launch add field commentsformat.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field dpocommentformat to be added to tool_dataprivacy_request.
|
||||
$field = new xmldb_field('dpocommentformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'dpocomment');
|
||||
|
||||
// Conditionally launch add field dpocommentformat.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field systemapproved to be added to tool_dataprivacy_request.
|
||||
$field = new xmldb_field('systemapproved', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0', 'dpocommentformat');
|
||||
|
||||
// Conditionally launch add field systemapproved.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Dataprivacy savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2020061501, 'tool', 'dataprivacy');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
if ($oldversion < 2022053000) {
|
||||
|
||||
// Define key usermodified (foreign) to be added to tool_dataprivacy_purposerole.
|
||||
$table = new xmldb_table('tool_dataprivacy_purposerole');
|
||||
$key = new xmldb_key('usermodified', XMLDB_KEY_FOREIGN, ['usermodified'], 'user', ['id']);
|
||||
|
||||
// Launch add key usermodified.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Dataprivacy savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2022053000, 'tool', 'dataprivacy');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,14 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_tool_log_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -25,14 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_logstore_database_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -25,41 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_logstore_standard_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
require_once($CFG->libdir.'/db/upgradelib.php'); // Core Upgrade-related functions.
|
||||
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
if ($oldversion < 2022053000) {
|
||||
// Define index relateduserid (not unique) to be added to logstore_standard_log.
|
||||
$table = new xmldb_table('logstore_standard_log');
|
||||
|
||||
// Launch add key userid.
|
||||
$key = new xmldb_key('userid', XMLDB_KEY_FOREIGN, ['userid'], 'user', ['id']);
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Launch add key courseid.
|
||||
$key = new xmldb_key('courseid', XMLDB_KEY_FOREIGN, ['courseid'], 'course', ['id']);
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Launch add key realuserid.
|
||||
$key = new xmldb_key('realuserid', XMLDB_KEY_FOREIGN, ['realuserid'], 'user', ['id']);
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Launch add key relateduserid.
|
||||
$key = new xmldb_key('relateduserid', XMLDB_KEY_FOREIGN, ['relateduserid'], 'user', ['id']);
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Standard savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2022053000, 'logstore', 'standard');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,14 +33,6 @@ require_once($CFG->dirroot . '/lib/upgradelib.php');
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_tool_mobile_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,44 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_tool_monitor_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
require_once($CFG->libdir.'/db/upgradelib.php'); // Core Upgrade-related functions.
|
||||
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
if ($oldversion < 2022053000) {
|
||||
|
||||
// Define key courseid (foreign) to be added to tool_monitor_events.
|
||||
$table = new xmldb_table('tool_monitor_events');
|
||||
$key = new xmldb_key('courseid', XMLDB_KEY_FOREIGN, ['courseid'], 'course', ['id']);
|
||||
|
||||
// Launch add key courseid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Define key contextid (foreign) to be added to tool_monitor_events.
|
||||
$table = new xmldb_table('tool_monitor_events');
|
||||
$key = new xmldb_key('contextid', XMLDB_KEY_FOREIGN, ['contextid'], 'context', ['id']);
|
||||
|
||||
// Launch add key contextid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Define key contextinstanceid (foreign) to be added to tool_monitor_events.
|
||||
$table = new xmldb_table('tool_monitor_events');
|
||||
$key = new xmldb_key('contextinstanceid', XMLDB_KEY_FOREIGN, ['contextinstanceid'], 'context', ['instanceid']);
|
||||
|
||||
// Launch add key contextinstanceid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Monitor savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2022053000, 'tool', 'monitor');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,124 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_tool_moodlenet_upgrade(int $oldversion) {
|
||||
global $CFG, $DB;
|
||||
if ($oldversion < 2020060500) {
|
||||
|
||||
// Grab some of the old settings.
|
||||
$categoryname = get_config('tool_moodlenet', 'profile_category');
|
||||
$profilefield = get_config('tool_moodlenet', 'profile_field_name');
|
||||
|
||||
// Master version only!
|
||||
|
||||
// Find out if we have a custom profile field for moodle.net.
|
||||
$sql = "SELECT f.*
|
||||
FROM {user_info_field} f
|
||||
JOIN {user_info_category} c ON c.id = f.categoryid and c.name = :categoryname
|
||||
WHERE f.shortname = :name";
|
||||
|
||||
$params = [
|
||||
'categoryname' => $categoryname,
|
||||
'name' => $profilefield
|
||||
];
|
||||
|
||||
$record = $DB->get_record_sql($sql, $params);
|
||||
|
||||
if (!empty($record)) {
|
||||
$userentries = $DB->get_recordset('user_info_data', ['fieldid' => $record->id]);
|
||||
$recordstodelete = [];
|
||||
foreach ($userentries as $userentry) {
|
||||
$data = (object) [
|
||||
'id' => $userentry->userid,
|
||||
'moodlenetprofile' => $userentry->data
|
||||
];
|
||||
$DB->update_record('user', $data, true);
|
||||
$recordstodelete[] = $userentry->id;
|
||||
}
|
||||
$userentries->close();
|
||||
|
||||
// Remove the user profile data, fields, and category.
|
||||
$DB->delete_records_list('user_info_data', 'id', $recordstodelete);
|
||||
$DB->delete_records('user_info_field', ['id' => $record->id]);
|
||||
$DB->delete_records('user_info_category', ['name' => $categoryname]);
|
||||
unset_config('profile_field_name', 'tool_moodlenet');
|
||||
unset_config('profile_category', 'tool_moodlenet');
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2020060500, 'tool', 'moodlenet');
|
||||
}
|
||||
|
||||
if ($oldversion < 2020061501) {
|
||||
// Change the domain.
|
||||
$defaultmoodlenet = get_config('tool_moodlenet', 'defaultmoodlenet');
|
||||
|
||||
if ($defaultmoodlenet === 'https://home.moodle.net') {
|
||||
set_config('defaultmoodlenet', 'https://moodle.net', 'tool_moodlenet');
|
||||
}
|
||||
|
||||
// Change the name.
|
||||
$defaultmoodlenetname = get_config('tool_moodlenet', 'defaultmoodlenetname');
|
||||
|
||||
if ($defaultmoodlenetname === 'Moodle HQ MoodleNet') {
|
||||
set_config('defaultmoodlenetname', 'MoodleNet Central', 'tool_moodlenet');
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2020061501, 'tool', 'moodlenet');
|
||||
}
|
||||
|
||||
if ($oldversion < 2020061502) {
|
||||
// Disable the MoodleNet integration by default till further notice.
|
||||
set_config('enablemoodlenet', 0, 'tool_moodlenet');
|
||||
|
||||
upgrade_plugin_savepoint(true, 2020061502, 'tool', 'moodlenet');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2022021600) {
|
||||
// This is a special case for if MoodleNet integration has never been enabled,
|
||||
// or if defaultmoodlenet is not set for whatever reason.
|
||||
if (!get_config('tool_moodlenet', 'defaultmoodlenet')) {
|
||||
set_config('defaultmoodlenet', 'https://moodle.net', 'tool_moodlenet');
|
||||
set_config('defaultmoodlenetname', get_string('defaultmoodlenetnamevalue', 'tool_moodlenet'), 'tool_moodlenet');
|
||||
}
|
||||
|
||||
// Enable MoodleNet and set it to display on activity chooser footer.
|
||||
// But only do this if we know for sure that the default MoodleNet is a working one.
|
||||
if (get_config('tool_moodlenet', 'defaultmoodlenet') == 'https://moodle.net') {
|
||||
set_config('enablemoodlenet', '1', 'tool_moodlenet');
|
||||
set_config('activitychooseractivefooter', 'tool_moodlenet');
|
||||
|
||||
// Use an adhoc task to send a notification to admin stating MoodleNet is automatically enabled after upgrade.
|
||||
$notificationtask = new tool_moodlenet\task\send_enable_notification();
|
||||
core\task\manager::queue_adhoc_task($notificationtask);
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2022021600, 'tool', 'moodlenet');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022021601) {
|
||||
|
||||
$selectsql = "moodlenetprofile IS NOT NULL AND moodlenetprofile != ''";
|
||||
|
||||
// If there are any users with MoodleNet profile set.
|
||||
if ($DB->count_records_select('user', $selectsql)) {
|
||||
// Remove the value set for the MoodleNet profile as this format can no longer be used to authenticate
|
||||
// MoodleNet users.
|
||||
$DB->set_field_select('user', 'moodlenetprofile', '', $selectsql);
|
||||
|
||||
// Use an adhoc task to send a notification to admin stating that the user data related to the linked
|
||||
// MoodleNet profiles has been removed.
|
||||
$notificationtask = new tool_moodlenet\task\send_mnet_profiles_data_removed_notification();
|
||||
core\task\manager::queue_adhoc_task($notificationtask);
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2022021601, 'tool', 'moodlenet');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,14 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_tool_policy_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -34,104 +34,6 @@ use tool_usertours\tour;
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_tool_usertours_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021052501) {
|
||||
// Clean up user preferences of deleted tours.
|
||||
$select = $DB->sql_like('name', ':lastcompleted') . ' OR ' . $DB->sql_like('name', ':requested');
|
||||
$params = [
|
||||
'lastcompleted' => tour::TOUR_LAST_COMPLETED_BY_USER . '%',
|
||||
'requested' => tour::TOUR_REQUESTED_BY_USER . '%',
|
||||
];
|
||||
|
||||
$preferences = $DB->get_records_select('user_preferences', $select, $params, '', 'DISTINCT name');
|
||||
foreach ($preferences as $preference) {
|
||||
// Match tour ID at the end of the preference name, remove all of that preference type if tour ID doesn't exist.
|
||||
if (preg_match('/(?<tourid>\d+)$/', $preference->name, $matches) &&
|
||||
!$DB->record_exists('tool_usertours_tours', ['id' => $matches['tourid']])) {
|
||||
|
||||
$DB->delete_records('user_preferences', ['name' => $preference->name]);
|
||||
}
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2021052501, 'tool', 'usertours');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021092300) {
|
||||
// Define field endtourlabel to be added to tool_usertours_tours.
|
||||
$table = new xmldb_table('tool_usertours_tours');
|
||||
$field = new xmldb_field('endtourlabel', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'sortorder');
|
||||
|
||||
// Conditionally launch add field endtourlabel.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Usertours savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021092300, 'tool', 'usertours');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021100700) {
|
||||
|
||||
// Define field displaystepnumbers to be added to tool_usertours_tours.
|
||||
$table = new xmldb_table('tool_usertours_tours');
|
||||
$field = new xmldb_field('displaystepnumbers', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'configdata');
|
||||
|
||||
// Conditionally launch add field displaystepnumbers.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Usertours savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021100700, 'tool', 'usertours');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022040601) {
|
||||
// Define field contentformat to be added to tool_usertours_steps.
|
||||
$table = new xmldb_table('tool_usertours_steps');
|
||||
$field = new xmldb_field('contentformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, FORMAT_MOODLE, 'content');
|
||||
|
||||
// Conditionally launch add field contentformat.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
} else {
|
||||
// Field was added by previous upgrade step with the default value is FORMAT_HTML.
|
||||
// Need to drop the field and re-create with the new structure to make sure all the existing tours use FORMAT_MOODLE.
|
||||
// FORMAT_MOODLE will force the \core_external\util::format_text method to use nl2br to
|
||||
// convert the new line to line break tag.
|
||||
$dbman->drop_field($table, $field);
|
||||
// Add the field again.
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Usertours savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2022040601, 'tool', 'usertours');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022040602) {
|
||||
// Update shipped tours.
|
||||
// Normally, we just bump the version numbers because we need to call update_shipped_tours only once.
|
||||
manager::update_shipped_tours();
|
||||
|
||||
upgrade_plugin_savepoint(true, 2022040602, 'tool', 'usertours');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022061600) {
|
||||
// Update shipped tours.
|
||||
// Normally, we just bump the version numbers because we need to call update_shipped_tours only once.
|
||||
manager::update_shipped_tours();
|
||||
|
||||
upgrade_plugin_savepoint(true, 2022061600, 'tool', 'usertours');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,22 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_cas_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021052501) {
|
||||
// Normalize the memberattribute_isdn plugin config.
|
||||
set_config('memberattribute_isdn',
|
||||
!empty(get_config('auth_cas', 'memberattribute_isdn')), 'auth_cas');
|
||||
|
||||
upgrade_plugin_savepoint(true, 2021052501, 'auth', 'cas');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_db_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_email_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,22 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_ldap_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021052501) {
|
||||
// Normalize the memberattribute_isdn plugin config.
|
||||
set_config('memberattribute_isdn',
|
||||
!empty(get_config('auth_ldap', 'memberattribute_isdn')), 'auth_ldap');
|
||||
|
||||
upgrade_plugin_savepoint(true, 2021052501, 'auth', 'ldap');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,63 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result.
|
||||
*/
|
||||
function xmldb_auth_lti_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2021100500) {
|
||||
// Define table auth_lti_linked_login to be created.
|
||||
$table = new xmldb_table('auth_lti_linked_login');
|
||||
|
||||
// Adding fields to table auth_lti_linked_login.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('issuer', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('issuer256', XMLDB_TYPE_CHAR, '64', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('sub', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('sub256', XMLDB_TYPE_CHAR, '64', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table auth_lti_linked_login.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('userid_key', XMLDB_KEY_FOREIGN, ['userid'], 'user', ['id']);
|
||||
$table->add_key('unique_key', XMLDB_KEY_UNIQUE, ['userid', 'issuer256', 'sub256']);
|
||||
|
||||
// Conditionally launch create table for auth_lti_linked_login.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Auth LTI savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021100500, 'auth', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022030900) {
|
||||
// Fix the unique key made up of {userid, issuer256, sub256}.
|
||||
// This was improperly defined as ['userid, issuer256, sub256'] in the upgrade step above (note the quotes),
|
||||
// resulting in the potential for missing keys on some databases.
|
||||
// Drop and re-add the key to make sure we have it in place.
|
||||
|
||||
// Define table auth_lti_linked_login to be modified.
|
||||
$table = new xmldb_table('auth_lti_linked_login');
|
||||
|
||||
// Define the key to be dropped and re-added.
|
||||
$key = new xmldb_key('unique_key', XMLDB_KEY_UNIQUE, ['userid', 'issuer256', 'sub256'], 'auth_lti_linked_login');
|
||||
|
||||
// Drop the key.
|
||||
$dbman->drop_key($table, $key);
|
||||
|
||||
// Create the key.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Auth LTI savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2022030900, 'auth', 'lti');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_manual_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_mnet_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_none_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,14 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_oauth2_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,36 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_shibboleth_upgrade($oldversion) {
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021052501) {
|
||||
// The 'Data modification API' setting in the Shibboleth authentication plugin can no longer be configured
|
||||
// to use files located within the site data directory, as it exposes the site to security risks. Therefore,
|
||||
// we need to find every existing case and reset the 'Data modification API' setting to its default value.
|
||||
|
||||
$convertdataconfig = get_config('auth_shibboleth', 'convert_data');
|
||||
|
||||
if (preg_match('/' . preg_quote($CFG->dataroot, '/') . '/', realpath($convertdataconfig))) {
|
||||
set_config('convert_data', '', 'auth_shibboleth');
|
||||
|
||||
$warn = 'Your \'Data modification API\' setting in the Shibboleth authentication plugin is currently
|
||||
configured to use a file located within the current site data directory ($CFG->dataroot). You are no
|
||||
longer able to use files from within this directory for this purpose as it exposes your site to security
|
||||
risks. This setting has been reset to its default value. Please reconfigure it by providing a path
|
||||
to a file which is not located within the site data directory.';
|
||||
|
||||
echo $OUTPUT->notification($warn, 'notifyproblem');
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2021052501, 'auth', 'shibboleth');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,14 +43,6 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_badges_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -47,25 +47,6 @@ require_once("{$CFG->libdir}/db/upgradelib.php");
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_calendar_month_upgrade($oldversion, $block) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2022030200) {
|
||||
// Update all calendar_month blocks in the my-index to be in the main content region.
|
||||
upgrade_block_set_defaultregion('calendar_month', '__default', 'my-index', 'content');
|
||||
upgrade_block_savepoint(true, 2022030200, 'calendar_month', false);
|
||||
}
|
||||
|
||||
if ($oldversion < 2022041901) {
|
||||
upgrade_block_set_my_user_parent_context('calendar_month', '__default', 'my-index');
|
||||
upgrade_block_savepoint(true, 2022041901, 'calendar_month', false);
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,14 +43,6 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_calendar_upcoming_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -46,25 +46,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_course_summary_upgrade($oldversion, $block) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021121600) {
|
||||
// From Moodle 4.0, this block has been disabled by default in new installations.
|
||||
// If the site has no instances of this block, it will disabled during the upgrading process too.
|
||||
$totalcount = $DB->count_records('block_instances', ['blockname' => 'course_summary']);
|
||||
if ($totalcount == 0) {
|
||||
$DB->set_field('block', 'visible', 0, ['name' => 'course_summary']);
|
||||
}
|
||||
|
||||
upgrade_block_savepoint(true, 2021121600, 'course_summary', false);
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -45,22 +45,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_feedback_upgrade($oldversion, $block) {
|
||||
global $CFG, $DB;
|
||||
|
||||
if ($oldversion < 2021121600) {
|
||||
// From Moodle 4.0, this block has been disabled by default in new installations.
|
||||
// If the site has no instances of this block, it will disabled during the upgrading process too.
|
||||
$totalcount = $DB->count_records('block_instances', ['blockname' => 'feedback']);
|
||||
if ($totalcount == 0) {
|
||||
$DB->set_field('block', 'visible', 0, ['name' => 'feedback']);
|
||||
}
|
||||
|
||||
upgrade_block_savepoint(true, 2021121600, 'feedback', false);
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,14 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param int $oldversion
|
||||
*/
|
||||
function xmldb_block_html_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -34,50 +34,6 @@ require_once("{$CFG->libdir}/db/upgradelib.php");
|
||||
* @param int $oldversion
|
||||
*/
|
||||
function xmldb_block_myoverview_upgrade($oldversion) {
|
||||
global $DB, $CFG, $OUTPUT;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021052504) {
|
||||
upgrade_block_delete_instances('myoverview', '__default', 'my-index');
|
||||
|
||||
// Add new instance to the /my/courses.php page.
|
||||
$subpagepattern = $DB->get_record('my_pages', [
|
||||
'userid' => null,
|
||||
'name' => MY_PAGE_COURSES,
|
||||
'private' => MY_PAGE_PUBLIC,
|
||||
], 'id', IGNORE_MULTIPLE)->id;
|
||||
|
||||
$blockname = 'myoverview';
|
||||
$pagetypepattern = 'my-index';
|
||||
|
||||
$blockparams = [
|
||||
'blockname' => $blockname,
|
||||
'pagetypepattern' => $pagetypepattern,
|
||||
'subpagepattern' => $subpagepattern,
|
||||
];
|
||||
|
||||
// See if this block already somehow exists, it should not but who knows.
|
||||
if (!$DB->record_exists('block_instances', $blockparams)) {
|
||||
$page = new moodle_page();
|
||||
$page->set_context(context_system::instance());
|
||||
// Add the block to the default /my/courses.
|
||||
$page->blocks->add_region('content');
|
||||
$page->blocks->add_block($blockname, 'content', 0, false, $pagetypepattern, $subpagepattern);
|
||||
}
|
||||
|
||||
upgrade_block_savepoint(true, 2021052504, 'myoverview', false);
|
||||
}
|
||||
|
||||
if ($oldversion < 2022041901) {
|
||||
upgrade_block_set_my_user_parent_context('myoverview', '__default', 'my-index');
|
||||
upgrade_block_savepoint(true, 2022041901, 'myoverview', false);
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -53,14 +53,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_navigation_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -45,14 +45,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_recent_activity_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -47,25 +47,6 @@ require_once("{$CFG->libdir}/db/upgradelib.php");
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_block_recentlyaccesseditems_upgrade($oldversion, $block) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2022030200) {
|
||||
// Update all recentlyaccesseditems blocks in the my-index to be in the main side-post region.
|
||||
upgrade_block_set_defaultregion('recentlyaccesseditems', '__default', 'my-index', 'side-post');
|
||||
upgrade_block_savepoint(true, 2022030200, 'recentlyaccesseditems', false);
|
||||
}
|
||||
|
||||
if ($oldversion < 2022041901) {
|
||||
upgrade_block_set_my_user_parent_context('recentlyaccesseditems', '__default', 'my-index');
|
||||
upgrade_block_savepoint(true, 2022041901, 'recentlyaccesseditems', false);
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,25 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return boolean
|
||||
*/
|
||||
function xmldb_block_rss_client_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021121600) {
|
||||
// From Moodle 4.0, this block has been disabled by default in new installations.
|
||||
// If the site has no instances of this block, it will disabled during the upgrading process too.
|
||||
$totalcount = $DB->count_records('block_instances', ['blockname' => 'rss_client']);
|
||||
if ($totalcount == 0) {
|
||||
$DB->set_field('block', 'visible', 0, ['name' => 'rss_client']);
|
||||
}
|
||||
|
||||
upgrade_block_savepoint(true, 2021121600, 'rss_client', false);
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -47,14 +47,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_section_links_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -46,25 +46,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_selfcompletion_upgrade($oldversion, $block) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021121600) {
|
||||
// From Moodle 4.0, this block has been disabled by default in new installations.
|
||||
// If the site has no instances of this block, it will disabled during the upgrading process too.
|
||||
$totalcount = $DB->count_records('block_instances', ['blockname' => 'selfcompletion']);
|
||||
if ($totalcount == 0) {
|
||||
$DB->set_field('block', 'visible', 0, ['name' => 'selfcompletion']);
|
||||
}
|
||||
|
||||
upgrade_block_savepoint(true, 2021121600, 'selfcompletion', false);
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -53,14 +53,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_settings_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,111 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param int $oldversion
|
||||
*/
|
||||
function xmldb_block_tag_youtube_upgrade($oldversion) {
|
||||
global $DB, $CFG, $OUTPUT;
|
||||
|
||||
// Automatically generated Moodle v3.10.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021052501) {
|
||||
// We need to fix every tag_youtube block instance that has used a legacy category name as a category config.
|
||||
// The category config needs to store the category ID instead.
|
||||
|
||||
// If tag_youtube block instances exist.
|
||||
if ($blockinstances = $DB->get_records('block_instances', ['blockname' => 'tag_youtube'])) {
|
||||
$categories = [];
|
||||
// The block tag youtube needs to be configured and have a valid API key in order to obtain the video
|
||||
// category list.
|
||||
if ($apikey = get_config('block_tag_youtube', 'apikey')) {
|
||||
require_once($CFG->libdir . '/google/lib.php');
|
||||
$client = get_google_client();
|
||||
$client->setDeveloperKey($apikey);
|
||||
$client->setScopes(array(Google_Service_YouTube::YOUTUBE_READONLY));
|
||||
$service = new Google_Service_YouTube($client);
|
||||
|
||||
try {
|
||||
// Get the video category list.
|
||||
$response = $service->videoCategories->listVideoCategories('snippet', ['regionCode' => 'us']);
|
||||
|
||||
// Return an array of categories, where the key is the category name and the value is the
|
||||
// category ID.
|
||||
$categories = array_reduce($response['modelData']['items'], function ($categories, $category) {
|
||||
$categoryid = $category['id'];
|
||||
$categoryname = $category['snippet']['title'];
|
||||
// If videos can be associated with this category, add it to the categories list.
|
||||
if ($category['snippet']['assignable']) {
|
||||
$categories[$categoryname] = $categoryid;
|
||||
}
|
||||
return $categories;
|
||||
}, []);
|
||||
} catch (Exception $e) {
|
||||
$warn = "Due to the following error the youtube video categories were not obtained through the API:
|
||||
'{$e->getMessage()}'. Therefore, any legacy values used as a category setting in Tag Youtube
|
||||
block instances cannot be properly mapped and updated. All legacy values used as category setting
|
||||
will still be updated and set by default to 'Any category'.";
|
||||
echo $OUTPUT->notification($warn, 'notifyproblem');
|
||||
}
|
||||
} else {
|
||||
$warn = "The API key is missing in the Tag Youtube block configuration. Therefore, the youtube video
|
||||
categories cannot be obtained and mapped with the legacy values used as category setting. All legacy
|
||||
values used as category setting will still be updated and set by default to 'Any category'.";
|
||||
echo $OUTPUT->notification($warn, 'notifyproblem');
|
||||
}
|
||||
|
||||
// Array that maps the old category names to the current category names.
|
||||
$categorynamemap = [
|
||||
'Film' => 'Film & Animation',
|
||||
'Autos' => 'Autos & Vehicles',
|
||||
'Comedy' => 'Comedy',
|
||||
'Entertainment' => 'Entertainment',
|
||||
'Music' => 'Music',
|
||||
'News' => 'News & Politics',
|
||||
'People' => 'People & Blogs',
|
||||
'Animals' => 'Pets & Animals',
|
||||
'Howto' => 'Howto & Style',
|
||||
'Sports' => 'Sports',
|
||||
'Travel' => 'Travel & Events',
|
||||
'Games' => 'Gaming',
|
||||
'Education' => 'Education',
|
||||
'Tech' => 'Tech'
|
||||
];
|
||||
|
||||
// If the block uses a legacy category name, update it to use the current category ID instead.
|
||||
foreach ($blockinstances as $blockinstance) {
|
||||
$blockconfig = unserialize(base64_decode($blockinstance->configdata));
|
||||
|
||||
// Skip if the block does not have a specific category set.
|
||||
if (!isset($blockconfig->category)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$blockcategoryconfig = $blockconfig->category;
|
||||
// The block is using a legacy category name as a category config.
|
||||
if (array_key_exists($blockcategoryconfig, $categorynamemap)) {
|
||||
if (!empty($categories)) { // The categories were successfully obtained through the API call.
|
||||
// Get the current category name.
|
||||
$currentcategoryname = $categorynamemap[$blockcategoryconfig];
|
||||
// Add the category ID as a new category config for this block instance.
|
||||
$blockconfig->category = $categories[$currentcategoryname];
|
||||
} else { // The categories were not obtained through the API call.
|
||||
// If the categories were not obtained through the API call, we are not able to map the
|
||||
// current legacy category name with the category ID. Therefore, we should default the category
|
||||
// config value to 0 ('Any category') to at least enable the block to function properly. The
|
||||
// user can later manually select the desired category and re-save the config through the UI.
|
||||
$blockconfig->category = 0;
|
||||
}
|
||||
|
||||
$blockinstance->configdata = base64_encode(serialize($blockconfig));
|
||||
$DB->update_record('block_instances', $blockinstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
upgrade_block_savepoint(true, 2021052501, 'tag_youtube', false);
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -46,25 +46,6 @@ require_once("{$CFG->libdir}/db/upgradelib.php");
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_timeline_upgrade($oldversion, $block) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2022030200) {
|
||||
// Update all timeline blocks in the my-index to be in the main content region.
|
||||
upgrade_block_set_defaultregion('timeline', '__default', 'my-index', 'content');
|
||||
upgrade_block_savepoint(true, 2022030200, 'timeline', false);
|
||||
}
|
||||
|
||||
if ($oldversion < 2022041901) {
|
||||
upgrade_block_set_my_user_parent_context('timeline', '__default', 'my-index');
|
||||
upgrade_block_savepoint(true, 2022041901, 'timeline', false);
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,14 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_format_topics_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,12 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_format_weeks_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -25,14 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_enrol_database_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -25,14 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_enrol_flatfile_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -25,14 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_enrol_guest_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,14 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool true
|
||||
*/
|
||||
function xmldb_enrol_imsenterprise_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -37,473 +37,6 @@
|
||||
* @return boolean
|
||||
*/
|
||||
function xmldb_enrol_lti_upgrade($oldversion) {
|
||||
global $CFG, $OUTPUT, $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021052501) {
|
||||
// LTI 1.3: Set a private key for this site (which is acting as a tool in LTI 1.3).
|
||||
require_once($CFG->dirroot . '/enrol/lti/upgradelib.php');
|
||||
|
||||
$warning = enrol_lti_verify_private_key();
|
||||
if (!empty($warning)) {
|
||||
echo $OUTPUT->notification($warning, 'notifyproblem');
|
||||
}
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021052501, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021052502) {
|
||||
// Define table enrol_lti_app_registration to be created.
|
||||
$table = new xmldb_table('enrol_lti_app_registration');
|
||||
|
||||
// Adding fields to table enrol_lti_app_registration.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('platformid', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('clientid', XMLDB_TYPE_CHAR, '1333', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('platformclienthash', XMLDB_TYPE_CHAR, '64', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('authenticationrequesturl', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('jwksurl', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('accesstokenurl', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table enrol_lti_app_registration.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
|
||||
// Add unique index on platformclienthash.
|
||||
$table->add_index('platformclienthash', XMLDB_INDEX_UNIQUE, ['platformclienthash']);
|
||||
|
||||
// Conditionally launch create table for enrol_lti_app_registration.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021052502, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021052503) {
|
||||
// Add a new column 'ltiversion' to the enrol_lti_tools table.
|
||||
$table = new xmldb_table('enrol_lti_tools');
|
||||
|
||||
// Define field ltiversion to be added to enrol_lti_tools.
|
||||
$field = new xmldb_field('ltiversion', XMLDB_TYPE_CHAR, 15, null, XMLDB_NOTNULL, null, "LTI-1p3", 'contextid');
|
||||
|
||||
// Conditionally launch add field ltiversion, setting it to the legacy value for all published content.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
$DB->set_field('enrol_lti_tools', 'ltiversion', 'LTI-1p0/LTI-2p0');
|
||||
}
|
||||
|
||||
// Define field uuid to be added to enrol_lti_tools.
|
||||
$field = new xmldb_field('uuid', XMLDB_TYPE_CHAR, 36, null, null, null, null, 'ltiversion');
|
||||
|
||||
// Conditionally launch add field uuid, setting it to null for existing rows.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
$key = new xmldb_key('uuid', XMLDB_KEY_UNIQUE, ['uuid']);
|
||||
$dbman->add_key($table, $key);
|
||||
}
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021052503, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021052504) {
|
||||
// Define table enrol_lti_deployment to be created.
|
||||
$table = new xmldb_table('enrol_lti_deployment');
|
||||
|
||||
// Adding fields to table enrol_lti_deployment.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('deploymentid', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('platformid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table enrol_lti_deployment.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('platformid', XMLDB_KEY_FOREIGN, ['platformid'], 'enrol_lti_app_registration', ['id']);
|
||||
|
||||
// Add unique index on platformid (issuer), deploymentid.
|
||||
$table->add_index('platformid-deploymentid', XMLDB_INDEX_UNIQUE, ['platformid', 'deploymentid']);
|
||||
|
||||
// Conditionally launch create table for enrol_lti_deployment.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021052504, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021052505) {
|
||||
// Add a new column 'ltideploymentid' to the enrol_lti_users table.
|
||||
$table = new xmldb_table('enrol_lti_users');
|
||||
|
||||
// Define field ltideploymentid to be added to enrol_lti_users.
|
||||
$field = new xmldb_field('ltideploymentid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'sourceid');
|
||||
|
||||
// Conditionally launch add field deploymentid.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Launch add key ltideploymentid.
|
||||
$key = new xmldb_key('ltideploymentid', XMLDB_KEY_FOREIGN, ['ltideploymentid'], 'enrol_lti_deployment', ['id']);
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021052505, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021052506) {
|
||||
// Define table enrol_lti_resource_link to be created.
|
||||
$table = new xmldb_table('enrol_lti_resource_link');
|
||||
|
||||
// Adding fields to table enrol_lti_resource_link.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('resourcelinkid', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('resourceid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('ltideploymentid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('lticontextid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
$table->add_field('lineitemsservice', XMLDB_TYPE_CHAR, '1333', null, null, null, null);
|
||||
$table->add_field('lineitemservice', XMLDB_TYPE_CHAR, '1333', null, null, null, null);
|
||||
$table->add_field('lineitemscope', XMLDB_TYPE_CHAR, '255', null, null, null, null);
|
||||
$table->add_field('resultscope', XMLDB_TYPE_CHAR, '255', null, null, null, null);
|
||||
$table->add_field('scorescope', XMLDB_TYPE_CHAR, '255', null, null, null, null);
|
||||
$table->add_field('contextmembershipsurl', XMLDB_TYPE_CHAR, '1333', null, null, null, null);
|
||||
$table->add_field('nrpsserviceversions', XMLDB_TYPE_CHAR, '255', null, null, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table enrol_lti_resource_link.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('ltideploymentid', XMLDB_KEY_FOREIGN, ['ltideploymentid'], 'enrol_lti_deployment', ['id']);
|
||||
$table->add_key('lticontextid', XMLDB_KEY_FOREIGN, ['lticontextid'], 'enrol_lti_context', ['id']);
|
||||
|
||||
// Add unique index on resourcelinkid, ltideploymentid.
|
||||
$table->add_index('resourcelinkdid-ltideploymentid', XMLDB_INDEX_UNIQUE, ['resourcelinkid', 'ltideploymentid']);
|
||||
|
||||
// Conditionally launch create table for enrol_lti_resource_link.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021052506, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021052507) {
|
||||
// Define table enrol_lti_context to be created.
|
||||
$table = new xmldb_table('enrol_lti_context');
|
||||
|
||||
// Adding fields to table enrol_lti_context.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('contextid', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('ltideploymentid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('type', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table enrol_lti_context.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('ltideploymentid', XMLDB_KEY_FOREIGN, ['ltideploymentid'], 'enrol_lti_deployment', ['id']);
|
||||
|
||||
// Add unique index on ltideploymentid, contextid.
|
||||
$table->add_index('ltideploymentid-contextid', XMLDB_INDEX_UNIQUE, ['ltideploymentid', 'contextid']);
|
||||
|
||||
// Conditionally launch create table for enrol_lti_context.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2021052507, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021052508) {
|
||||
// Define table enrol_lti_user_resource_link to be created.
|
||||
$table = new xmldb_table('enrol_lti_user_resource_link');
|
||||
|
||||
// Adding fields to table enrol_lti_user_resource_link.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('ltiuserid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('resourcelinkid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table enrol_lti_user_resource_link.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('ltiuserid', XMLDB_KEY_FOREIGN, ['ltiuserid'], 'enrol_lti_users', ['id']);
|
||||
$table->add_key('resourcelinkid', XMLDB_KEY_FOREIGN, ['resourcelinkid'], 'enrol_lti_resource_link', ['id']);
|
||||
|
||||
// Add unique index on userid, resourcelinkid.
|
||||
$table->add_index('ltiuserid-resourcelinkid', XMLDB_INDEX_UNIQUE, ['ltiuserid', 'resourcelinkid']);
|
||||
|
||||
// Conditionally launch create table for enrol_lti_user_resource_link.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
upgrade_plugin_savepoint(true, 2021052508, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021052512) {
|
||||
// Define field legacyconsumerkey to be added to enrol_lti_deployment.
|
||||
$table = new xmldb_table('enrol_lti_deployment');
|
||||
$field = new xmldb_field('legacyconsumerkey', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'platformid');
|
||||
|
||||
// Conditionally launch add field legacyconsumerkey.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2021052512, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021052513) {
|
||||
// Define table enrol_lti_reg_token to be created.
|
||||
$table = new xmldb_table('enrol_lti_reg_token');
|
||||
|
||||
// Adding fields to table enrol_lti_reg_token.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('token', XMLDB_TYPE_CHAR, '60', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('expirytime', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table enrol_lti_reg_token.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
|
||||
// Conditionally launch create table for enrol_lti_reg_token.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2021052513, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021052514) {
|
||||
// Add a new column 'provisioningmodelearner' to the enrol_lti_tools table.
|
||||
$table = new xmldb_table('enrol_lti_tools');
|
||||
|
||||
// Define field provisioningmodelearner to be added to enrol_lti_tools.
|
||||
$field = new xmldb_field('provisioningmodelearner', XMLDB_TYPE_INTEGER, 2, null, null, null, null, 'uuid');
|
||||
|
||||
// Conditionally launch add field provisioningmodelearner.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field provisioningmodeinstructor to be added to enrol_lti_tools.
|
||||
$field = new xmldb_field('provisioningmodeinstructor', XMLDB_TYPE_INTEGER, 2, null, null, null, null,
|
||||
'provisioningmodelearner');
|
||||
|
||||
// Conditionally launch add field provisioningmodeinstructor.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021052514, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022031400) {
|
||||
// Changing the default of field platformid on table enrol_lti_app_registration to null.
|
||||
$table = new xmldb_table('enrol_lti_app_registration');
|
||||
$field = new xmldb_field('platformid', XMLDB_TYPE_TEXT, null, null, null, null, null, 'name');
|
||||
|
||||
// Launch change of nullability for field platformid.
|
||||
$dbman->change_field_notnull($table, $field);
|
||||
|
||||
// Changing the default of field clientid on table enrol_lti_app_registration to null.
|
||||
$field = new xmldb_field('clientid', XMLDB_TYPE_CHAR, '1333', null, null, null, null, 'platformid');
|
||||
|
||||
// Launch change of nullability for field clientid.
|
||||
$dbman->change_field_notnull($table, $field);
|
||||
|
||||
// Drop the platformclienthash index, so the field can be modified.
|
||||
$index = new xmldb_index('platformclienthash', XMLDB_INDEX_UNIQUE, ['platformclienthash']);
|
||||
|
||||
// Conditionally launch drop index platformclienthash.
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
// Changing the default of field platformclienthash on table enrol_lti_app_registration to null.
|
||||
$field = new xmldb_field('platformclienthash', XMLDB_TYPE_CHAR, '64', null, null, null, null, 'clientid');
|
||||
|
||||
// Launch change of nullability for field platformclienthash.
|
||||
$dbman->change_field_notnull($table, $field);
|
||||
|
||||
// Recreate the platformclienthash index.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Changing the default of field authenticationrequesturl on table enrol_lti_app_registration to null.
|
||||
$field = new xmldb_field('authenticationrequesturl', XMLDB_TYPE_TEXT, null, null, null, null, null, 'platformclienthash');
|
||||
|
||||
// Launch change of nullability for field authenticationrequesturl.
|
||||
$dbman->change_field_notnull($table, $field);
|
||||
|
||||
// Changing the default of field jwksurl on table enrol_lti_app_registration to null.
|
||||
$field = new xmldb_field('jwksurl', XMLDB_TYPE_TEXT, null, null, null, null, null, 'authenticationrequesturl');
|
||||
|
||||
// Launch change of nullability for field jwksurl.
|
||||
$dbman->change_field_notnull($table, $field);
|
||||
|
||||
// Changing the default of field accesstokenurl on table enrol_lti_app_registration to null.
|
||||
$field = new xmldb_field('accesstokenurl', XMLDB_TYPE_TEXT, null, null, null, null, null, 'jwksurl');
|
||||
|
||||
// Launch change of nullability for field accesstokenurl.
|
||||
$dbman->change_field_notnull($table, $field);
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2022031400, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022031401) {
|
||||
// Define field uniqueid to be added to enrol_lti_app_registration (defined as null so it can be set for existing rows).
|
||||
$table = new xmldb_table('enrol_lti_app_registration');
|
||||
$field = new xmldb_field('uniqueid', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'accesstokenurl');
|
||||
|
||||
// Conditionally launch add field uniqueid.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
|
||||
// Set existing values to use a suitable unique id.
|
||||
$recordset = $DB->get_recordset('enrol_lti_app_registration');
|
||||
foreach ($recordset as $record) {
|
||||
// Create a unique id for the registration. This will be used by:
|
||||
// a) The initiate_login endpoint (enrol/lti/login.php), as a stand in for client_id, when that's not provided.
|
||||
// b) The dynamic registration endpoint, where it'll be used to identify the incomplete registration to update
|
||||
// with the platform details.
|
||||
do {
|
||||
$bytes = random_bytes(30);
|
||||
$record->uniqueid = bin2hex($bytes);
|
||||
} while ($DB->record_exists('enrol_lti_app_registration', ['uniqueid' => $record->uniqueid]));
|
||||
|
||||
$DB->update_record('enrol_lti_app_registration', $record);
|
||||
}
|
||||
$recordset->close();
|
||||
|
||||
// Now make the field notnull.
|
||||
$field = new xmldb_field('uniqueid', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'accesstokenurl');
|
||||
$dbman->change_field_notnull($table, $field);
|
||||
}
|
||||
|
||||
// Launch add unique key uniqueid.
|
||||
$key = new xmldb_key('uniqueid', XMLDB_KEY_UNIQUE, ['uniqueid']);
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Define field status to be added to enrol_lti_app_registration with a default value of 1 (to set existing rows).
|
||||
$field = new xmldb_field('status', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1', 'uniqueid');
|
||||
|
||||
// Conditionally launch add field status.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
|
||||
// Now change the default value to '0'.
|
||||
$field = new xmldb_field('status', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'uniqueid');
|
||||
$dbman->change_field_default($table, $field);
|
||||
}
|
||||
|
||||
// Define field platformuniqueidhash to be added to enrol_lti_app_registration.
|
||||
$field = new xmldb_field('platformuniqueidhash', XMLDB_TYPE_CHAR, '64', null, null, null, null, 'status');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
|
||||
$recordset = $DB->get_recordset('enrol_lti_app_registration');
|
||||
foreach ($recordset as $record) {
|
||||
$record->platformuniqueidhash = hash('sha256', $record->platformid . ':' . $record->uniqueid);
|
||||
$DB->update_record('enrol_lti_app_registration', $record);
|
||||
}
|
||||
$recordset->close();
|
||||
}
|
||||
|
||||
// Add index platformuniqueidhash to enrol_lti_app_registration.
|
||||
$index = new xmldb_index('platformuniqueidhash', XMLDB_INDEX_UNIQUE, ['platformuniqueidhash']);
|
||||
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2022031401, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022031402) {
|
||||
// Define table enrol_lti_reg_token to be dropped.
|
||||
$table = new xmldb_table('enrol_lti_reg_token');
|
||||
|
||||
// Conditionally launch drop table for enrol_lti_reg_token.
|
||||
if ($dbman->table_exists($table)) {
|
||||
$dbman->drop_table($table);
|
||||
}
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2022031402, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2022061500) {
|
||||
// Disable all orphaned enrolment method instances.
|
||||
$sql = "id IN (SELECT t.enrolid
|
||||
FROM {enrol_lti_tools} t
|
||||
LEFT JOIN {context} c ON (t.contextid = c.id)
|
||||
WHERE c.id IS NULL)";
|
||||
$DB->set_field_select('enrol', 'status', 1, $sql);
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2022061500, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022103100) {
|
||||
// Update lti user information for LTI 2.0 users having the wrong consumer secret recorded.
|
||||
// This applies to any LTI 2.0 user who has launched the tool (i.e. has lastaccess) and fixes a non-functional grade sync
|
||||
// for LTI 2.0 consumers.
|
||||
$sql = "SELECT lu.id, lc.secret
|
||||
FROM {enrol_lti_users} lu
|
||||
JOIN {enrol_lti_lti2_consumer} lc
|
||||
ON (" . $DB->sql_compare_text('lu.consumerkey', 255) . " = lc.consumerkey256)
|
||||
WHERE lc.ltiversion = :ltiversion
|
||||
AND " . $DB->sql_compare_text('lu.consumersecret') . " != lc.secret
|
||||
AND lu.lastaccess IS NOT NULL";
|
||||
$affectedltiusersrs = $DB->get_recordset_sql($sql, ['ltiversion' => 'LTI-2p0']);
|
||||
foreach ($affectedltiusersrs as $ltiuser) {
|
||||
$DB->set_field('enrol_lti_users', 'consumersecret', $ltiuser->secret, ['id' => $ltiuser->id]);
|
||||
}
|
||||
$affectedltiusersrs->close();
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2022103100, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022110300) {
|
||||
// Update lti user information for any users missing a consumer secret.
|
||||
// This applies to any user who has launched the tool (i.e. has lastaccess) but who doesn't have a secret recorded.
|
||||
// This fixes a bug where enrol_lti_users records are created first during a member sync, and are missing the secret,
|
||||
// even despite having launched the tool subsequently.
|
||||
$sql = "SELECT lu.id, lc.secret
|
||||
FROM {enrol_lti_users} lu
|
||||
JOIN {enrol_lti_lti2_consumer} lc
|
||||
ON (" . $DB->sql_compare_text('lu.consumerkey', 255) . " = lc.consumerkey256)
|
||||
WHERE lu.consumersecret IS NULL
|
||||
AND lu.lastaccess IS NOT NULL";
|
||||
$affectedltiusersrs = $DB->get_recordset_sql($sql);
|
||||
foreach ($affectedltiusersrs as $ltiuser) {
|
||||
$DB->set_field('enrol_lti_users', 'consumersecret', $ltiuser->secret, ['id' => $ltiuser->id]);
|
||||
}
|
||||
$affectedltiusersrs->close();
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2022110300, 'enrol', 'lti');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -25,14 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_enrol_manual_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -25,14 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_enrol_mnet_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,14 +43,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_enrol_paypal_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -25,14 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_enrol_self_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,14 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_filter_displayh5p_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,26 +29,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_filter_mathjaxloader_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021052501) {
|
||||
// Update CDN url.
|
||||
$originalurl = 'https://cdn.jsdelivr.net/npm/[email protected]/MathJax.js';
|
||||
$newurl = 'https://cdn.jsdelivr.net/npm/[email protected]/MathJax.js';
|
||||
$currenturl = get_config('filter_mathjaxloader', 'httpsurl');
|
||||
if ($currenturl == $originalurl) {
|
||||
set_config('httpsurl', $newurl, 'filter_mathjaxloader');
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2021052501, 'filter', 'mathjaxloader');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_filter_mediaplugin_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_filter_tex_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -35,14 +35,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @throws upgrade_exception
|
||||
*/
|
||||
function xmldb_gradingform_guide_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,14 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool true
|
||||
*/
|
||||
function xmldb_gradingform_rubric_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,24 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_gradereport_history_upgrade($oldversion) {
|
||||
|
||||
if ($oldversion < 2019111801) {
|
||||
$perpageconfig = get_config('moodle', 'grade_report_historyperpage');
|
||||
|
||||
// For existing installations with a non-integer 'per page' config, update the value to the default.
|
||||
if (!empty($perpageconfig) && filter_var($perpageconfig, FILTER_VALIDATE_INT) === false) {
|
||||
set_config('grade_report_historyperpage', 50);
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2019111801, 'gradereport', 'history');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,13 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_gradereport_overview_upgrade($oldversion) {
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,14 +29,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_gradereport_user_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,13 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_antivirus_clamav_upgrade($oldversion) {
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
+4
-2841
File diff suppressed because it is too large
Load Diff
@@ -30,53 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_editor_atto_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021062400) {
|
||||
// The old default toolbar config for 311 and below.
|
||||
$oldtoolbar = 'collapse = collapse
|
||||
style1 = title, bold, italic
|
||||
list = unorderedlist, orderedlist, indent
|
||||
links = link
|
||||
files = emojipicker, image, media, recordrtc, managefiles, h5p
|
||||
style2 = underline, strike, subscript, superscript
|
||||
align = align
|
||||
insert = equation, charmap, table, clear
|
||||
undo = undo
|
||||
accessibility = accessibilitychecker, accessibilityhelper
|
||||
other = html';
|
||||
|
||||
// Check if the current toolbar config matches the old toolbar config.
|
||||
$sametoolbar = str_replace(["\r\n", "\r"], "\n", get_config('editor_atto', 'toolbar')) == $oldtoolbar;
|
||||
// Check if the current showgroups config matches the old showgroups config.
|
||||
$sameshowgroups = get_config('atto_collapse', 'showgroups') == 5;
|
||||
|
||||
if ($sametoolbar && $sameshowgroups) {
|
||||
// If the site is still using the old defaults, upgrade to the new default.
|
||||
$newtoolbar = 'collapse = collapse
|
||||
style1 = title, bold, italic
|
||||
list = unorderedlist, orderedlist, indent
|
||||
links = link
|
||||
files = emojipicker, image, media, recordrtc, managefiles, h5p
|
||||
accessibility = accessibilitychecker, accessibilityhelper
|
||||
style2 = underline, strike, subscript, superscript
|
||||
align = align
|
||||
insert = equation, charmap, table, clear
|
||||
undo = undo
|
||||
other = html';
|
||||
set_config('toolbar', $newtoolbar, 'editor_atto');
|
||||
set_config('showgroups', 6, 'atto_collapse');
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2021062400, 'editor', 'atto');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,24 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_atto_equation_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2022110700) {
|
||||
$oldmatrix = '\left| \begin{matrix} a_1 & a_2 \\ a_3 & a_4 \end{matrix} \right|';
|
||||
$fixedmatrix = '\left| \begin{matrix} a_1 & a_2 \\\\ a_3 & a_4 \end{matrix} \right|';
|
||||
$config = get_config('atto_equation', 'librarygroup4');
|
||||
$newdefault = str_replace($oldmatrix, $fixedmatrix, $config);
|
||||
set_config('librarygroup4', $newdefault, 'atto_equation');
|
||||
// Atto equation savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2022110700, 'atto', 'equation');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,23 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_atto_recordrtc_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Change settings from timelimit to audiotimelimit and videotimelimit.
|
||||
require_once($CFG->dirroot . '/lib/editor/atto/plugins/recordrtc/lib.php');
|
||||
if ($oldversion < 2021073000) {
|
||||
$timelimit = get_config('atto_recordrtc', 'timelimit');
|
||||
if ($timelimit != DEFAULT_TIME_LIMIT) {
|
||||
set_config('audiotimelimit', $timelimit, 'atto_recordrtc');
|
||||
set_config('videotimelimit', $timelimit, 'atto_recordrtc');
|
||||
}
|
||||
// Recordrtc savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021073000, 'atto', 'recordrtc');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -51,20 +51,6 @@ defined('MOODLE_INTERNAL') || die;
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_media_videojs_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
if ($oldversion < 2021052503) {
|
||||
// Remove useflash and rtmp settings.
|
||||
unset_config('useflash', 'media_videojs');
|
||||
unset_config('rtmp', 'media_videojs');
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021052503, 'media', 'videojs');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param int $oldversion The version that we are upgrading from
|
||||
*/
|
||||
function xmldb_message_email_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param int $oldversion The version that we are upgrading from
|
||||
*/
|
||||
function xmldb_message_popup_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,106 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_assign_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021110901) {
|
||||
// Define field activity to be added to assign.
|
||||
$table = new xmldb_table('assign');
|
||||
$field = new xmldb_field('activity', XMLDB_TYPE_TEXT, null, null, null, null, null, 'alwaysshowdescription');
|
||||
|
||||
// Conditionally launch add field activity.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('activityformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0', 'activity');
|
||||
|
||||
// Conditionally launch add field activityformat.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('timelimit', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'cutoffdate');
|
||||
|
||||
// Conditionally launch add field timelimit.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('submissionattachments', XMLDB_TYPE_INTEGER, '2',
|
||||
null, XMLDB_NOTNULL, null, '0', 'activityformat');
|
||||
|
||||
// Conditionally launch add field submissionattachments.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$table = new xmldb_table('assign_submission');
|
||||
$field = new xmldb_field('timestarted', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'timemodified');
|
||||
|
||||
// Conditionally launch add field timestarted.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field timelimit to be added to assign_overrides.
|
||||
$table = new xmldb_table('assign_overrides');
|
||||
$field = new xmldb_field('timelimit', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'cutoffdate');
|
||||
|
||||
// Conditionally launch add field timelimit.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Assign savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2021110901, 'assign');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2022071300) {
|
||||
// The most recent assign submission should always have latest = 1, we want to find all records where this is not the case.
|
||||
// Find the records with the maximum timecreated for each assign and user combination where latest is also 0.
|
||||
$sqluser = "SELECT s.id
|
||||
FROM {assign_submission} s
|
||||
WHERE s.timecreated = (
|
||||
SELECT MAX(timecreated) timecreated
|
||||
FROM {assign_submission} sm
|
||||
WHERE s.assignment = sm.assignment
|
||||
AND s.userid = sm.userid
|
||||
AND sm.groupid = 0)
|
||||
AND s.groupid = 0
|
||||
AND s.latest = 0";
|
||||
$idstofixuser = $DB->get_records_sql($sqluser, null);
|
||||
|
||||
$sqlgroup = "SELECT s.id
|
||||
FROM {assign_submission} s
|
||||
WHERE s.timecreated = (
|
||||
SELECT MAX(timecreated) timecreated
|
||||
FROM {assign_submission} sm
|
||||
WHERE s.assignment = sm.assignment
|
||||
AND s.groupid = sm.groupid
|
||||
AND sm.groupid <> 0)
|
||||
AND s.groupid <> 0
|
||||
AND s.latest = 0";
|
||||
$idstofixgroup = $DB->get_records_sql($sqlgroup, null);
|
||||
|
||||
$idstofix = array_merge(array_keys($idstofixuser), array_keys($idstofixgroup));
|
||||
|
||||
if (count($idstofix)) {
|
||||
[$insql, $inparams] = $DB->get_in_or_equal($idstofix);
|
||||
$DB->set_field_select('assign_submission', 'latest', 1, "id $insql", $inparams);
|
||||
}
|
||||
|
||||
// Assignment savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2022071300, 'assign');
|
||||
}
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_assignfeedback_comments_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -34,65 +34,6 @@ function xmldb_assignfeedback_editpdf_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021060400) {
|
||||
// Remove submissions from the processing queue that have been processed.
|
||||
$sql = 'DELETE
|
||||
FROM {assignfeedback_editpdf_queue}
|
||||
WHERE EXISTS (SELECT 1
|
||||
FROM {assign_submission} s,
|
||||
{assign_grades} g
|
||||
WHERE s.id = submissionid
|
||||
AND s.assignment = g.assignment
|
||||
AND s.userid = g.userid
|
||||
AND s.attemptnumber = g.attemptnumber)';
|
||||
|
||||
$DB->execute($sql);
|
||||
|
||||
// Editpdf savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021060400, 'assignfeedback', 'editpdf');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2022061000) {
|
||||
$table = new xmldb_table('assignfeedback_editpdf_queue');
|
||||
if ($dbman->table_exists($table)) {
|
||||
// Convert not yet converted submissions into adhoc tasks.
|
||||
$rs = $DB->get_recordset('assignfeedback_editpdf_queue');
|
||||
foreach ($rs as $record) {
|
||||
$data = [
|
||||
'submissionid' => $record->submissionid,
|
||||
'submissionattempt' => $record->submissionattempt,
|
||||
];
|
||||
$task = new assignfeedback_editpdf\task\convert_submission;
|
||||
$task->set_custom_data($data);
|
||||
\core\task\manager::queue_adhoc_task($task, true);
|
||||
}
|
||||
$rs->close();
|
||||
|
||||
// Drop the table.
|
||||
$dbman->drop_table($table);
|
||||
}
|
||||
|
||||
// Editpdf savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2022061000, 'assignfeedback', 'editpdf');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022082200) {
|
||||
// Conversion records need to be removed in order for conversions to restart.
|
||||
$DB->delete_records('file_conversion');
|
||||
|
||||
// Schedule an adhoc task to fix existing stale conversions.
|
||||
$task = new \assignfeedback_editpdf\task\bump_submission_for_stale_conversions();
|
||||
\core\task\manager::queue_adhoc_task($task);
|
||||
|
||||
upgrade_plugin_savepoint(true, 2022082200, 'assignfeedback', 'editpdf');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_assignfeedback_file_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_assignsubmission_comments_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_assignsubmission_file_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,14 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_assignsubmission_onlinetext_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -37,452 +37,7 @@ use mod_bigbluebuttonbn\task\upgrade_recordings_task;
|
||||
function xmldb_bigbluebuttonbn_upgrade($oldversion = 0) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
if ($oldversion < 2015080605) {
|
||||
// Drop field description.
|
||||
$table5 = new xmldb_table('bigbluebuttonbn');
|
||||
$field4 = new xmldb_field('description');
|
||||
if ($dbman->field_exists($table5, $field4)) {
|
||||
$dbman->drop_field($table5, $field4, true, true);
|
||||
}
|
||||
// Change welcome, allow null.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_TEXT, 'precision' => null, 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => null, 'previous' => 'type'];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'welcome',
|
||||
$fielddefinition);
|
||||
// Change userid definition in bigbluebuttonbn_log.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '10', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => null,
|
||||
'previous' => 'bigbluebuttonbnid'];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn_log', 'userid',
|
||||
$fielddefinition);
|
||||
// No settings to migrate.
|
||||
// Update db version tag.
|
||||
upgrade_mod_savepoint(true, 2015080605, 'bigbluebuttonbn');
|
||||
}
|
||||
if ($oldversion < 2016011305) {
|
||||
// Define field type to be droped from bigbluebuttonbn.
|
||||
$table4 = new xmldb_table('bigbluebuttonbn');
|
||||
$field3 = new xmldb_field('type');
|
||||
if ($dbman->field_exists($table4, $field3)) {
|
||||
$dbman->drop_field($table4, $field3, true, true);
|
||||
}
|
||||
// Rename table bigbluebuttonbn_log to bigbluebuttonbn_logs.
|
||||
$table = new xmldb_table('bigbluebuttonbn_log');
|
||||
if ($dbman->table_exists($table)) {
|
||||
$dbman->rename_table($table, 'bigbluebuttonbn_logs', true, true);
|
||||
}
|
||||
// Rename field event to log in table bigbluebuttonbn_logs.
|
||||
$table1 = new xmldb_table('bigbluebuttonbn_logs');
|
||||
$field = new xmldb_field('event');
|
||||
if ($dbman->field_exists($table1, $field)) {
|
||||
$dbman->rename_field($table1, $field, 'log', true, true);
|
||||
}
|
||||
// No settings to migrate.
|
||||
// Update db version tag.
|
||||
upgrade_mod_savepoint(true, 2016011305, 'bigbluebuttonbn');
|
||||
}
|
||||
if ($oldversion < 2017101000) {
|
||||
// Drop field newwindow.
|
||||
$table3 = new xmldb_table('bigbluebuttonbn');
|
||||
$field2 = new xmldb_field('newwindow');
|
||||
if ($dbman->field_exists($table3, $field2)) {
|
||||
$dbman->drop_field($table3, $field2, true, true);
|
||||
}
|
||||
// Add field type.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '2', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => 'id'];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'type',
|
||||
$fielddefinition);
|
||||
// Add field recordings_html.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'recordings_html',
|
||||
$fielddefinition);
|
||||
// Add field recordings_deleted.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 1, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'recordings_deleted',
|
||||
$fielddefinition);
|
||||
// Add field recordings_imported.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'recordings_imported',
|
||||
$fielddefinition);
|
||||
// Drop field newwindow.
|
||||
$table2 = new xmldb_table('bigbluebuttonbn');
|
||||
$field1 = new xmldb_field('tagging');
|
||||
if ($dbman->field_exists($table2, $field1)) {
|
||||
$dbman->drop_field($table2, $field1, true, true);
|
||||
}
|
||||
// Migrate settings.
|
||||
unset_config('bigbluebuttonbn_recordingtagging_default', '');
|
||||
unset_config('bigbluebuttonbn_recordingtagging_editable', '');
|
||||
$cfgvalue = get_config('', 'bigbluebuttonbn_importrecordings_from_deleted_activities_enabled');
|
||||
set_config('bigbluebuttonbn_importrecordings_from_deleted_enabled', $cfgvalue, '');
|
||||
unset_config('bigbluebuttonbn_importrecordings_from_deleted_activities_enabled', '');
|
||||
$cfgvalue = get_config('', 'bigbluebuttonbn_moderator_default');
|
||||
set_config('bigbluebuttonbn_participant_moderator_default', $cfgvalue, '');
|
||||
unset_config('bigbluebuttonbn_moderator_default', '');
|
||||
// Update db version tag.
|
||||
upgrade_mod_savepoint(true, 2017101000, 'bigbluebuttonbn');
|
||||
}
|
||||
if ($oldversion < 2017101009) {
|
||||
// Add field recordings_preview.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'recordings_preview',
|
||||
$fielddefinition);
|
||||
// Update db version tag.
|
||||
upgrade_mod_savepoint(true, 2017101009, 'bigbluebuttonbn');
|
||||
}
|
||||
if ($oldversion < 2017101010) {
|
||||
// Fix for CONTRIB-7221.
|
||||
if ($oldversion == 2017101003) {
|
||||
// A bug intorduced in 2017101003 causes new instances to be created without BBB passwords.
|
||||
// A workaround was put in place in version 2017101004 that was relabeled to 2017101005.
|
||||
// However, as the code was relocated to upgrade.php in version 2017101010, a new issue came up.
|
||||
// There is now a timeout error when the plugin is upgraded in large Moodle sites.
|
||||
// The script should only be considered when migrating from this version.
|
||||
$sql = "SELECT * FROM {bigbluebuttonbn} ";
|
||||
$sql .= "WHERE moderatorpass = ? OR viewerpass = ?";
|
||||
$instances = $DB->get_records_sql($sql, ['', '']);
|
||||
foreach ($instances as $instance) {
|
||||
$instance->moderatorpass = plugin::random_password(12);
|
||||
$instance->viewerpass = plugin::random_password(12, $instance->moderatorpass);
|
||||
// Store passwords in the database.
|
||||
$DB->update_record('bigbluebuttonbn', $instance);
|
||||
}
|
||||
}
|
||||
// Update db version tag.
|
||||
upgrade_mod_savepoint(true, 2017101010, 'bigbluebuttonbn');
|
||||
}
|
||||
if ($oldversion < 2017101012) {
|
||||
// Update field type (Fix for CONTRIB-7302).
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '2', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => 'id'];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'type',
|
||||
$fielddefinition);
|
||||
// Update field meetingid (Fix for CONTRIB-7302).
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_CHAR, 'precision' => '255', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => null, 'previous' => 'introformat'];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'meetingid',
|
||||
$fielddefinition);
|
||||
// Update field recordings_imported (Fix for CONTRIB-7302).
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'recordings_imported',
|
||||
$fielddefinition);
|
||||
// Add field recordings_preview.(Fix for CONTRIB-7302).
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'recordings_preview',
|
||||
$fielddefinition);
|
||||
// Update db version tag.
|
||||
upgrade_mod_savepoint(true, 2017101012, 'bigbluebuttonbn');
|
||||
}
|
||||
if ($oldversion < 2017101015) {
|
||||
// Add field for client technology choice.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'clienttype',
|
||||
$fielddefinition);
|
||||
// Update db version tag.
|
||||
upgrade_mod_savepoint(true, 2017101015, 'bigbluebuttonbn');
|
||||
}
|
||||
if ($oldversion < 2019042000) {
|
||||
// Add field for Mute on start feature.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'muteonstart',
|
||||
$fielddefinition);
|
||||
// Add field for record all from start.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'recordallfromstart',
|
||||
$fielddefinition);
|
||||
// Add field for record hide button.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'recordhidebutton',
|
||||
$fielddefinition);
|
||||
// Update db version tag.
|
||||
upgrade_mod_savepoint(true, 2019042000, 'bigbluebuttonbn');
|
||||
}
|
||||
if ($oldversion < 2019101001) {
|
||||
// Add field for Completion with attendance.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '9', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'completionattendance',
|
||||
$fielddefinition);
|
||||
// Add field for Completion with engagement through chats.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '9', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'completionengagementchats',
|
||||
$fielddefinition);
|
||||
// Add field for Completion with engagement through talks.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '9', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'completionengagementtalks',
|
||||
$fielddefinition);
|
||||
// Add field for Completion with engagement through raisehand.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '9', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'completionengagementraisehand',
|
||||
$fielddefinition);
|
||||
// Add field for Completion with engagement through pollvotes.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '9', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'completionengagementpollvotes',
|
||||
$fielddefinition);
|
||||
// Add field for Completion with engagement through emojis.
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '9', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => null];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'completionengagementemojis',
|
||||
$fielddefinition);
|
||||
// Add index to bigbluebuttonbn_logs (Fix for CONTRIB-8157).
|
||||
xmldb_bigbluebuttonbn_index_table($dbman, 'bigbluebuttonbn_logs', 'courseid',
|
||||
['courseid']);
|
||||
xmldb_bigbluebuttonbn_index_table($dbman, 'bigbluebuttonbn_logs', 'log',
|
||||
['log']);
|
||||
xmldb_bigbluebuttonbn_index_table($dbman, 'bigbluebuttonbn_logs', 'logrow',
|
||||
['courseid', 'bigbluebuttonbnid', 'userid', 'log']);
|
||||
// Update db version tag.
|
||||
upgrade_mod_savepoint(true, 2019101001, 'bigbluebuttonbn');
|
||||
}
|
||||
|
||||
if ($oldversion < 2019101002) {
|
||||
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => 'muteonstart'];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'disablecam',
|
||||
$fielddefinition);
|
||||
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => 'disablecam'];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'disablemic',
|
||||
$fielddefinition);
|
||||
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => 'disablemic'];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'disableprivatechat',
|
||||
$fielddefinition);
|
||||
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => 'disableprivatechat'];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'disablepublicchat',
|
||||
$fielddefinition);
|
||||
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => 'disablepublicchat'];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'disablenote',
|
||||
$fielddefinition);
|
||||
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => 'disablenote'];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'hideuserlist',
|
||||
$fielddefinition);
|
||||
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => 'hideuserlist'];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'lockedlayout',
|
||||
$fielddefinition);
|
||||
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => 'lockedlayout'];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'lockonjoin',
|
||||
$fielddefinition);
|
||||
|
||||
$fielddefinition = ['type' => XMLDB_TYPE_INTEGER, 'precision' => '1', 'unsigned' => null,
|
||||
'notnull' => XMLDB_NOTNULL, 'sequence' => null, 'default' => 0, 'previous' => 'lockonjoin'];
|
||||
xmldb_bigbluebuttonbn_add_change_field($dbman, 'bigbluebuttonbn', 'lockonjoinconfigurable',
|
||||
$fielddefinition);
|
||||
|
||||
// Bigbluebuttonbn savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2019101002, 'bigbluebuttonbn');
|
||||
}
|
||||
|
||||
if ($oldversion < 2019101004) {
|
||||
// Add index to bigbluebuttonbn_logs (Leftover for CONTRIB-8157).
|
||||
xmldb_bigbluebuttonbn_index_table($dbman, 'bigbluebuttonbn_logs', 'userlog',
|
||||
['userid', 'log']);
|
||||
// Bigbluebuttonbn savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2019101004, 'bigbluebuttonbn');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021072905) {
|
||||
// Add table bigbluebuttonbn_recordings (CONTRIB-7994).
|
||||
// Define table bigbluebuttonbn_recordings to be created.
|
||||
$table = new xmldb_table('bigbluebuttonbn_recordings');
|
||||
|
||||
// Adding fields to table bigbluebuttonbn_recordings.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('bigbluebuttonbnid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('groupid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
$table->add_field('recordingid', XMLDB_TYPE_CHAR, '64', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('headless', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('imported', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('state', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('recording', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
|
||||
// Adding keys to table bigbluebuttonbn_recordings.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('fk_bigbluebuttonbnid', XMLDB_KEY_FOREIGN, ['bigbluebuttonbnid'], 'bigbluebuttonbn', ['id']);
|
||||
$table->add_key('usermodified', XMLDB_KEY_FOREIGN, ['usermodified'], 'user', ['id']);
|
||||
|
||||
// Adding indexes to table bigbluebuttonbn_recordings.
|
||||
$table->add_index('courseid', XMLDB_INDEX_NOTUNIQUE, ['courseid']);
|
||||
$table->add_index('recordingid', XMLDB_INDEX_NOTUNIQUE, ['recordingid']);
|
||||
|
||||
// Conditionally launch create table for bigbluebuttonbn_recordings.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
// Bigbluebuttonbn savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2021072905, 'bigbluebuttonbn');
|
||||
}
|
||||
if ($oldversion < 2021072906) {
|
||||
|
||||
// Rename field recording on table bigbluebuttonbn_recordings to remotedata, add new remotedatatstamp and status.
|
||||
$table = new xmldb_table('bigbluebuttonbn_recordings');
|
||||
|
||||
$field = new xmldb_field('recording', XMLDB_TYPE_TEXT, null, null, null, null, null, 'state');
|
||||
// Launch rename field recording to remotedata.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->rename_field($table, $field, 'remotedata');
|
||||
}
|
||||
$field = new xmldb_field('remotedatatstamp', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
// Conditionally launch add field remotedatatstamp.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// State is already used on remote bigbluebutton entity and has not the same semantic.
|
||||
$field = new xmldb_field('state', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'imported');
|
||||
// Launch rename field state to status.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->rename_field($table, $field, 'status');
|
||||
}
|
||||
// Bigbluebuttonbn savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2021072906, 'bigbluebuttonbn');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021072907) {
|
||||
// Define field id to be dropped from bigbluebuttonbn_recordings.
|
||||
$table = new xmldb_table('bigbluebuttonbn_recordings');
|
||||
$remotedatatstamp = new xmldb_field('remotedatatstamp');
|
||||
$remotedata = new xmldb_field('remotedata', XMLDB_TYPE_TEXT, null, null, null, null, null, 'status');
|
||||
// Conditionally launch drop field remotedatatstamp.
|
||||
if ($dbman->field_exists($table, $remotedatatstamp)) {
|
||||
$dbman->drop_field($table, $remotedatatstamp);
|
||||
}
|
||||
// Launch rename field importeddata.
|
||||
if ($dbman->field_exists($table, $remotedata)) {
|
||||
$dbman->rename_field($table, $remotedata, 'importeddata');
|
||||
}
|
||||
// Bigbluebuttonbn savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2021072907, 'bigbluebuttonbn');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021083100) {
|
||||
// Update the legacy notifications to use the legacy class which will be removed as per the deprecation policy.
|
||||
$DB->set_field('task_adhoc', 'classname', '\mod_bigbluebuttonbn\task\send_legacy_notification', [
|
||||
'component' => 'mod_bigbluebuttonbn',
|
||||
'classname' => '\mod_bigbluebuttonbn\task\send_notification',
|
||||
]);
|
||||
|
||||
// Bigbluebuttonbn savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2021083100, 'bigbluebuttonbn');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021091408) {
|
||||
// Change BigBliueButton Server credentials to new defaults if test-install is being used.
|
||||
if (config::get('server_url') == 'http://test-install.blindsidenetworks.com/bigbluebutton/') {
|
||||
set_config('bigbluebuttonbn_server_url', config::DEFAULT_SERVER_URL);
|
||||
set_config('bigbluebuttonbn_shared_secret', config::DEFAULT_SHARED_SECRET);
|
||||
}
|
||||
// Bigbluebuttonbn savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2021091408, 'bigbluebuttonbn');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022021601) {
|
||||
// Create adhoc task for upgrading of existing bigbluebuttonbn_logs related to recordings.
|
||||
upgrade_recordings_task::schedule_upgrade_per_meeting();
|
||||
upgrade_recordings_task::schedule_upgrade_per_meeting(true);
|
||||
// Bigbluebuttonbn savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2022021601, 'bigbluebuttonbn');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2022050600) {
|
||||
|
||||
set_config('bigbluebuttonbn_default_dpa_accepted', false);
|
||||
|
||||
// If the default server configuration is used.
|
||||
if (config::get('server_url') === config::DEFAULT_SERVER_URL) {
|
||||
// Disable the BigBlueButton activity module.
|
||||
$DB->set_field('modules', 'visible', 0, ['name' => 'bigbluebuttonbn']);
|
||||
|
||||
// Use an adhoc task to send a notification to inform the admin that the BigBlueButton activity module
|
||||
// has been disabled and they are required to confirm their acceptance of the data processing agreement
|
||||
// prior to re-enabling it.
|
||||
$notificationtask = new mod_bigbluebuttonbn\task\send_bigbluebutton_module_disabled_notification();
|
||||
core\task\manager::queue_adhoc_task($notificationtask);
|
||||
}
|
||||
|
||||
// Bigbluebuttonbn savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2022050600, 'bigbluebuttonbn');
|
||||
}
|
||||
if ($oldversion < 2022080400) {
|
||||
|
||||
// Define field lockonjoin to be dropped from bigbluebuttonbn.
|
||||
$table = new xmldb_table('bigbluebuttonbn');
|
||||
$field = new xmldb_field('lockonjoin');
|
||||
// Conditionally launch drop field lockonjoin.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
$field = new xmldb_field('lockonjoinconfigurable');
|
||||
// Conditionally launch drop field lockonjoinconfigurable.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
// Bigbluebuttonbn savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2022080400, 'bigbluebuttonbn');
|
||||
}
|
||||
if ($oldversion < 2022101900) {
|
||||
$table = new xmldb_table('bigbluebuttonbn');
|
||||
|
||||
$field = new xmldb_field('guestallowed', XMLDB_TYPE_INTEGER, '2', null, null, null, '0', 'completionengagementemojis');
|
||||
// Conditionally launch add field guestallowed.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('mustapproveuser', XMLDB_TYPE_INTEGER, '2', null, null, null, '1', 'guestallowed');
|
||||
// Conditionally launch add field mustapproveuser.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('guestlinkuid', XMLDB_TYPE_CHAR, '1024', null, null, null, null, 'mustapproveuser');
|
||||
// Conditionally launch add field guestlinkuid.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('guestpassword', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'guestlinkuid');
|
||||
// Conditionally launch add field guestpassword.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
upgrade_mod_savepoint(true, 2022101900, 'bigbluebuttonbn');
|
||||
}
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
if ($oldversion < 2023011800) {
|
||||
|
||||
@@ -30,35 +30,6 @@ defined('MOODLE_INTERNAL') || die;
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_book_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021052501) {
|
||||
$table = new xmldb_table('book_chapters');
|
||||
$index = new xmldb_index('bookid', XMLDB_INDEX_NOTUNIQUE, ['bookid']);
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
upgrade_mod_savepoint(true, 2021052501, 'book');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
if ($oldversion < 2022053000) {
|
||||
// Define key course (foreign) to be added to book.
|
||||
$table = new xmldb_table('book');
|
||||
$key = new xmldb_key('course', XMLDB_KEY_FOREIGN, ['course'], 'course', ['id']);
|
||||
// Launch add key course.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Book savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2022053000, 'book');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -25,28 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_chat_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
require_once($CFG->libdir.'/db/upgradelib.php'); // Core Upgrade-related functions.
|
||||
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
if ($oldversion < 2022053000) {
|
||||
// Define key course (foreign) to be added to chat_users.
|
||||
$table = new xmldb_table('chat_users');
|
||||
$key = new xmldb_key('course', XMLDB_KEY_FOREIGN, ['course'], 'course', ['id']);
|
||||
// Launch add key course.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Chat savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2022053000, 'chat');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -22,28 +22,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_choice_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2020061600) {
|
||||
// Define field showavailable to be added to choice.
|
||||
$table = new xmldb_table('choice');
|
||||
$field = new xmldb_field('showavailable', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'completionsubmit');
|
||||
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Choice savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2020061600, 'choice');
|
||||
}
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -24,24 +24,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_data_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
if ($oldversion < 2022081600) {
|
||||
// Define key userid (foreign) to be added to data_records.
|
||||
$table = new xmldb_table('data_records');
|
||||
$key = new xmldb_key('userid', XMLDB_KEY_FOREIGN, ['userid'], 'user', ['id']);
|
||||
// Launch add key userid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Data savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2022081600, 'data');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -42,27 +42,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_feedback_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
if ($oldversion < 2022053000) {
|
||||
// Define key courseid (foreign) to be added to feedback_completed.
|
||||
$table = new xmldb_table('feedback_completed');
|
||||
$key = new xmldb_key('courseid', XMLDB_KEY_FOREIGN, ['courseid'], 'course', ['id']);
|
||||
|
||||
// Launch add key courseid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Feedback savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2022053000, 'feedback');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -45,30 +45,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_folder_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
if ($oldversion < 2021052501) {
|
||||
|
||||
// Define field forcedownload to be added to folder.
|
||||
$table = new xmldb_table('folder');
|
||||
$field = new xmldb_field('forcedownload', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1', 'showdownloadfolder');
|
||||
|
||||
// Conditionally launch add field forcedownload.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Folder savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2021052501, 'folder');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -47,132 +47,6 @@ function xmldb_forum_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2020072100) {
|
||||
// Add index privatereplyto (not unique) to the forum_posts table.
|
||||
$table = new xmldb_table('forum_posts');
|
||||
$index = new xmldb_index('privatereplyto', XMLDB_INDEX_NOTUNIQUE, ['privatereplyto']);
|
||||
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
upgrade_mod_savepoint(true, 2020072100, 'forum');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021101100) {
|
||||
// Add custom data to digest tasks to stop duplicates being created after this patch.
|
||||
$timenow = time();
|
||||
|
||||
$sitetimezone = \core_date::get_server_timezone();
|
||||
$servermidnight = usergetmidnight($timenow, $sitetimezone);
|
||||
$digesttime = $servermidnight + ($CFG->digestmailtime * 3600);
|
||||
if ($digesttime < $timenow) {
|
||||
// Digest time is in the past. set for tomorrow.
|
||||
$servermidnight = usergetmidnight($timenow + DAYSECS, $sitetimezone);
|
||||
}
|
||||
|
||||
$customdata = json_encode(['servermidnight' => $servermidnight]);
|
||||
|
||||
$params = [
|
||||
'component' => 'mod_forum',
|
||||
'classname' => '\mod_forum\task\send_user_digests',
|
||||
'customdata' => '', // We do not want to overwrite any tasks that already have the custom data.
|
||||
];
|
||||
|
||||
$textfield = $DB->sql_compare_text('customdata', 1);
|
||||
|
||||
$sql = "component = :component AND classname = :classname AND $textfield = :customdata";
|
||||
|
||||
$DB->set_field_select('task_adhoc', 'customdata', $customdata, $sql, $params);
|
||||
|
||||
upgrade_mod_savepoint(true, 2021101100, 'forum');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021101101) {
|
||||
// Remove the userid-forumid index as it gets replaces with forumid-userid.
|
||||
$table = new xmldb_table('forum_read');
|
||||
$index = new xmldb_index('userid-forumid', XMLDB_INDEX_NOTUNIQUE, ['userid', 'forumid']);
|
||||
|
||||
// Conditionally launch drop index userid-forumid.
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
// Remove the userid-discussionid index as it gets replaced with discussionid-userid.
|
||||
$table = new xmldb_table('forum_read');
|
||||
$index = new xmldb_index('userid-discussionid', XMLDB_INDEX_NOTUNIQUE, ['userid', 'discussionid']);
|
||||
|
||||
// Conditionally launch drop index userid-discussionid.
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index userid (not unique) to be added to forum_read.
|
||||
$table = new xmldb_table('forum_read');
|
||||
$index = new xmldb_index('userid', XMLDB_INDEX_NOTUNIQUE, ['userid']);
|
||||
|
||||
// Conditionally launch add index userid.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Build replacement indexes to replace the two dropped earlier.
|
||||
// Define index forumid-userid (not unique) to be added to forum_read.
|
||||
$table = new xmldb_table('forum_read');
|
||||
$index = new xmldb_index('forumid-userid', XMLDB_INDEX_NOTUNIQUE, ['forumid', 'userid']);
|
||||
|
||||
// Conditionally launch add index forumid-userid.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index discussionid-userid (not unique) to be added to forum_read.
|
||||
$table = new xmldb_table('forum_read');
|
||||
$index = new xmldb_index('discussionid-userid', XMLDB_INDEX_NOTUNIQUE, ['discussionid', 'userid']);
|
||||
|
||||
// Conditionally launch add index discussionid-userid.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Forum savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2021101101, 'forum');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2022062700) {
|
||||
// Unset $CFG->forum_usecoursefullname.
|
||||
unset_config('forum_usecoursefullname');
|
||||
|
||||
// Define field usecoursefullname to be dropped from forum.
|
||||
$table = new xmldb_table('forum');
|
||||
$field = new xmldb_field('usecoursefullname');
|
||||
|
||||
// Conditionally launch drop field usecoursefullname.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
// Forum savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2022062700, 'forum');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022072900) {
|
||||
// Define key usermodified (foreign) to be added to forum_discussions.
|
||||
$table = new xmldb_table('forum_discussions');
|
||||
$key = new xmldb_key('usermodified', XMLDB_KEY_FOREIGN, ['usermodified'], 'user', ['id']);
|
||||
// Launch add key usermodified.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Forum savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2022072900, 'forum');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -20,14 +20,6 @@
|
||||
// before any action that may take longer time to finish.
|
||||
|
||||
function xmldb_glossary_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -49,203 +49,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_h5pactivity_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
if ($oldversion < 2020032300) {
|
||||
|
||||
// Changing the default of field timecreated on table h5pactivity to drop it.
|
||||
$table = new xmldb_table('h5pactivity');
|
||||
$field = new xmldb_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'name');
|
||||
|
||||
// Launch change of default for field timecreated.
|
||||
$dbman->change_field_default($table, $field);
|
||||
|
||||
// Changing the default of field timemodified on table h5pactivity to drop it.
|
||||
$field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'timecreated');
|
||||
|
||||
// Launch change of default for field timemodified.
|
||||
$dbman->change_field_default($table, $field);
|
||||
|
||||
// Define table h5pactivity_attempts to be created.
|
||||
$table = new xmldb_table('h5pactivity_attempts');
|
||||
|
||||
// Adding fields to table h5pactivity_attempts.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('h5pactivityid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('userid', XMLDB_TYPE_INTEGER, '20', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('attempt', XMLDB_TYPE_INTEGER, '6', null, XMLDB_NOTNULL, null, '1');
|
||||
$table->add_field('rawscore', XMLDB_TYPE_INTEGER, '10', null, null, null, '0');
|
||||
$table->add_field('maxscore', XMLDB_TYPE_INTEGER, '10', null, null, null, '0');
|
||||
|
||||
// Adding keys to table h5pactivity_attempts.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('fk_h5pactivityid', XMLDB_KEY_FOREIGN, ['h5pactivityid'], 'h5pactivity', ['id']);
|
||||
$table->add_key('uq_activityuserattempt', XMLDB_KEY_UNIQUE, ['h5pactivityid', 'userid', 'attempt']);
|
||||
|
||||
// Adding indexes to table h5pactivity_attempts.
|
||||
$table->add_index('timecreated', XMLDB_INDEX_NOTUNIQUE, ['timecreated']);
|
||||
$table->add_index('h5pactivityid-timecreated', XMLDB_INDEX_NOTUNIQUE, ['h5pactivityid', 'timecreated']);
|
||||
$table->add_index('h5pactivityid-userid', XMLDB_INDEX_NOTUNIQUE, ['h5pactivityid', 'userid']);
|
||||
|
||||
// Conditionally launch create table for h5pactivity_attempts.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define table h5pactivity_attempts_results to be created.
|
||||
$table = new xmldb_table('h5pactivity_attempts_results');
|
||||
|
||||
// Adding fields to table h5pactivity_attempts_results.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('attemptid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('subcontent', XMLDB_TYPE_CHAR, '128', null, null, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('interactiontype', XMLDB_TYPE_CHAR, '128', null, null, null, null);
|
||||
$table->add_field('description', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
$table->add_field('correctpattern', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
$table->add_field('response', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('additionals', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
$table->add_field('rawscore', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('maxscore', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
|
||||
// Adding keys to table h5pactivity_attempts_results.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('fk_attemptid', XMLDB_KEY_FOREIGN, ['attemptid'], 'h5pactivity_attempts', ['id']);
|
||||
|
||||
// Adding indexes to table h5pactivity_attempts_results.
|
||||
$table->add_index('attemptid-timecreated', XMLDB_INDEX_NOTUNIQUE, ['attemptid', 'timecreated']);
|
||||
|
||||
// Conditionally launch create table for h5pactivity_attempts_results.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// H5pactivity savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2020032300, 'h5pactivity');
|
||||
}
|
||||
|
||||
if ($oldversion < 2020041400) {
|
||||
|
||||
// Define field duration to be added to h5pactivity_attempts.
|
||||
$table = new xmldb_table('h5pactivity_attempts');
|
||||
$field = new xmldb_field('duration', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', 'maxscore');
|
||||
|
||||
// Conditionally launch add field duration.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field completion to be added to h5pactivity_attempts.
|
||||
$field = new xmldb_field('completion', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'duration');
|
||||
|
||||
// Conditionally launch add field completion.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field success to be added to h5pactivity_attempts.
|
||||
$field = new xmldb_field('success', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'completion');
|
||||
|
||||
// Conditionally launch add field success.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field duration to be added to h5pactivity_attempts_results.
|
||||
$table = new xmldb_table('h5pactivity_attempts_results');
|
||||
$field = new xmldb_field('duration', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', 'maxscore');
|
||||
|
||||
// Conditionally launch add field duration.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field completion to be added to h5pactivity_attempts_results.
|
||||
$field = new xmldb_field('completion', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'duration');
|
||||
|
||||
// Conditionally launch add field completion.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field success to be added to h5pactivity_attempts_results.
|
||||
$field = new xmldb_field('success', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'completion');
|
||||
|
||||
// Conditionally launch add field success.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// H5pactivity savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2020041400, 'h5pactivity');
|
||||
}
|
||||
|
||||
if ($oldversion < 2020041401) {
|
||||
|
||||
// Define field enabletracking to be added to h5pactivity.
|
||||
$table = new xmldb_table('h5pactivity');
|
||||
$field = new xmldb_field('enabletracking', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1', 'displayoptions');
|
||||
|
||||
// Conditionally launch add field enabletracking.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field grademethod to be added to h5pactivity.
|
||||
$field = new xmldb_field('grademethod', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '1', 'enabletracking');
|
||||
|
||||
// Conditionally launch add field grademethod.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field scaled to be added to h5pactivity_attempts.
|
||||
$table = new xmldb_table('h5pactivity_attempts');
|
||||
$field = new xmldb_field('scaled', XMLDB_TYPE_NUMBER, '10, 5', null, XMLDB_NOTNULL, null, '0', 'maxscore');
|
||||
|
||||
// Conditionally launch add field scaled.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Calculate all scaled values from current attempts.
|
||||
$rs = $DB->get_recordset('h5pactivity_attempts');
|
||||
foreach ($rs as $record) {
|
||||
if (empty($record->maxscore)) {
|
||||
continue;
|
||||
}
|
||||
$record->scaled = $record->rawscore / $record->maxscore;
|
||||
$DB->update_record('h5pactivity_attempts', $record);
|
||||
}
|
||||
$rs->close();
|
||||
|
||||
// H5pactivity savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2020041401, 'h5pactivity');
|
||||
}
|
||||
|
||||
if ($oldversion < 2020042202) {
|
||||
|
||||
// Define field reviewmode to be added to h5pactivity.
|
||||
$table = new xmldb_table('h5pactivity');
|
||||
$field = new xmldb_field('reviewmode', XMLDB_TYPE_INTEGER, '4', null, null, null, '1', 'grademethod');
|
||||
|
||||
// Conditionally launch add field reviewmode.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// H5pactivity savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2020042202, 'h5pactivity');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,14 +29,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param int $oldversion
|
||||
*/
|
||||
function xmldb_imscp_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -47,25 +47,6 @@ defined('MOODLE_INTERNAL') || die;
|
||||
function xmldb_label_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2022101300) {
|
||||
$module = $DB->get_field('modules', 'id', ['name' => 'label']);
|
||||
$DB->execute('
|
||||
UPDATE {course_modules}
|
||||
SET visible = 0, visibleoncoursepage = 1
|
||||
WHERE module = :module
|
||||
AND visible = 1
|
||||
AND visibleoncoursepage = 0',
|
||||
['module' => $module]
|
||||
);
|
||||
upgrade_mod_savepoint(true, 2022101300, 'label');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -50,14 +50,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_lesson_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -63,51 +63,6 @@ function xmldb_lti_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021052501) {
|
||||
|
||||
// Changing type of field instructorcustomparameters on table lti to text.
|
||||
$table = new xmldb_table('lti');
|
||||
$field = new xmldb_field('instructorcustomparameters', XMLDB_TYPE_TEXT, null, null, null, null, null,
|
||||
'instructorchoiceallowsetting');
|
||||
|
||||
// Launch change of type for field value.
|
||||
$dbman->change_field_type($table, $field);
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2021052501, 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022032900) {
|
||||
// This option 'Public key type' was added in MDL-66920, but no value was set for existing 1.3 tools.
|
||||
// Set a default of 'RSA Key' for those LTI 1.3 tools without a value, representing the only key type they
|
||||
// could use at the time of their creation. Existing tools which have since been resaved will not be impacted.
|
||||
$sql = "SELECT t.id
|
||||
FROM {lti_types} t
|
||||
LEFT JOIN {lti_types_config} tc
|
||||
ON (tc.typeid = t.id AND tc.name = :typename)
|
||||
WHERE t.ltiversion = :ltiversion
|
||||
AND tc.value IS NULL";
|
||||
$params = ['typename' => 'keytype', 'ltiversion' => '1.3.0'];
|
||||
$recordset = $DB->get_recordset_sql($sql, $params);
|
||||
foreach ($recordset as $record) {
|
||||
$DB->insert_record('lti_types_config', (object) [
|
||||
'typeid' => $record->id,
|
||||
'name' => 'keytype',
|
||||
'value' => 'RSA_KEY'
|
||||
]);
|
||||
}
|
||||
$recordset->close();
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2022032900, 'lti');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -55,79 +55,6 @@
|
||||
* @return boolean
|
||||
*/
|
||||
function xmldb_ltiservice_gradebookservices_upgrade($oldversion) {
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2020042401) {
|
||||
// Define field typeid to be added to lti_tool_settings.
|
||||
$table = new xmldb_table('ltiservice_gradebookservices');
|
||||
$field = new xmldb_field('resourceid', XMLDB_TYPE_CHAR, "512", null, null, null, null);
|
||||
|
||||
// Conditionally launch add field typeid.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2020042401, 'ltiservice', 'gradebookservices');
|
||||
}
|
||||
|
||||
if ($oldversion < 2020042402) {
|
||||
// Now that we have added the new column let's migrate it'
|
||||
// Prior implementation was storing the resourceid under the grade item idnumber, so moving it to lti_gradebookservices.
|
||||
// We only care for mod/lti grade items as manual columns would already have a matching gradebookservices record.
|
||||
|
||||
$DB->execute("INSERT INTO {ltiservice_gradebookservices}
|
||||
(gradeitemid, courseid, typeid, ltilinkid, resourceid, baseurl, toolproxyid)
|
||||
SELECT gi.id, courseid, lti.typeid, lti.id, gi.idnumber, t.baseurl, t.toolproxyid
|
||||
FROM {grade_items} gi
|
||||
JOIN {lti} lti ON lti.id=gi.iteminstance AND gi.itemtype='mod' AND gi.itemmodule='lti'
|
||||
JOIN {lti_types} t ON t.id = lti.typeid
|
||||
WHERE gi.id NOT IN ( SELECT gradeitemid
|
||||
FROM {ltiservice_gradebookservices} )
|
||||
AND gi.idnumber IS NOT NULL
|
||||
AND gi.idnumber <> ''");
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2020042402, 'ltiservice', 'gradebookservices');
|
||||
}
|
||||
|
||||
if ($oldversion < 2020042403) {
|
||||
// Here updating the resourceid of pre-existing lti_gradebookservices.
|
||||
$DB->execute("UPDATE {ltiservice_gradebookservices}
|
||||
SET resourceid = (SELECT idnumber FROM {grade_items} WHERE id=gradeitemid)
|
||||
WHERE gradeitemid in (SELECT id FROM {grade_items}
|
||||
WHERE ((itemtype='mod' AND itemmodule='lti') OR itemtype='manual')
|
||||
AND idnumber IS NOT NULL
|
||||
AND idnumber <> '')
|
||||
AND (resourceid is null OR resourceid = '')");
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2020042403, 'ltiservice', 'gradebookservices');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2022051900) {
|
||||
$table = new xmldb_table('ltiservice_gradebookservices');
|
||||
$field = new xmldb_field('subreviewurl', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
$field = new xmldb_field('subreviewparams', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2022051900, 'ltiservice', 'gradebookservices');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -45,14 +45,6 @@
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
function xmldb_page_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -34,15 +34,6 @@ require_once($CFG->dirroot . '/mod/quiz/accessrule/seb/lib.php');
|
||||
* @return bool Result.
|
||||
*/
|
||||
function xmldb_quizaccess_seb_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,134 +31,6 @@ function xmldb_quiz_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2020061501) {
|
||||
|
||||
// Define field completionminattempts to be added to quiz.
|
||||
$table = new xmldb_table('quiz');
|
||||
$field = new xmldb_field('completionminattempts', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0',
|
||||
'completionpass');
|
||||
|
||||
// Conditionally launch add field completionminattempts.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2020061501, 'quiz');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021052503) {
|
||||
$table = new xmldb_table('quiz');
|
||||
$field = new xmldb_field('completionpass');
|
||||
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$sql = "SELECT q.id, m.id as quizid " .
|
||||
"FROM {quiz} q " .
|
||||
"INNER JOIN {course_modules} cm ON cm.instance = q.id " .
|
||||
"INNER JOIN {modules} m ON m.id = cm.module " .
|
||||
"WHERE m.name = :name AND q.completionpass = :completionpass";
|
||||
|
||||
/** @var moodle_recordset $records */
|
||||
$records = $DB->get_recordset_sql($sql, ['name' => 'quiz', 'completionpass' => 1], 0, 1000);
|
||||
while ($records->valid()) {
|
||||
$quizmodule = null;
|
||||
foreach ($records as $record) {
|
||||
$ids[] = $record->id;
|
||||
$quizmodule = $record->quizid;
|
||||
}
|
||||
|
||||
if ($ids) {
|
||||
list($insql, $params) = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED);
|
||||
$DB->set_field_select('course_modules', 'completionpassgrade', 1,
|
||||
"module = :quiz AND instance $insql", $params + ['quiz' => $quizmodule]);
|
||||
|
||||
// Reset the value so it doesn't get picked on the next run. The field will be dropped later.
|
||||
$DB->set_field_select('quiz', 'completionpass', 0, "id $insql", $params);
|
||||
|
||||
// Get the next batch of records.
|
||||
$records = $DB->get_recordset_sql($sql, ['name' => 'quiz', 'completionpass' => 1], 0, 1000);
|
||||
}
|
||||
}
|
||||
$records->close();
|
||||
|
||||
// We have completed our checks. Drop the field.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
}
|
||||
|
||||
upgrade_mod_savepoint(true, 2021052503, 'quiz');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021101900) {
|
||||
|
||||
// Define field gradednotificationsenttime to be added to quiz_attempts.
|
||||
$table = new xmldb_table('quiz_attempts');
|
||||
$field = new xmldb_field('gradednotificationsenttime', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'sumgrades');
|
||||
|
||||
// Conditionally launch add field gradednotificationsenttime.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
|
||||
$DB->execute('UPDATE {quiz_attempts} SET gradednotificationsenttime = timefinish');
|
||||
}
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2021101900, 'quiz');
|
||||
}
|
||||
|
||||
if ($oldversion < 2022020300) {
|
||||
// Define table quiz_slot_tags to be dropped.
|
||||
$table = new xmldb_table('quiz_slot_tags');
|
||||
|
||||
// Conditionally launch drop table for quiz_slot_tags.
|
||||
if ($dbman->table_exists($table)) {
|
||||
$dbman->drop_table($table);
|
||||
}
|
||||
|
||||
// Define fields to be dropped from quiz_slots.
|
||||
$table = new xmldb_table('quiz_slots');
|
||||
|
||||
// Define key questionid (foreign) to be dropped form quiz_slots.
|
||||
$key = new xmldb_key('questionid', XMLDB_KEY_FOREIGN, ['questionid'], 'question', ['id']);
|
||||
|
||||
// Launch drop key questionid.
|
||||
$dbman->drop_key($table, $key);
|
||||
|
||||
// Define key questioncategoryid (foreign) to be dropped form quiz_slots.
|
||||
$key = new xmldb_key('questioncategoryid', XMLDB_KEY_FOREIGN, ['questioncategoryid'], 'question_categories', ['id']);
|
||||
|
||||
// Launch drop key questioncategoryid.
|
||||
$dbman->drop_key($table, $key);
|
||||
|
||||
$field = new xmldb_field('questionid');
|
||||
// Conditionally launch drop field questionid.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('questioncategoryid');
|
||||
// Conditionally launch drop field questioncategoryid.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('includingsubcategories');
|
||||
// Conditionally launch drop field includingsubcategories.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2022020300, 'quiz');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,14 +29,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param number $oldversion
|
||||
*/
|
||||
function xmldb_quiz_overview_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,14 +28,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* Quiz statistics report upgrade code.
|
||||
*/
|
||||
function xmldb_quiz_statistics_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -45,14 +45,6 @@
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
function xmldb_resource_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -34,21 +34,6 @@ function xmldb_scorm_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021052501) {
|
||||
$table = new xmldb_table('scorm');
|
||||
$field = new xmldb_field('displayactivityname');
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
upgrade_mod_savepoint(true, 2021052501, 'scorm');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -22,14 +22,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_survey_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -45,14 +45,6 @@
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
function xmldb_url_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -38,14 +38,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_wiki_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -35,29 +35,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_workshop_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021052501) {
|
||||
|
||||
// Changing nullability of field grade on table workshop_grades to null.
|
||||
$table = new xmldb_table('workshop_grades');
|
||||
$field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, 'dimensionid');
|
||||
|
||||
// Launch change of nullability for field grade.
|
||||
$dbman->change_field_notnull($table, $field);
|
||||
|
||||
// Workshop savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2021052501, 'workshop');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,14 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool true
|
||||
*/
|
||||
function xmldb_workshopform_accumulative_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,14 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool true
|
||||
*/
|
||||
function xmldb_workshopform_comments_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user