MDL-69308 upgrade: remove all the < 3.6.0 upgrade steps
This just deletes all the upgrade steps previous to 3.6.0. Some small adjustments, like tweaking globals can also be applied when needed. Also includes an upgrade step to prevent upgrading from any version < 2018120300 (v3.6.0) as anti-cheating measure. Note that in this case, there wasn't any case of upgradelib functions being used, hence we haven't to deprecate/remove anything in codebase. When there is such a need, that is done in separate commits (one for each function) and documented here. See MDL-65809 commits for an example removing/deprecating a good number of functions.
This commit is contained in:
@@ -29,9 +29,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_tool_customlang_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -35,284 +35,6 @@ function xmldb_tool_dataprivacy_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2018051405) {
|
||||
// Define table tool_dataprivacy_ctxexpired to be created.
|
||||
$table = new xmldb_table('tool_dataprivacy_ctxexpired');
|
||||
|
||||
// Adding fields to table tool_dataprivacy_ctxexpired.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('status', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('usermodified', 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 tool_dataprivacy_ctxexpired.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$table->add_key('contextid', XMLDB_KEY_FOREIGN_UNIQUE, array('contextid'), 'context', array('id'));
|
||||
|
||||
// Conditionally launch create table for tool_dataprivacy_ctxexpired.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define table tool_dataprivacy_contextlist to be created.
|
||||
$table = new xmldb_table('tool_dataprivacy_contextlist');
|
||||
|
||||
// Adding fields to table tool_dataprivacy_contextlist.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('component', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timecreated', 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 tool_dataprivacy_contextlist.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
|
||||
// Conditionally launch create table for tool_dataprivacy_contextlist.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define table tool_dataprivacy_ctxlst_ctx to be created.
|
||||
$table = new xmldb_table('tool_dataprivacy_ctxlst_ctx');
|
||||
|
||||
// Adding fields to table tool_dataprivacy_ctxlst_ctx.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('contextlistid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('status', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('timecreated', 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 tool_dataprivacy_ctxlst_ctx.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$table->add_key('contextlistid', XMLDB_KEY_FOREIGN, array('contextlistid'), 'tool_dataprivacy_contextlist', array('id'));
|
||||
|
||||
// Conditionally launch create table for tool_dataprivacy_ctxlst_ctx.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define table tool_dataprivacy_rqst_ctxlst to be created.
|
||||
$table = new xmldb_table('tool_dataprivacy_rqst_ctxlst');
|
||||
|
||||
// Adding fields to table tool_dataprivacy_rqst_ctxlst.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('requestid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('contextlistid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table tool_dataprivacy_rqst_ctxlst.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$table->add_key('requestid', XMLDB_KEY_FOREIGN, array('requestid'), 'tool_dataprivacy_request', array('id'));
|
||||
$table->add_key('contextlistid', XMLDB_KEY_FOREIGN, array('contextlistid'), 'tool_dataprivacy_contextlist', array('id'));
|
||||
$table->add_key('request_contextlist', XMLDB_KEY_UNIQUE, array('requestid', 'contextlistid'));
|
||||
|
||||
// Conditionally launch create table for tool_dataprivacy_rqst_ctxlst.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define field lawfulbases to be added to tool_dataprivacy_purpose.
|
||||
$table = new xmldb_table('tool_dataprivacy_purpose');
|
||||
|
||||
// It is a required field. We initially define and add it as null and later update it to XMLDB_NOTNULL.
|
||||
$field = new xmldb_field('lawfulbases', XMLDB_TYPE_TEXT, null, null, null, null, null, 'descriptionformat');
|
||||
|
||||
// Conditionally launch add field lawfulbases.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
|
||||
// Set a kind-of-random value to lawfulbasis field.
|
||||
$DB->set_field('tool_dataprivacy_purpose', 'lawfulbases', 'gdpr_art_6_1_a');
|
||||
|
||||
// We redefine it now as not null.
|
||||
$field = new xmldb_field('lawfulbases', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null, 'descriptionformat');
|
||||
|
||||
// Launch change of nullability for field lawfulbases.
|
||||
$dbman->change_field_notnull($table, $field);
|
||||
}
|
||||
|
||||
// Define field sensitivedatareasons to be added to tool_dataprivacy_purpose.
|
||||
$table = new xmldb_table('tool_dataprivacy_purpose');
|
||||
$field = new xmldb_field('sensitivedatareasons', XMLDB_TYPE_TEXT, null, null, null, null, null, 'lawfulbases');
|
||||
|
||||
// Conditionally launch add field sensitivedatareasons.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Dataprivacy savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018051405, 'tool', 'dataprivacy');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018051406) {
|
||||
// Update completed delete requests to new delete status.
|
||||
$query = "UPDATE {tool_dataprivacy_request}
|
||||
SET status = :setstatus
|
||||
WHERE type = :type
|
||||
AND status = :wherestatus";
|
||||
$params = array(
|
||||
'setstatus' => 10, // Request deleted.
|
||||
'type' => 2, // Delete type.
|
||||
'wherestatus' => 5, // Request completed.
|
||||
);
|
||||
|
||||
$DB->execute($query, $params);
|
||||
|
||||
// Update completed data export requests to new download ready status.
|
||||
$params = array(
|
||||
'setstatus' => 8, // Request download ready.
|
||||
'type' => 1, // export type.
|
||||
'wherestatus' => 5, // Request completed.
|
||||
);
|
||||
|
||||
$DB->execute($query, $params);
|
||||
|
||||
upgrade_plugin_savepoint(true, 2018051406, 'tool', 'dataprivacy');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018082100) {
|
||||
|
||||
// Changing precision of field status on table tool_dataprivacy_request to (2).
|
||||
$table = new xmldb_table('tool_dataprivacy_request');
|
||||
$field = new xmldb_field('status', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'requestedby');
|
||||
|
||||
// Launch change of precision for field status.
|
||||
$dbman->change_field_precision($table, $field);
|
||||
|
||||
// Dataprivacy savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018082100, 'tool', 'dataprivacy');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018100401) {
|
||||
// Define table tool_dataprivacy_purposerole to be created.
|
||||
$table = new xmldb_table('tool_dataprivacy_purposerole');
|
||||
|
||||
// Adding fields to table tool_dataprivacy_purposerole.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('purposeid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('roleid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('lawfulbases', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
$table->add_field('sensitivedatareasons', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
$table->add_field('retentionperiod', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('protected', XMLDB_TYPE_INTEGER, '1', null, null, null, null);
|
||||
$table->add_field('usermodified', 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 tool_dataprivacy_purposerole.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('purposepurposeid', XMLDB_KEY_FOREIGN, ['purposeid'], 'tool_dataprivacy_purpose', ['id']);
|
||||
$table->add_key('puproseroleid', XMLDB_KEY_FOREIGN, ['roleid'], 'role', ['id']);
|
||||
|
||||
// Adding indexes to table tool_dataprivacy_purposerole.
|
||||
$table->add_index('purposerole', XMLDB_INDEX_UNIQUE, ['purposeid', 'roleid']);
|
||||
|
||||
// Conditionally launch create table for tool_dataprivacy_purposerole.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Update the ctxexpired table.
|
||||
$table = new xmldb_table('tool_dataprivacy_ctxexpired');
|
||||
|
||||
// Add the unexpiredroles field.
|
||||
$field = new xmldb_field('unexpiredroles', XMLDB_TYPE_TEXT, null, null, null, null, null, 'contextid');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
$DB->set_field('tool_dataprivacy_ctxexpired', 'unexpiredroles', '');
|
||||
|
||||
// Add the expiredroles field.
|
||||
$field = new xmldb_field('expiredroles', XMLDB_TYPE_TEXT, null, null, null, null, null, 'unexpiredroles');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
$DB->set_field('tool_dataprivacy_ctxexpired', 'expiredroles', '');
|
||||
|
||||
// Add the defaultexpired field.
|
||||
$field = new xmldb_field('defaultexpired', XMLDB_TYPE_INTEGER, '1', null, null, null, '1', 'expiredroles');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Change the default for the expired field to be empty.
|
||||
$field = new xmldb_field('defaultexpired', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'expiredroles');
|
||||
$dbman->change_field_default($table, $field);
|
||||
|
||||
// Prevent hte field from being nullable.
|
||||
$field = new xmldb_field('defaultexpired', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null, 'expiredroles');
|
||||
$dbman->change_field_notnull($table, $field);
|
||||
|
||||
// Dataprivacy savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018100401, 'tool', 'dataprivacy');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018100406) {
|
||||
// Define field sensitivedatareasons to be added to tool_dataprivacy_purpose.
|
||||
$table = new xmldb_table('tool_dataprivacy_request');
|
||||
$field = new xmldb_field('creationmethod', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, 0, 'timemodified');
|
||||
|
||||
// Conditionally launch add field sensitivedatareasons.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Dataprivacy savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018100406, 'tool', 'dataprivacy');
|
||||
}
|
||||
|
||||
|
||||
if ($oldversion < 2018110700) {
|
||||
// Define table tool_dataprivacy_ctxlst_ctx to be dropped.
|
||||
$table = new xmldb_table('tool_dataprivacy_ctxlst_ctx');
|
||||
|
||||
// Conditionally launch drop table for tool_dataprivacy_ctxlst_ctx.
|
||||
if ($dbman->table_exists($table)) {
|
||||
$dbman->drop_table($table);
|
||||
}
|
||||
|
||||
// Define table tool_dataprivacy_rqst_ctxlst to be dropped.
|
||||
$table = new xmldb_table('tool_dataprivacy_rqst_ctxlst');
|
||||
|
||||
// Conditionally launch drop table for tool_dataprivacy_rqst_ctxlst.
|
||||
if ($dbman->table_exists($table)) {
|
||||
$dbman->drop_table($table);
|
||||
}
|
||||
|
||||
// Define table tool_dataprivacy_contextlist to be dropped.
|
||||
$table = new xmldb_table('tool_dataprivacy_contextlist');
|
||||
|
||||
// Conditionally launch drop table for tool_dataprivacy_contextlist.
|
||||
if ($dbman->table_exists($table)) {
|
||||
$dbman->drop_table($table);
|
||||
}
|
||||
|
||||
// Update all requests which were in states Pending, or Pre-Processing, to Awaiting approval.
|
||||
$DB->set_field('tool_dataprivacy_request', 'status', 2, ['status' => 0]);
|
||||
$DB->set_field('tool_dataprivacy_request', 'status', 2, ['status' => 1]);
|
||||
|
||||
// Remove the old initiate_data_request_task adhoc entries.
|
||||
$DB->delete_records('task_adhoc', ['classname' => '\tool_dataprivacy\task\initiate_data_request_task']);
|
||||
|
||||
// Dataprivacy savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018110700, 'tool', 'dataprivacy');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018112500) {
|
||||
// Delete orphaned data privacy requests.
|
||||
$sql = "SELECT r.id
|
||||
FROM {tool_dataprivacy_request} r LEFT JOIN {user} u ON r.userid = u.id
|
||||
WHERE u.id IS NULL";
|
||||
$orphaned = $DB->get_fieldset_sql($sql);
|
||||
|
||||
if ($orphaned) {
|
||||
$DB->delete_records_list('tool_dataprivacy_request', 'id', $orphaned);
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2018112500, 'tool', 'dataprivacy');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_tool_log_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_logstore_database_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_logstore_standard_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_tool_monitor_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -34,32 +34,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_tool_policy_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2018082900) {
|
||||
// Add field agreementstyle to the table tool_policy_versions.
|
||||
$table = new xmldb_table('tool_policy_versions');
|
||||
$field = new xmldb_field('agreementstyle', XMLDB_TYPE_INTEGER, '3', null, XMLDB_NOTNULL, null, '0', 'policyid');
|
||||
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2018082900, 'tool', 'policy');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018091800) {
|
||||
// Add field "optional" to the table "tool_policy_versions".
|
||||
$table = new xmldb_table('tool_policy_versions');
|
||||
$field = new xmldb_field('optional', XMLDB_TYPE_INTEGER, '3', null, XMLDB_NOTNULL, null, '0', 'agreementstyle');
|
||||
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2018091800, 'tool', 'policy');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -36,9 +36,6 @@ use tool_usertours\tour;
|
||||
function xmldb_tool_usertours_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_auth_cas_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_auth_db_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_auth_email_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_auth_ldap_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_auth_manual_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_auth_mnet_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_auth_none_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -35,9 +35,6 @@ function xmldb_auth_oauth2_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_auth_shibboleth_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -45,9 +45,6 @@
|
||||
function xmldb_block_badges_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -45,9 +45,6 @@
|
||||
function xmldb_block_calendar_month_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -45,9 +45,6 @@
|
||||
function xmldb_block_calendar_upcoming_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -48,9 +48,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_completionstatus_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -48,9 +48,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_course_summary_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_html_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -55,9 +55,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_navigation_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -45,9 +45,6 @@
|
||||
function xmldb_block_quiz_results_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -47,9 +47,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_recent_activity_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_rss_client_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -49,9 +49,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_section_links_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -48,9 +48,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_selfcompletion_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -55,9 +55,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_settings_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_format_topics_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_format_weeks_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_database_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_flatfile_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_guest_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_imsenterprise_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -39,9 +39,6 @@
|
||||
function xmldb_enrol_lti_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_manual_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_mnet_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -45,90 +45,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_paypal_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2018053000) {
|
||||
|
||||
// Define field instanceid to be added to enrol_paypal.
|
||||
// For some reason, some Moodle instances that are upgraded from old versions do not have this field.
|
||||
$table = new xmldb_table('enrol_paypal');
|
||||
$field = new xmldb_field('instanceid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'userid');
|
||||
|
||||
// Conditionally launch add field instanceid.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Paypal savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018053000, 'enrol', 'paypal');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018062500) {
|
||||
|
||||
// Define key courseid (foreign) to be added to enrol_paypal.
|
||||
$table = new xmldb_table('enrol_paypal');
|
||||
$key = new xmldb_key('courseid', XMLDB_KEY_FOREIGN, array('courseid'), 'course', array('id'));
|
||||
|
||||
// Launch add key courseid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Paypal savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018062500, 'enrol', 'paypal');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018062501) {
|
||||
|
||||
// Define key userid (foreign) to be added to enrol_paypal.
|
||||
$table = new xmldb_table('enrol_paypal');
|
||||
$key = new xmldb_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
|
||||
|
||||
// Launch add key userid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Paypal savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018062501, 'enrol', 'paypal');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018062502) {
|
||||
|
||||
// Define key instanceid (foreign) to be added to enrol_paypal.
|
||||
$table = new xmldb_table('enrol_paypal');
|
||||
$key = new xmldb_key('instanceid', XMLDB_KEY_FOREIGN, array('instanceid'), 'enrol', array('id'));
|
||||
|
||||
// Launch add key instanceid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Paypal savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018062502, 'enrol', 'paypal');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018062503) {
|
||||
|
||||
$table = new xmldb_table('enrol_paypal');
|
||||
|
||||
// Define index business (not unique) to be added to enrol_paypal.
|
||||
$index = new xmldb_index('business', XMLDB_INDEX_NOTUNIQUE, array('business'));
|
||||
|
||||
// Conditionally launch add index business.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index receiver_email (not unique) to be added to enrol_paypal.
|
||||
$index = new xmldb_index('receiver_email', XMLDB_INDEX_NOTUNIQUE, array('receiver_email'));
|
||||
|
||||
// Conditionally launch add index receiver_email.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Paypal savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018062503, 'enrol', 'paypal');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_self_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,9 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_filter_mathjaxloader_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_filter_mediaplugin_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_filter_tex_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -37,9 +37,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_gradingform_guide_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_gradingform_rubric_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*/
|
||||
function xmldb_gradereport_overview_upgrade($oldversion) {
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,9 +29,6 @@
|
||||
function xmldb_gradereport_user_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*/
|
||||
function xmldb_antivirus_clamav_upgrade($oldversion) {
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
+4
-630
@@ -92,639 +92,13 @@ function xmldb_main_upgrade($oldversion) {
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
// Always keep this upgrade step with version being the minimum
|
||||
// allowed version to upgrade from (v3.5.0 right now).
|
||||
if ($oldversion < 2018051700) {
|
||||
// allowed version to upgrade from (v3.6.0 right now).
|
||||
if ($oldversion < 2018120300) {
|
||||
// Just in case somebody hacks upgrade scripts or env, we really can not continue.
|
||||
echo("You need to upgrade to 3.5.x or higher first!\n");
|
||||
echo("You need to upgrade to 3.6.x or higher first!\n");
|
||||
exit(1);
|
||||
// Note this savepoint is 100% unreachable, but needed to pass the upgrade checks.
|
||||
upgrade_main_savepoint(true, 2018051700);
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2018062800.01) {
|
||||
// Add foreign key fk_user to the comments table.
|
||||
$table = new xmldb_table('comments');
|
||||
$key = new xmldb_key('fk_user', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
upgrade_main_savepoint(true, 2018062800.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018062800.02) {
|
||||
// Add composite index ix_concomitem to the table comments.
|
||||
$table = new xmldb_table('comments');
|
||||
$index = new xmldb_index('ix_concomitem', XMLDB_INDEX_NOTUNIQUE, array('contextid', 'commentarea', 'itemid'));
|
||||
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2018062800.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018062800.03) {
|
||||
// Define field location to be added to event.
|
||||
$table = new xmldb_table('event');
|
||||
$field = new xmldb_field('location', XMLDB_TYPE_TEXT, null, null, null, null, null, 'priority');
|
||||
|
||||
// Conditionally launch add field location.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2018062800.03);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018072500.00) {
|
||||
// Find all duplicate top level categories per context.
|
||||
$duplicates = $DB->get_records_sql("SELECT qc1.*
|
||||
FROM {question_categories} qc1
|
||||
JOIN {question_categories} qc2
|
||||
ON qc1.contextid = qc2.contextid AND qc1.id <> qc2.id
|
||||
WHERE qc1.parent = 0 AND qc2.parent = 0
|
||||
ORDER BY qc1.contextid, qc1.id");
|
||||
|
||||
// For each context, let the first top category to remain as top category and make the rest its children.
|
||||
$currentcontextid = 0;
|
||||
$chosentopid = 0;
|
||||
foreach ($duplicates as $duplicate) {
|
||||
if ($currentcontextid != $duplicate->contextid) {
|
||||
$currentcontextid = $duplicate->contextid;
|
||||
$chosentopid = $duplicate->id;
|
||||
} else {
|
||||
$DB->set_field('question_categories', 'parent', $chosentopid, ['id' => $duplicate->id]);
|
||||
}
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2018072500.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018073000.00) {
|
||||
// Main savepoint reached.
|
||||
if (!file_exists($CFG->dirroot . '/admin/tool/assignmentupgrade/version.php')) {
|
||||
unset_all_config_for_plugin('tool_assignmentupgrade');
|
||||
}
|
||||
upgrade_main_savepoint(true, 2018073000.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018083100.01) {
|
||||
// Remove module associated blog posts for non-existent (deleted) modules.
|
||||
$sql = "SELECT ba.contextid as modcontextid
|
||||
FROM {blog_association} ba
|
||||
JOIN {post} p
|
||||
ON p.id = ba.blogid
|
||||
LEFT JOIN {context} c
|
||||
ON c.id = ba.contextid
|
||||
WHERE p.module = :module
|
||||
AND c.contextlevel IS NULL
|
||||
GROUP BY ba.contextid";
|
||||
if ($deletedmodules = $DB->get_records_sql($sql, array('module' => 'blog'))) {
|
||||
foreach ($deletedmodules as $module) {
|
||||
$assocblogids = $DB->get_fieldset_select('blog_association', 'blogid',
|
||||
'contextid = :contextid', ['contextid' => $module->modcontextid]);
|
||||
list($sql, $params) = $DB->get_in_or_equal($assocblogids, SQL_PARAMS_NAMED);
|
||||
|
||||
$DB->delete_records_select('tag_instance', "itemid $sql", $params);
|
||||
$DB->delete_records_select('post', "id $sql AND module = :module",
|
||||
array_merge($params, ['module' => 'blog']));
|
||||
$DB->delete_records('blog_association', ['contextid' => $module->modcontextid]);
|
||||
}
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2018083100.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018091200.00) {
|
||||
if (!file_exists($CFG->dirroot . '/cache/stores/memcache/settings.php')) {
|
||||
unset_all_config_for_plugin('cachestore_memcache');
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2018091200.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018091700.01) {
|
||||
// Remove unused setting.
|
||||
unset_config('messaginghidereadnotifications');
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2018091700.01);
|
||||
}
|
||||
|
||||
// Add idnumber fields to question and question_category tables.
|
||||
// This is done in four parts to aid error recovery during upgrade, should that occur.
|
||||
if ($oldversion < 2018092100.01) {
|
||||
$table = new xmldb_table('question');
|
||||
$field = new xmldb_field('idnumber', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'modifiedby');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
upgrade_main_savepoint(true, 2018092100.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018092100.02) {
|
||||
$table = new xmldb_table('question');
|
||||
$index = new xmldb_index('categoryidnumber', XMLDB_INDEX_UNIQUE, array('category', 'idnumber'));
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
upgrade_main_savepoint(true, 2018092100.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018092100.03) {
|
||||
$table = new xmldb_table('question_categories');
|
||||
$field = new xmldb_field('idnumber', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'sortorder');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
upgrade_main_savepoint(true, 2018092100.03);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018092100.04) {
|
||||
$table = new xmldb_table('question_categories');
|
||||
$index = new xmldb_index('contextididnumber', XMLDB_INDEX_UNIQUE, array('contextid', 'idnumber'));
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2018092100.04);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018092800.00) {
|
||||
// Alter the table 'message_contacts'.
|
||||
$table = new xmldb_table('message_contacts');
|
||||
|
||||
// Remove index so we can alter the fields.
|
||||
$index = new xmldb_index('userid-contactid', XMLDB_INDEX_UNIQUE, ['userid', 'contactid']);
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
// Remove defaults of '0' from the 'userid' and 'contactid' fields.
|
||||
$field = new xmldb_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'id');
|
||||
$dbman->change_field_default($table, $field);
|
||||
|
||||
$field = new xmldb_field('contactid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'userid');
|
||||
$dbman->change_field_default($table, $field);
|
||||
|
||||
// Add the missing FKs that will now be added to new installs.
|
||||
$key = new xmldb_key('userid', XMLDB_KEY_FOREIGN, ['userid'], 'user', ['id']);
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
$key = new xmldb_key('contactid', XMLDB_KEY_FOREIGN, ['contactid'], 'user', ['id']);
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Re-add the index.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Add the field 'timecreated'. Allow null, since existing records won't have an accurate value we can use.
|
||||
$field = new xmldb_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'blocked');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Create new 'message_contact_requests' table.
|
||||
$table = new xmldb_table('message_contact_requests');
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null);
|
||||
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'id');
|
||||
$table->add_field('requesteduserid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'userid');
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'requesteduserid');
|
||||
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id'], null, null);
|
||||
$table->add_key('userid', XMLDB_KEY_FOREIGN, ['userid'], 'user', ['id']);
|
||||
$table->add_key('requesteduserid', XMLDB_KEY_FOREIGN, ['requesteduserid'], 'user', ['id']);
|
||||
|
||||
$table->add_index('userid-requesteduserid', XMLDB_INDEX_UNIQUE, ['userid', 'requesteduserid']);
|
||||
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Create new 'message_users_blocked' table.
|
||||
$table = new xmldb_table('message_users_blocked');
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null);
|
||||
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'id');
|
||||
$table->add_field('blockeduserid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'userid');
|
||||
// Allow NULLs in the 'timecreated' field because we will be moving existing data here that has no timestamp.
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'blockeduserid');
|
||||
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id'], null, null);
|
||||
$table->add_key('userid', XMLDB_KEY_FOREIGN, ['userid'], 'user', ['id']);
|
||||
$table->add_key('blockeduserid', XMLDB_KEY_FOREIGN, ['blockeduserid'], 'user', ['id']);
|
||||
|
||||
$table->add_index('userid-blockeduserid', XMLDB_INDEX_UNIQUE, ['userid', 'blockeduserid']);
|
||||
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2018092800.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018092800.01) {
|
||||
// Move all the 'blocked' contacts to the new table 'message_users_blocked'.
|
||||
$updatesql = "INSERT INTO {message_users_blocked} (userid, blockeduserid, timecreated)
|
||||
SELECT userid, contactid, null as timecreated
|
||||
FROM {message_contacts}
|
||||
WHERE blocked = :blocked";
|
||||
$DB->execute($updatesql, ['blocked' => 1]);
|
||||
|
||||
// Removed the 'blocked' column from 'message_contacts'.
|
||||
$table = new xmldb_table('message_contacts');
|
||||
$field = new xmldb_field('blocked');
|
||||
$dbman->drop_field($table, $field);
|
||||
|
||||
upgrade_main_savepoint(true, 2018092800.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018092800.02) {
|
||||
// Delete any contacts that are not mutual (meaning they both haven't added each other).
|
||||
do {
|
||||
$sql = "SELECT c1.id
|
||||
FROM {message_contacts} c1
|
||||
LEFT JOIN {message_contacts} c2
|
||||
ON c1.userid = c2.contactid
|
||||
AND c1.contactid = c2.userid
|
||||
WHERE c2.id IS NULL";
|
||||
if ($contacts = $DB->get_records_sql($sql, null, 0, 1000)) {
|
||||
list($insql, $inparams) = $DB->get_in_or_equal(array_keys($contacts));
|
||||
$DB->delete_records_select('message_contacts', "id $insql", $inparams);
|
||||
}
|
||||
} while ($contacts);
|
||||
|
||||
upgrade_main_savepoint(true, 2018092800.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018092800.03) {
|
||||
// Remove any duplicate rows - from now on adding contacts just requires 1 row.
|
||||
// The person who made the contact request (userid) and the person who approved
|
||||
// it (contactid). Upgrade the table so that the first person to add the contact
|
||||
// was the one who made the request.
|
||||
$sql = "SELECT c1.id
|
||||
FROM {message_contacts} c1
|
||||
INNER JOIN {message_contacts} c2
|
||||
ON c1.userid = c2.contactid
|
||||
AND c1.contactid = c2.userid
|
||||
WHERE c1.id > c2.id";
|
||||
if ($contacts = $DB->get_records_sql($sql)) {
|
||||
list($insql, $inparams) = $DB->get_in_or_equal(array_keys($contacts));
|
||||
$DB->delete_records_select('message_contacts', "id $insql", $inparams);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2018092800.03);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018101700.01) {
|
||||
if (empty($CFG->keepmessagingallusersenabled)) {
|
||||
// When it is not set, $CFG->messagingallusers should be disabled by default.
|
||||
// When $CFG->messagingallusers = false, the default user preference is MESSAGE_PRIVACY_COURSEMEMBER
|
||||
// (contacted by users sharing a course).
|
||||
set_config('messagingallusers', false);
|
||||
} else {
|
||||
// When $CFG->keepmessagingallusersenabled is set to true, $CFG->messagingallusers is set to true.
|
||||
set_config('messagingallusers', true);
|
||||
|
||||
// When $CFG->messagingallusers = true, the default user preference is MESSAGE_PRIVACY_SITE
|
||||
// (contacted by all users site). So we need to set existing values from 0 (MESSAGE_PRIVACY_COURSEMEMBER)
|
||||
// to 2 (MESSAGE_PRIVACY_SITE).
|
||||
$DB->set_field(
|
||||
'user_preferences',
|
||||
'value',
|
||||
\core_message\api::MESSAGE_PRIVACY_SITE,
|
||||
array('name' => 'message_blocknoncontacts', 'value' => 0)
|
||||
);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2018101700.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018101800.00) {
|
||||
// Define table 'favourite' to be created.
|
||||
$table = new xmldb_table('favourite');
|
||||
|
||||
// Adding fields to table favourite.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('component', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('itemtype', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('itemid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('ordering', XMLDB_TYPE_INTEGER, '10', 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 favourite.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('contextid', XMLDB_KEY_FOREIGN, ['contextid'], 'context', ['id']);
|
||||
$table->add_key('userid', XMLDB_KEY_FOREIGN, ['userid'], 'user', ['id']);
|
||||
|
||||
// Adding indexes to table favourite.
|
||||
$table->add_index('uniqueuserfavouriteitem', XMLDB_INDEX_UNIQUE, ['component', 'itemtype', 'itemid', 'contextid', 'userid']);
|
||||
|
||||
// Conditionally launch create table for favourite.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2018101800.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018102200.00) {
|
||||
// Add field 'type' to 'message_conversations'.
|
||||
$table = new xmldb_table('message_conversations');
|
||||
$field = new xmldb_field('type', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, 1, 'id');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Add field 'name' to 'message_conversations'.
|
||||
$field = new xmldb_field('name', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'type');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Conditionally launch add index 'type'.
|
||||
$index = new xmldb_index('type', XMLDB_INDEX_NOTUNIQUE, ['type']);
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Define table 'message_conversations' to be updated.
|
||||
$table = new xmldb_table('message_conversations');
|
||||
|
||||
// Remove the unique 'convhash' index, change to null and add a new non unique index.
|
||||
$index = new xmldb_index('convhash', XMLDB_INDEX_UNIQUE, ['convhash']);
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('convhash', XMLDB_TYPE_CHAR, '40', null, null, null, null, 'name');
|
||||
$dbman->change_field_notnull($table, $field);
|
||||
|
||||
$index = new xmldb_index('convhash', XMLDB_INDEX_NOTUNIQUE, ['convhash']);
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2018102200.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018102300.02) {
|
||||
// Alter 'message_conversations' table to support groups.
|
||||
$table = new xmldb_table('message_conversations');
|
||||
$field = new xmldb_field('component', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'convhash');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('itemtype', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'component');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('itemid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'itemtype');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('contextid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'itemid');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('enabled', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 0, 'contextid');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'enabled');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Add key.
|
||||
$key = new xmldb_key('contextid', XMLDB_KEY_FOREIGN, ['contextid'], 'context', ['id']);
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Add index.
|
||||
$index = new xmldb_index('component-itemtype-itemid-contextid', XMLDB_INDEX_NOTUNIQUE, ['component', 'itemtype',
|
||||
'itemid', 'contextid']);
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2018102300.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018102900.00) {
|
||||
// Define field predictionsprocessor to be added to analytics_models.
|
||||
$table = new xmldb_table('analytics_models');
|
||||
$field = new xmldb_field('predictionsprocessor', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'timesplitting');
|
||||
|
||||
// Conditionally launch add field predictionsprocessor.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2018102900.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018110500.01) {
|
||||
// Define fields to be added to the 'badge' table.
|
||||
$tablebadge = new xmldb_table('badge');
|
||||
$fieldversion = new xmldb_field('version', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'nextcron');
|
||||
$fieldlanguage = new xmldb_field('language', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'version');
|
||||
$fieldimageauthorname = new xmldb_field('imageauthorname', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'language');
|
||||
$fieldimageauthoremail = new xmldb_field('imageauthoremail', XMLDB_TYPE_CHAR, '255', null, null,
|
||||
null, null, 'imageauthorname');
|
||||
$fieldimageauthorurl = new xmldb_field('imageauthorurl', XMLDB_TYPE_CHAR, '255', null, null,
|
||||
null, null, 'imageauthoremail');
|
||||
$fieldimagecaption = new xmldb_field('imagecaption', XMLDB_TYPE_TEXT, null, null, null, null, null, 'imageauthorurl');
|
||||
|
||||
if (!$dbman->field_exists($tablebadge, $fieldversion)) {
|
||||
$dbman->add_field($tablebadge, $fieldversion);
|
||||
}
|
||||
if (!$dbman->field_exists($tablebadge, $fieldlanguage)) {
|
||||
$dbman->add_field($tablebadge, $fieldlanguage);
|
||||
}
|
||||
if (!$dbman->field_exists($tablebadge, $fieldimageauthorname)) {
|
||||
$dbman->add_field($tablebadge, $fieldimageauthorname);
|
||||
}
|
||||
if (!$dbman->field_exists($tablebadge, $fieldimageauthoremail)) {
|
||||
$dbman->add_field($tablebadge, $fieldimageauthoremail);
|
||||
}
|
||||
if (!$dbman->field_exists($tablebadge, $fieldimageauthorurl)) {
|
||||
$dbman->add_field($tablebadge, $fieldimageauthorurl);
|
||||
}
|
||||
if (!$dbman->field_exists($tablebadge, $fieldimagecaption)) {
|
||||
$dbman->add_field($tablebadge, $fieldimagecaption);
|
||||
}
|
||||
|
||||
// Define table badge_endorsement to be created.
|
||||
$table = new xmldb_table('badge_endorsement');
|
||||
|
||||
// Adding fields to table badge_endorsement.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('badgeid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('issuername', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('issuerurl', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('issueremail', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('claimid', XMLDB_TYPE_CHAR, '255', null, null, null, null);
|
||||
$table->add_field('claimcomment', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
$table->add_field('dateissued', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
|
||||
// Adding keys to table badge_endorsement.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('endorsementbadge', XMLDB_KEY_FOREIGN, ['badgeid'], 'badge', ['id']);
|
||||
|
||||
// Conditionally launch create table for badge_endorsement.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define table badge_related to be created.
|
||||
$table = new xmldb_table('badge_related');
|
||||
|
||||
// Adding fields to table badge_related.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('badgeid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('relatedbadgeid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
|
||||
// Adding keys to table badge_related.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('badgeid', XMLDB_KEY_FOREIGN, ['badgeid'], 'badge', ['id']);
|
||||
$table->add_key('relatedbadgeid', XMLDB_KEY_FOREIGN, ['relatedbadgeid'], 'badge', ['id']);
|
||||
$table->add_key('badgeid-relatedbadgeid', XMLDB_KEY_UNIQUE, ['badgeid', 'relatedbadgeid']);
|
||||
|
||||
// Conditionally launch create table for badge_related.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define table badge_competencies to be created.
|
||||
$table = new xmldb_table('badge_competencies');
|
||||
|
||||
// Adding fields to table badge_competencies.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('badgeid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('targetname', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('targeturl', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('targetdescription', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
$table->add_field('targetframework', XMLDB_TYPE_CHAR, '255', null, null, null, null);
|
||||
$table->add_field('targetcode', XMLDB_TYPE_CHAR, '255', null, null, null, null);
|
||||
|
||||
// Adding keys to table badge_competencies.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('competenciesbadge', XMLDB_KEY_FOREIGN, ['badgeid'], 'badge', ['id']);
|
||||
|
||||
// Conditionally launch create table for badge_competencies.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2018110500.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018110700.01) {
|
||||
// This config setting added and then removed.
|
||||
unset_config('showcourseimages', 'moodlecourse');
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2018110700.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018111301.00) {
|
||||
// Define field locked to be added to context.
|
||||
$table = new xmldb_table('context');
|
||||
$field = new xmldb_field('locked', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'depth');
|
||||
|
||||
// Conditionally launch add field locked.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field locked to be added to context_temp.
|
||||
$table = new xmldb_table('context_temp');
|
||||
$field = new xmldb_field('locked', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'depth');
|
||||
|
||||
// Conditionally launch add field locked.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Note: This change also requires a bump in is_major_upgrade_required.
|
||||
upgrade_main_savepoint(true, 2018111301.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018111900.00) {
|
||||
// Update favourited courses, so they are saved in the particular course context instead of the system.
|
||||
$favouritedcourses = $DB->get_records('favourite', ['component' => 'core_course', 'itemtype' => 'courses']);
|
||||
|
||||
foreach ($favouritedcourses as $fc) {
|
||||
$coursecontext = \context_course::instance($fc->itemid);
|
||||
$fc->contextid = $coursecontext->id;
|
||||
$DB->update_record('favourite', $fc);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2018111900.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018111900.01) {
|
||||
// Define table oauth2_access_token to be created.
|
||||
$table = new xmldb_table('oauth2_access_token');
|
||||
|
||||
// Adding fields to table oauth2_access_token.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, 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('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('issuerid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('token', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('expires', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('scope', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table oauth2_access_token.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('issueridkey', XMLDB_KEY_FOREIGN_UNIQUE, ['issuerid'], 'oauth2_issuer', ['id']);
|
||||
|
||||
// Conditionally launch create table for oauth2_access_token.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2018111900.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2018112000.00) {
|
||||
// Update favourited conversations, so they are saved in the proper context instead of the system.
|
||||
$sql = "SELECT f.*, mc.contextid as conversationctx
|
||||
FROM {favourite} f
|
||||
JOIN {message_conversations} mc
|
||||
ON mc.id = f.itemid";
|
||||
$favouritedconversations = $DB->get_records_sql($sql);
|
||||
foreach ($favouritedconversations as $fc) {
|
||||
if (empty($fc->conversationctx)) {
|
||||
$conversationidctx = \context_user::instance($fc->userid)->id;
|
||||
} else {
|
||||
$conversationidctx = $fc->conversationctx;
|
||||
}
|
||||
|
||||
$DB->set_field('favourite', 'contextid', $conversationidctx, ['id' => $fc->id]);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2018112000.00);
|
||||
upgrade_main_savepoint(true, 2018120300);
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_editor_atto_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_atto_equation_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_editor_tinymce_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_tinymce_spellchecker_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -34,9 +34,6 @@ function xmldb_message_email_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_message_jabber_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_message_popup_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -34,9 +34,6 @@ function xmldb_assign_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_assignfeedback_comments_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -34,42 +34,6 @@ function xmldb_assignfeedback_editpdf_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2018051401) {
|
||||
$table = new xmldb_table('assignfeedback_editpdf_queue');
|
||||
$field = new xmldb_field('attemptedconversions', XMLDB_TYPE_INTEGER, '10', null,
|
||||
XMLDB_NOTNULL, null, 0, 'submissionattempt');
|
||||
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Attempts are removed from the queue after being processed, a duplicate row won't achieve anything productive.
|
||||
// So look for any duplicates and remove them so we can add a unique key.
|
||||
$sql = "SELECT MIN(id) as minid, submissionid, submissionattempt
|
||||
FROM {assignfeedback_editpdf_queue}
|
||||
GROUP BY submissionid, submissionattempt
|
||||
HAVING COUNT(id) > 1";
|
||||
|
||||
if ($duplicatedrows = $DB->get_recordset_sql($sql)) {
|
||||
foreach ($duplicatedrows as $row) {
|
||||
$DB->delete_records_select('assignfeedback_editpdf_queue',
|
||||
'submissionid = :submissionid AND submissionattempt = :submissionattempt AND id <> :minid', (array)$row);
|
||||
}
|
||||
}
|
||||
$duplicatedrows->close();
|
||||
|
||||
// Define key submissionid-submissionattempt to be added to assignfeedback_editpdf_queue.
|
||||
$table = new xmldb_table('assignfeedback_editpdf_queue');
|
||||
$key = new xmldb_key('submissionid-submissionattempt', XMLDB_KEY_UNIQUE, ['submissionid', 'submissionattempt']);
|
||||
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
upgrade_plugin_savepoint(true, 2018051401, 'assignfeedback', 'editpdf');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_assignfeedback_file_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_assignsubmission_comments_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_assignsubmission_file_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_assignsubmission_onlinetext_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -24,9 +24,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_assignment_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -34,9 +34,6 @@ function xmldb_book_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_chat_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -26,9 +26,6 @@ function xmldb_choice_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -24,9 +24,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_data_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -44,9 +44,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_feedback_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -49,9 +49,6 @@ function xmldb_folder_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -47,9 +47,6 @@ function xmldb_forum_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -22,75 +22,6 @@
|
||||
function xmldb_glossary_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2018051401) {
|
||||
|
||||
// Fetch the module ID for the glossary module.
|
||||
$glossarymoduleid = $DB->get_field('modules', 'id', ['name' => 'glossary']);
|
||||
|
||||
// Get id of section 1 on the frontpage course.
|
||||
$fpsection1 = $DB->get_field('course_sections', 'id', ['course' => SITEID, 'section' => 1]);
|
||||
|
||||
// Fetch sections for the frontpage not matching 1.
|
||||
$sectionselect = 'course = :course AND section <> 1';
|
||||
$sitesections = $DB->get_recordset_select('course_sections', $sectionselect, ['course' => SITEID]);
|
||||
$newsection1cmids = [];
|
||||
foreach ($sitesections as $section) {
|
||||
// Check if we have anything to process for this section.
|
||||
if (empty($section->sequence)) {
|
||||
// If there's none, ignore.
|
||||
continue;
|
||||
}
|
||||
// Fetch the course module IDs of the course modules in the section.
|
||||
$cmids = explode(',', $section->sequence);
|
||||
$nonglossarycmids = [];
|
||||
// Update the section in the course_modules table for glossary instances if necessary.
|
||||
foreach ($cmids as $cmid) {
|
||||
$params = [
|
||||
'id' => $cmid,
|
||||
'module' => $glossarymoduleid
|
||||
];
|
||||
// Check if the record in the course_modules tables is that of a glossary activity.
|
||||
if ($DB->record_exists('course_modules', $params)) {
|
||||
// If so, move it to front page's section 1.
|
||||
$DB->set_field('course_modules', 'section', $fpsection1, $params);
|
||||
$newsection1cmids[] = $cmid;
|
||||
} else {
|
||||
// Otherwise, ignore this course module as we only want to update glossary items.
|
||||
$nonglossarycmids[] = $cmid;
|
||||
}
|
||||
}
|
||||
// Check if we need to update the section record or we can delete it.
|
||||
if (!empty($nonglossarycmids)) {
|
||||
// Update the section record with a sequence that now excludes the glossary instance(s) (if it changed).
|
||||
$sequence = implode(',', $nonglossarycmids);
|
||||
if ($sequence != $section->sequence) {
|
||||
$DB->set_field('course_sections', 'sequence', $sequence, ['id' => $section->id]);
|
||||
}
|
||||
} else {
|
||||
// This section doesn't contain any items anymore, we can remove this.
|
||||
$DB->delete_records('course_sections', ['id' => $section->id]);
|
||||
}
|
||||
}
|
||||
$sitesections->close();
|
||||
|
||||
// Update the sequence field for the site's section 1 if necessary.
|
||||
if (!empty($newsection1cmids)) {
|
||||
$section1params = [
|
||||
'course' => SITEID,
|
||||
'section' => 1
|
||||
];
|
||||
$section1sequence = $DB->get_field('course_sections', 'sequence', $section1params);
|
||||
$newsection1sequence = implode(',', array_merge([$section1sequence], $newsection1cmids));
|
||||
// Update the sequence field of the first section for the front page.
|
||||
$DB->set_field('course_sections', 'sequence', $newsection1sequence, $section1params);
|
||||
}
|
||||
|
||||
upgrade_mod_savepoint(true, 2018051401, 'glossary');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,9 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_imscp_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -47,9 +47,6 @@ defined('MOODLE_INTERNAL') || die;
|
||||
function xmldb_label_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -52,9 +52,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_lesson_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -63,9 +63,6 @@ function xmldb_lti_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -47,9 +47,6 @@ defined('MOODLE_INTERNAL') || die;
|
||||
function xmldb_page_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ function xmldb_quiz_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,43 +33,6 @@ function xmldb_quiz_overview_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Upgrade 2018021800 (now removed) incorrectly added this key
|
||||
// with a unique constraint, which breaks things because those
|
||||
// columns are not, in fact, unique. So drop (if it exists) then recreate.
|
||||
if ($oldversion < 2018061800) {
|
||||
|
||||
// Define key questionusageid-slot (foreign) to be dropped form quiz_overview_regrades.
|
||||
$table = new xmldb_table('quiz_overview_regrades');
|
||||
|
||||
// There is no key_exists, so test the equivalent index.
|
||||
$oldindex = new xmldb_index('questionusageid-slot', XMLDB_KEY_UNIQUE, array('questionusageid', 'slot'));
|
||||
|
||||
// Launch drop key questionusageid-slot.
|
||||
if ($dbman->index_exists($table, $oldindex)) {
|
||||
$key = new xmldb_key('questionusageid-slot', XMLDB_KEY_FOREIGN, array('questionusageid', 'slot'), 'question_attempts', array('questionusageid', 'slot'));
|
||||
$dbman->drop_key($table, $key);
|
||||
}
|
||||
|
||||
// Overview savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018061800, 'quiz', 'overview');
|
||||
}
|
||||
|
||||
if ($oldversion < 2018061801) {
|
||||
|
||||
// Define key questionusageid-slot (foreign) to be added to quiz_overview_regrades.
|
||||
$table = new xmldb_table('quiz_overview_regrades');
|
||||
$key = new xmldb_key('questionusageid-slot', XMLDB_KEY_FOREIGN, array('questionusageid', 'slot'), 'question_attempts', array('questionusageid', 'slot'));
|
||||
|
||||
// Launch add key questionusageid-slot.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Overview savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2018061801, 'quiz', 'overview');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,9 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_quiz_statistics_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -47,9 +47,6 @@ defined('MOODLE_INTERNAL') || die;
|
||||
function xmldb_resource_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -34,9 +34,6 @@ function xmldb_scorm_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -24,9 +24,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_survey_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -47,9 +47,6 @@ defined('MOODLE_INTERNAL') || die;
|
||||
function xmldb_url_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -40,9 +40,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_wiki_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -39,50 +39,6 @@ function xmldb_workshop_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2018062600) {
|
||||
|
||||
// Define field submissiontypetext to be added to workshop.
|
||||
$table = new xmldb_table('workshop');
|
||||
$field = new xmldb_field('submissiontypetext', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1', 'gradedecimals');
|
||||
|
||||
// Conditionally launch add field submissiontypetext.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('submissiontypefile', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1',
|
||||
'submissiontypetext');
|
||||
|
||||
// Conditionally launch add field submissiontypefile.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Convert existing workshops with attachments disabled to use the new settings.
|
||||
$workshops = $DB->get_records('workshop', ['nattachments' => 0]);
|
||||
foreach ($workshops as $workshop) {
|
||||
$update = (object) [
|
||||
'id' => $workshop->id,
|
||||
'submissiontypefile' => 0,
|
||||
'submissiontypetext' => 2,
|
||||
'nattachments' => 1
|
||||
];
|
||||
$DB->update_record('workshop', $update);
|
||||
}
|
||||
|
||||
// Changing the default of field nattachments on table workshop to 1.
|
||||
$field = new xmldb_field('nattachments', XMLDB_TYPE_INTEGER, '3', null, null, null, '1', 'submissiontypefile');
|
||||
|
||||
// Launch change of default for field nattachments.
|
||||
$dbman->change_field_default($table, $field);
|
||||
|
||||
// Workshop savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2018062600, 'workshop');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_workshopform_accumulative_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_workshopform_comments_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_workshopform_numerrors_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_workshopform_rubric_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_portfolio_boxnet_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -23,9 +23,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_portfolio_googledocs_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -23,9 +23,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_portfolio_picasa_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,9 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_qbehaviour_manualgraded_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_qtype_calculated_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_qtype_ddmarker_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,8 +32,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_qtype_essay_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
@@ -47,7 +46,6 @@ function xmldb_qtype_essay_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
if ($oldversion < 2021052501) {
|
||||
|
||||
// Define field maxbytes to be added to qtype_essay_options.
|
||||
|
||||
@@ -31,9 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_qtype_match_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_qtype_multianswer_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v3.6.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