diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index f063803e4a7..35fd4a766bb 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -48,7 +48,7 @@ jobs: matrix: include: - os: ubuntu-18.04 - php: 7.2 + php: 7.3 db: mysqli - os: ubuntu-18.04 php: 7.4 diff --git a/.travis.yml b/.travis.yml index 89acef867fe..0c565f37901 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,18 +26,18 @@ jobs: fast_finish: true include: - # First all the lowest php ones (7.2) - - php: 7.2 + # First all the lowest php ones (7.3) + - php: 7.3 env: DB=none TASK=CITEST - - php: 7.2 + - php: 7.3 env: DB=none TASK=GRUNT NVM_VERSION='lts/carbon' - if: env(MOODLE_DATABASE) = "pgsql" OR env(MOODLE_DATABASE) = "all" OR env(MOODLE_DATABASE) IS NOT present - php: 7.2 + php: 7.3 env: DB=pgsql TASK=PHPUNIT - if: env(MOODLE_DATABASE) = "mysqli" OR env(MOODLE_DATABASE) = "all" - php: 7.2 + php: 7.3 env: DB=mysqli TASK=PHPUNIT # Then, conditionally, all the highest php ones (7.4) diff --git a/admin/environment.xml b/admin/environment.xml index 3c6365fba8b..857a8d37ca9 100644 --- a/admin/environment.xml +++ b/admin/environment.xml @@ -3344,4 +3344,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/admin/tool/customlang/db/upgrade.php b/admin/tool/customlang/db/upgrade.php index 42d01336925..a0706da08f8 100644 --- a/admin/tool/customlang/db/upgrade.php +++ b/admin/tool/customlang/db/upgrade.php @@ -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. diff --git a/admin/tool/dataprivacy/db/upgrade.php b/admin/tool/dataprivacy/db/upgrade.php index 30a988195a5..0748ccbe699 100644 --- a/admin/tool/dataprivacy/db/upgrade.php +++ b/admin/tool/dataprivacy/db/upgrade.php @@ -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. diff --git a/admin/tool/log/db/upgrade.php b/admin/tool/log/db/upgrade.php index 6fffa79b1aa..c7fdc68c44e 100644 --- a/admin/tool/log/db/upgrade.php +++ b/admin/tool/log/db/upgrade.php @@ -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. diff --git a/admin/tool/log/store/database/db/upgrade.php b/admin/tool/log/store/database/db/upgrade.php index 1b9aef275bf..0384c386487 100644 --- a/admin/tool/log/store/database/db/upgrade.php +++ b/admin/tool/log/store/database/db/upgrade.php @@ -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. diff --git a/admin/tool/log/store/standard/db/upgrade.php b/admin/tool/log/store/standard/db/upgrade.php index 25ec6eb54e8..0f6da04df6e 100644 --- a/admin/tool/log/store/standard/db/upgrade.php +++ b/admin/tool/log/store/standard/db/upgrade.php @@ -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. diff --git a/admin/tool/monitor/db/upgrade.php b/admin/tool/monitor/db/upgrade.php index d8c4fd2ff5a..a84a9641493 100644 --- a/admin/tool/monitor/db/upgrade.php +++ b/admin/tool/monitor/db/upgrade.php @@ -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. diff --git a/admin/tool/policy/db/upgrade.php b/admin/tool/policy/db/upgrade.php index 4da195d32e4..9ef2107f2aa 100644 --- a/admin/tool/policy/db/upgrade.php +++ b/admin/tool/policy/db/upgrade.php @@ -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. diff --git a/admin/tool/usertours/db/upgrade.php b/admin/tool/usertours/db/upgrade.php index 66420f5c8cf..6f5d7c238c4 100644 --- a/admin/tool/usertours/db/upgrade.php +++ b/admin/tool/usertours/db/upgrade.php @@ -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. diff --git a/auth/cas/db/upgrade.php b/auth/cas/db/upgrade.php index 1190c233865..abff53bf2a9 100644 --- a/auth/cas/db/upgrade.php +++ b/auth/cas/db/upgrade.php @@ -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. diff --git a/auth/db/db/upgrade.php b/auth/db/db/upgrade.php index 3fdd848bbe2..beb5ff19d64 100644 --- a/auth/db/db/upgrade.php +++ b/auth/db/db/upgrade.php @@ -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. diff --git a/auth/email/db/upgrade.php b/auth/email/db/upgrade.php index c641c84b735..28ab12ff551 100644 --- a/auth/email/db/upgrade.php +++ b/auth/email/db/upgrade.php @@ -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. diff --git a/auth/ldap/db/upgrade.php b/auth/ldap/db/upgrade.php index 41f9db5dc0d..ce9f85e6153 100644 --- a/auth/ldap/db/upgrade.php +++ b/auth/ldap/db/upgrade.php @@ -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. diff --git a/auth/manual/db/upgrade.php b/auth/manual/db/upgrade.php index ced0da1a8e2..836cfafd2bd 100644 --- a/auth/manual/db/upgrade.php +++ b/auth/manual/db/upgrade.php @@ -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. diff --git a/auth/mnet/db/upgrade.php b/auth/mnet/db/upgrade.php index f9fabc1f55a..3c354c40c17 100644 --- a/auth/mnet/db/upgrade.php +++ b/auth/mnet/db/upgrade.php @@ -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. diff --git a/auth/none/db/upgrade.php b/auth/none/db/upgrade.php index 1d17e36b864..7b575393655 100644 --- a/auth/none/db/upgrade.php +++ b/auth/none/db/upgrade.php @@ -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. diff --git a/auth/oauth2/db/upgrade.php b/auth/oauth2/db/upgrade.php index d9d50b8dd66..0a6bb5d14d8 100644 --- a/auth/oauth2/db/upgrade.php +++ b/auth/oauth2/db/upgrade.php @@ -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. diff --git a/auth/shibboleth/db/upgrade.php b/auth/shibboleth/db/upgrade.php index 9553db8c5d6..6cbabb39477 100644 --- a/auth/shibboleth/db/upgrade.php +++ b/auth/shibboleth/db/upgrade.php @@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_auth_shibboleth_upgrade($oldversion) { global $CFG, $DB, $OUTPUT; - // 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. diff --git a/blocks/badges/db/upgrade.php b/blocks/badges/db/upgrade.php index 6a1cc4d8e5d..413b03634f1 100644 --- a/blocks/badges/db/upgrade.php +++ b/blocks/badges/db/upgrade.php @@ -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. diff --git a/blocks/calendar_month/db/upgrade.php b/blocks/calendar_month/db/upgrade.php index ce70f8b0e9f..06543539d56 100644 --- a/blocks/calendar_month/db/upgrade.php +++ b/blocks/calendar_month/db/upgrade.php @@ -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. diff --git a/blocks/calendar_upcoming/db/upgrade.php b/blocks/calendar_upcoming/db/upgrade.php index 3c6cee06167..e70285f94e1 100644 --- a/blocks/calendar_upcoming/db/upgrade.php +++ b/blocks/calendar_upcoming/db/upgrade.php @@ -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. diff --git a/blocks/completionstatus/db/upgrade.php b/blocks/completionstatus/db/upgrade.php index 433fb4f299c..daccb412d17 100644 --- a/blocks/completionstatus/db/upgrade.php +++ b/blocks/completionstatus/db/upgrade.php @@ -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. diff --git a/blocks/course_summary/db/upgrade.php b/blocks/course_summary/db/upgrade.php index 7fea414d174..62b617a0df4 100644 --- a/blocks/course_summary/db/upgrade.php +++ b/blocks/course_summary/db/upgrade.php @@ -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. diff --git a/blocks/html/db/upgrade.php b/blocks/html/db/upgrade.php index e2286209df6..baefecafed6 100644 --- a/blocks/html/db/upgrade.php +++ b/blocks/html/db/upgrade.php @@ -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. diff --git a/blocks/navigation/db/upgrade.php b/blocks/navigation/db/upgrade.php index c7ffa31db17..802c2eceefe 100644 --- a/blocks/navigation/db/upgrade.php +++ b/blocks/navigation/db/upgrade.php @@ -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. diff --git a/blocks/quiz_results/db/upgrade.php b/blocks/quiz_results/db/upgrade.php index 0a7e0f95438..ca88593c63a 100644 --- a/blocks/quiz_results/db/upgrade.php +++ b/blocks/quiz_results/db/upgrade.php @@ -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. diff --git a/blocks/recent_activity/db/upgrade.php b/blocks/recent_activity/db/upgrade.php index fe49827ce81..f510e708f36 100644 --- a/blocks/recent_activity/db/upgrade.php +++ b/blocks/recent_activity/db/upgrade.php @@ -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. diff --git a/blocks/rss_client/db/upgrade.php b/blocks/rss_client/db/upgrade.php index 736a67cb859..f6eb7858a01 100644 --- a/blocks/rss_client/db/upgrade.php +++ b/blocks/rss_client/db/upgrade.php @@ -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. diff --git a/blocks/section_links/db/upgrade.php b/blocks/section_links/db/upgrade.php index 9c04b34f5a9..bd7baf27165 100644 --- a/blocks/section_links/db/upgrade.php +++ b/blocks/section_links/db/upgrade.php @@ -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. diff --git a/blocks/selfcompletion/db/upgrade.php b/blocks/selfcompletion/db/upgrade.php index c520cbf1a9c..3a2d7a63272 100644 --- a/blocks/selfcompletion/db/upgrade.php +++ b/blocks/selfcompletion/db/upgrade.php @@ -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. diff --git a/blocks/settings/db/upgrade.php b/blocks/settings/db/upgrade.php index 38595abc026..aa49b1ba81b 100644 --- a/blocks/settings/db/upgrade.php +++ b/blocks/settings/db/upgrade.php @@ -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. diff --git a/course/format/topics/db/upgrade.php b/course/format/topics/db/upgrade.php index d46360fb2f3..fe3184c6fa1 100644 --- a/course/format/topics/db/upgrade.php +++ b/course/format/topics/db/upgrade.php @@ -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. diff --git a/course/format/weeks/db/upgrade.php b/course/format/weeks/db/upgrade.php index ff33b81a066..37ee465bc7f 100644 --- a/course/format/weeks/db/upgrade.php +++ b/course/format/weeks/db/upgrade.php @@ -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. diff --git a/enrol/database/db/upgrade.php b/enrol/database/db/upgrade.php index dcf26fbc613..857512aa6dc 100644 --- a/enrol/database/db/upgrade.php +++ b/enrol/database/db/upgrade.php @@ -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. diff --git a/enrol/flatfile/db/upgrade.php b/enrol/flatfile/db/upgrade.php index 7ac0520c12d..884b7eb5a59 100644 --- a/enrol/flatfile/db/upgrade.php +++ b/enrol/flatfile/db/upgrade.php @@ -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. diff --git a/enrol/guest/db/upgrade.php b/enrol/guest/db/upgrade.php index 230075cfa3e..f99788cb8b8 100644 --- a/enrol/guest/db/upgrade.php +++ b/enrol/guest/db/upgrade.php @@ -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. diff --git a/enrol/imsenterprise/db/upgrade.php b/enrol/imsenterprise/db/upgrade.php index cb22209af46..37a3bf3f813 100644 --- a/enrol/imsenterprise/db/upgrade.php +++ b/enrol/imsenterprise/db/upgrade.php @@ -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. diff --git a/enrol/lti/db/upgrade.php b/enrol/lti/db/upgrade.php index 72ec893aff8..70288977bf7 100644 --- a/enrol/lti/db/upgrade.php +++ b/enrol/lti/db/upgrade.php @@ -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. diff --git a/enrol/manual/db/upgrade.php b/enrol/manual/db/upgrade.php index 7146f26262e..3aaad56d0bd 100644 --- a/enrol/manual/db/upgrade.php +++ b/enrol/manual/db/upgrade.php @@ -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. diff --git a/enrol/mnet/db/upgrade.php b/enrol/mnet/db/upgrade.php index 59952aa9275..f57b1297dd6 100644 --- a/enrol/mnet/db/upgrade.php +++ b/enrol/mnet/db/upgrade.php @@ -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. diff --git a/enrol/paypal/db/upgrade.php b/enrol/paypal/db/upgrade.php index 0d92c128cb6..7248861b2f1 100644 --- a/enrol/paypal/db/upgrade.php +++ b/enrol/paypal/db/upgrade.php @@ -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. diff --git a/enrol/self/db/upgrade.php b/enrol/self/db/upgrade.php index 04773bea74b..45d11001ccf 100644 --- a/enrol/self/db/upgrade.php +++ b/enrol/self/db/upgrade.php @@ -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. diff --git a/filter/mathjaxloader/db/upgrade.php b/filter/mathjaxloader/db/upgrade.php index e61d26a2c9d..58237981771 100644 --- a/filter/mathjaxloader/db/upgrade.php +++ b/filter/mathjaxloader/db/upgrade.php @@ -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. diff --git a/filter/mediaplugin/db/upgrade.php b/filter/mediaplugin/db/upgrade.php index 83b7e30033a..0c3739036d5 100644 --- a/filter/mediaplugin/db/upgrade.php +++ b/filter/mediaplugin/db/upgrade.php @@ -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. diff --git a/filter/tex/db/upgrade.php b/filter/tex/db/upgrade.php index dec7d779d44..2c98b8af6e3 100644 --- a/filter/tex/db/upgrade.php +++ b/filter/tex/db/upgrade.php @@ -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. diff --git a/grade/grading/form/guide/db/upgrade.php b/grade/grading/form/guide/db/upgrade.php index 2b8c1f172c8..62ab96d5209 100644 --- a/grade/grading/form/guide/db/upgrade.php +++ b/grade/grading/form/guide/db/upgrade.php @@ -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. diff --git a/grade/grading/form/rubric/db/upgrade.php b/grade/grading/form/rubric/db/upgrade.php index 09e1725ff8e..16e799e6ca1 100644 --- a/grade/grading/form/rubric/db/upgrade.php +++ b/grade/grading/form/rubric/db/upgrade.php @@ -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. diff --git a/grade/report/overview/db/upgrade.php b/grade/report/overview/db/upgrade.php index 8b40fff883e..3d7960d1189 100644 --- a/grade/report/overview/db/upgrade.php +++ b/grade/report/overview/db/upgrade.php @@ -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. diff --git a/grade/report/user/db/upgrade.php b/grade/report/user/db/upgrade.php index 6e6e42e7187..2bf738166c7 100644 --- a/grade/report/user/db/upgrade.php +++ b/grade/report/user/db/upgrade.php @@ -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. diff --git a/lib/antivirus/clamav/db/upgrade.php b/lib/antivirus/clamav/db/upgrade.php index ed8ad04fe78..3f3225f3fd5 100644 --- a/lib/antivirus/clamav/db/upgrade.php +++ b/lib/antivirus/clamav/db/upgrade.php @@ -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. diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 685de9e34da..876e190d7ae 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -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. diff --git a/lib/editor/atto/db/upgrade.php b/lib/editor/atto/db/upgrade.php index 81a30990074..606c3575336 100644 --- a/lib/editor/atto/db/upgrade.php +++ b/lib/editor/atto/db/upgrade.php @@ -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. diff --git a/lib/editor/atto/plugins/equation/db/upgrade.php b/lib/editor/atto/plugins/equation/db/upgrade.php index bf910f809e0..09769687fc7 100644 --- a/lib/editor/atto/plugins/equation/db/upgrade.php +++ b/lib/editor/atto/plugins/equation/db/upgrade.php @@ -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. diff --git a/lib/editor/tinymce/db/upgrade.php b/lib/editor/tinymce/db/upgrade.php index 79c34d5770e..176bbed0302 100644 --- a/lib/editor/tinymce/db/upgrade.php +++ b/lib/editor/tinymce/db/upgrade.php @@ -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. diff --git a/lib/editor/tinymce/plugins/spellchecker/db/upgrade.php b/lib/editor/tinymce/plugins/spellchecker/db/upgrade.php index fb4bb7037ce..095a44d9017 100644 --- a/lib/editor/tinymce/plugins/spellchecker/db/upgrade.php +++ b/lib/editor/tinymce/plugins/spellchecker/db/upgrade.php @@ -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. diff --git a/message/output/email/db/upgrade.php b/message/output/email/db/upgrade.php index 9e548d56177..96cfa95dbae 100644 --- a/message/output/email/db/upgrade.php +++ b/message/output/email/db/upgrade.php @@ -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. diff --git a/message/output/jabber/db/upgrade.php b/message/output/jabber/db/upgrade.php index ca1596a77d3..e829e13bab5 100644 --- a/message/output/jabber/db/upgrade.php +++ b/message/output/jabber/db/upgrade.php @@ -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. diff --git a/message/output/popup/db/upgrade.php b/message/output/popup/db/upgrade.php index b8f213b29dd..be04744dab4 100644 --- a/message/output/popup/db/upgrade.php +++ b/message/output/popup/db/upgrade.php @@ -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. diff --git a/mod/assign/db/upgrade.php b/mod/assign/db/upgrade.php index 4de09c6fd1e..fc30e78ff5c 100644 --- a/mod/assign/db/upgrade.php +++ b/mod/assign/db/upgrade.php @@ -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. diff --git a/mod/assign/feedback/comments/db/upgrade.php b/mod/assign/feedback/comments/db/upgrade.php index 25fff866804..e1f7935356b 100644 --- a/mod/assign/feedback/comments/db/upgrade.php +++ b/mod/assign/feedback/comments/db/upgrade.php @@ -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. diff --git a/mod/assign/feedback/editpdf/db/upgrade.php b/mod/assign/feedback/editpdf/db/upgrade.php index 3fe8439c67d..b45c3e0f43d 100644 --- a/mod/assign/feedback/editpdf/db/upgrade.php +++ b/mod/assign/feedback/editpdf/db/upgrade.php @@ -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. diff --git a/mod/assign/feedback/file/db/upgrade.php b/mod/assign/feedback/file/db/upgrade.php index 6d79d033e26..3cf8ece6830 100644 --- a/mod/assign/feedback/file/db/upgrade.php +++ b/mod/assign/feedback/file/db/upgrade.php @@ -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. diff --git a/mod/assign/submission/comments/db/upgrade.php b/mod/assign/submission/comments/db/upgrade.php index 50860c0745c..d2620962d2f 100644 --- a/mod/assign/submission/comments/db/upgrade.php +++ b/mod/assign/submission/comments/db/upgrade.php @@ -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. diff --git a/mod/assign/submission/file/db/upgrade.php b/mod/assign/submission/file/db/upgrade.php index 863b154a9fd..d9214aef059 100644 --- a/mod/assign/submission/file/db/upgrade.php +++ b/mod/assign/submission/file/db/upgrade.php @@ -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. diff --git a/mod/assign/submission/onlinetext/db/upgrade.php b/mod/assign/submission/onlinetext/db/upgrade.php index d09f6bdcbc2..9b1e223c748 100644 --- a/mod/assign/submission/onlinetext/db/upgrade.php +++ b/mod/assign/submission/onlinetext/db/upgrade.php @@ -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. diff --git a/mod/assignment/db/upgrade.php b/mod/assignment/db/upgrade.php index c8fb7d1f040..8f65de3e383 100644 --- a/mod/assignment/db/upgrade.php +++ b/mod/assignment/db/upgrade.php @@ -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. diff --git a/mod/book/db/upgrade.php b/mod/book/db/upgrade.php index aaaeb6d8669..c386dee3c05 100644 --- a/mod/book/db/upgrade.php +++ b/mod/book/db/upgrade.php @@ -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. diff --git a/mod/chat/db/upgrade.php b/mod/chat/db/upgrade.php index cf1856a0795..bd0d96936d4 100644 --- a/mod/chat/db/upgrade.php +++ b/mod/chat/db/upgrade.php @@ -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. diff --git a/mod/choice/db/upgrade.php b/mod/choice/db/upgrade.php index 6f8abdcbc05..4215bba4d39 100644 --- a/mod/choice/db/upgrade.php +++ b/mod/choice/db/upgrade.php @@ -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. diff --git a/mod/data/db/upgrade.php b/mod/data/db/upgrade.php index b513ac24676..9ab8b6022bd 100644 --- a/mod/data/db/upgrade.php +++ b/mod/data/db/upgrade.php @@ -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. diff --git a/mod/feedback/db/upgrade.php b/mod/feedback/db/upgrade.php index a041cfbb0b1..418459c1704 100644 --- a/mod/feedback/db/upgrade.php +++ b/mod/feedback/db/upgrade.php @@ -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. diff --git a/mod/folder/db/upgrade.php b/mod/folder/db/upgrade.php index 7eaf3d1ff7d..08889e17a3b 100644 --- a/mod/folder/db/upgrade.php +++ b/mod/folder/db/upgrade.php @@ -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. diff --git a/mod/forum/db/upgrade.php b/mod/forum/db/upgrade.php index 5f709bd6bfa..bdb360370db 100644 --- a/mod/forum/db/upgrade.php +++ b/mod/forum/db/upgrade.php @@ -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. diff --git a/mod/glossary/db/upgrade.php b/mod/glossary/db/upgrade.php index e8f6374f5ef..8d59689133c 100644 --- a/mod/glossary/db/upgrade.php +++ b/mod/glossary/db/upgrade.php @@ -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. diff --git a/mod/imscp/db/upgrade.php b/mod/imscp/db/upgrade.php index 86909876a4a..52293fdca0e 100644 --- a/mod/imscp/db/upgrade.php +++ b/mod/imscp/db/upgrade.php @@ -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. diff --git a/mod/label/db/upgrade.php b/mod/label/db/upgrade.php index 9da7baaf876..e4158b1966e 100644 --- a/mod/label/db/upgrade.php +++ b/mod/label/db/upgrade.php @@ -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. diff --git a/mod/lesson/db/upgrade.php b/mod/lesson/db/upgrade.php index e6fce600ac2..874f8398926 100644 --- a/mod/lesson/db/upgrade.php +++ b/mod/lesson/db/upgrade.php @@ -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. diff --git a/mod/lti/db/upgrade.php b/mod/lti/db/upgrade.php index 7190e27e004..ea3c946f4fa 100644 --- a/mod/lti/db/upgrade.php +++ b/mod/lti/db/upgrade.php @@ -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. diff --git a/mod/page/db/upgrade.php b/mod/page/db/upgrade.php index 6270d4ad1a7..ac29ab32449 100644 --- a/mod/page/db/upgrade.php +++ b/mod/page/db/upgrade.php @@ -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. diff --git a/mod/quiz/db/upgrade.php b/mod/quiz/db/upgrade.php index fbd488a6321..a18665aad21 100644 --- a/mod/quiz/db/upgrade.php +++ b/mod/quiz/db/upgrade.php @@ -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. diff --git a/mod/quiz/report/overview/db/upgrade.php b/mod/quiz/report/overview/db/upgrade.php index a635791b08f..b2078902c26 100644 --- a/mod/quiz/report/overview/db/upgrade.php +++ b/mod/quiz/report/overview/db/upgrade.php @@ -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. diff --git a/mod/quiz/report/statistics/db/upgrade.php b/mod/quiz/report/statistics/db/upgrade.php index 72858057c04..f2a19ea629c 100644 --- a/mod/quiz/report/statistics/db/upgrade.php +++ b/mod/quiz/report/statistics/db/upgrade.php @@ -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. diff --git a/mod/resource/db/upgrade.php b/mod/resource/db/upgrade.php index 4bff2a2b8ca..916380f3e1c 100644 --- a/mod/resource/db/upgrade.php +++ b/mod/resource/db/upgrade.php @@ -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. diff --git a/mod/scorm/db/upgrade.php b/mod/scorm/db/upgrade.php index 77d9e8426ee..0860d96555e 100644 --- a/mod/scorm/db/upgrade.php +++ b/mod/scorm/db/upgrade.php @@ -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. diff --git a/mod/survey/db/upgrade.php b/mod/survey/db/upgrade.php index 41edac7a2a9..8be9b2e66cf 100644 --- a/mod/survey/db/upgrade.php +++ b/mod/survey/db/upgrade.php @@ -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. diff --git a/mod/url/db/upgrade.php b/mod/url/db/upgrade.php index 48e084eaa51..05eb26d0286 100644 --- a/mod/url/db/upgrade.php +++ b/mod/url/db/upgrade.php @@ -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. diff --git a/mod/wiki/db/upgrade.php b/mod/wiki/db/upgrade.php index b921fdf84d1..5c1cd52be20 100644 --- a/mod/wiki/db/upgrade.php +++ b/mod/wiki/db/upgrade.php @@ -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. diff --git a/mod/workshop/db/upgrade.php b/mod/workshop/db/upgrade.php index cf73e05b8fd..74b2e72b41d 100644 --- a/mod/workshop/db/upgrade.php +++ b/mod/workshop/db/upgrade.php @@ -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. diff --git a/mod/workshop/form/accumulative/db/upgrade.php b/mod/workshop/form/accumulative/db/upgrade.php index 5b55f0982ca..66461232cfb 100644 --- a/mod/workshop/form/accumulative/db/upgrade.php +++ b/mod/workshop/form/accumulative/db/upgrade.php @@ -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. diff --git a/mod/workshop/form/comments/db/upgrade.php b/mod/workshop/form/comments/db/upgrade.php index c2c9c2d3a99..b4d021eaa60 100644 --- a/mod/workshop/form/comments/db/upgrade.php +++ b/mod/workshop/form/comments/db/upgrade.php @@ -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. diff --git a/mod/workshop/form/numerrors/db/upgrade.php b/mod/workshop/form/numerrors/db/upgrade.php index 9bcd3cffcb3..1670a6613fe 100644 --- a/mod/workshop/form/numerrors/db/upgrade.php +++ b/mod/workshop/form/numerrors/db/upgrade.php @@ -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. diff --git a/mod/workshop/form/rubric/db/upgrade.php b/mod/workshop/form/rubric/db/upgrade.php index 6bca99d23a8..ae3fe06b8c8 100644 --- a/mod/workshop/form/rubric/db/upgrade.php +++ b/mod/workshop/form/rubric/db/upgrade.php @@ -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. diff --git a/portfolio/boxnet/db/upgrade.php b/portfolio/boxnet/db/upgrade.php index 0c188fe8e55..695ed646393 100644 --- a/portfolio/boxnet/db/upgrade.php +++ b/portfolio/boxnet/db/upgrade.php @@ -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. diff --git a/portfolio/googledocs/db/upgrade.php b/portfolio/googledocs/db/upgrade.php index 25b7e285536..a4246ebbcd0 100644 --- a/portfolio/googledocs/db/upgrade.php +++ b/portfolio/googledocs/db/upgrade.php @@ -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. diff --git a/portfolio/picasa/db/upgrade.php b/portfolio/picasa/db/upgrade.php index 9d34c132fac..430343b57eb 100644 --- a/portfolio/picasa/db/upgrade.php +++ b/portfolio/picasa/db/upgrade.php @@ -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. diff --git a/question/behaviour/manualgraded/db/upgrade.php b/question/behaviour/manualgraded/db/upgrade.php index 913f5a1ed32..acee0ac54bb 100644 --- a/question/behaviour/manualgraded/db/upgrade.php +++ b/question/behaviour/manualgraded/db/upgrade.php @@ -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. diff --git a/question/type/calculated/db/upgrade.php b/question/type/calculated/db/upgrade.php index 778ba9e4c14..5d6e4d2193c 100644 --- a/question/type/calculated/db/upgrade.php +++ b/question/type/calculated/db/upgrade.php @@ -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. diff --git a/question/type/ddmarker/db/upgrade.php b/question/type/ddmarker/db/upgrade.php index e70a6256f27..6bd5b460668 100644 --- a/question/type/ddmarker/db/upgrade.php +++ b/question/type/ddmarker/db/upgrade.php @@ -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. diff --git a/question/type/essay/db/upgrade.php b/question/type/essay/db/upgrade.php index 480d0970aaa..d655b8746c4 100644 --- a/question/type/essay/db/upgrade.php +++ b/question/type/essay/db/upgrade.php @@ -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. diff --git a/question/type/match/db/upgrade.php b/question/type/match/db/upgrade.php index 4e13e59a343..1adf811b5d7 100644 --- a/question/type/match/db/upgrade.php +++ b/question/type/match/db/upgrade.php @@ -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. diff --git a/question/type/multianswer/db/upgrade.php b/question/type/multianswer/db/upgrade.php index 11f5fe87a06..793ff2cf0d9 100644 --- a/question/type/multianswer/db/upgrade.php +++ b/question/type/multianswer/db/upgrade.php @@ -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. diff --git a/question/type/multichoice/db/upgrade.php b/question/type/multichoice/db/upgrade.php index 6546de42065..b8e6a29f463 100644 --- a/question/type/multichoice/db/upgrade.php +++ b/question/type/multichoice/db/upgrade.php @@ -32,8 +32,7 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_qtype_multichoice_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. @@ -46,7 +45,6 @@ function xmldb_qtype_multichoice_upgrade($oldversion) { // Add a new checkbox for the question author to decide // Whether standard instruction ('Select one:' or 'Select one or more:') is displayed. - $dbman = $DB->get_manager(); $newversion = 2020041600; if ($oldversion < $newversion) { diff --git a/question/type/numerical/db/upgrade.php b/question/type/numerical/db/upgrade.php index fdb4de50135..4d589360ada 100644 --- a/question/type/numerical/db/upgrade.php +++ b/question/type/numerical/db/upgrade.php @@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_qtype_numerical_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. diff --git a/question/type/random/db/upgrade.php b/question/type/random/db/upgrade.php index 1ba40d4042e..89131823c0f 100644 --- a/question/type/random/db/upgrade.php +++ b/question/type/random/db/upgrade.php @@ -31,9 +31,6 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_qtype_random_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. diff --git a/question/type/randomsamatch/db/upgrade.php b/question/type/randomsamatch/db/upgrade.php index de00fccc405..28ae28b50f3 100644 --- a/question/type/randomsamatch/db/upgrade.php +++ b/question/type/randomsamatch/db/upgrade.php @@ -31,9 +31,6 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_qtype_randomsamatch_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. diff --git a/question/type/shortanswer/db/upgrade.php b/question/type/shortanswer/db/upgrade.php index b4787f728cb..4b7c48578db 100644 --- a/question/type/shortanswer/db/upgrade.php +++ b/question/type/shortanswer/db/upgrade.php @@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_qtype_shortanswer_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. diff --git a/repository/boxnet/db/upgrade.php b/repository/boxnet/db/upgrade.php index 94da3f4db38..eed26f959fe 100644 --- a/repository/boxnet/db/upgrade.php +++ b/repository/boxnet/db/upgrade.php @@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_repository_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. diff --git a/repository/dropbox/db/upgrade.php b/repository/dropbox/db/upgrade.php index 48942a59316..51d2ca7d3c7 100644 --- a/repository/dropbox/db/upgrade.php +++ b/repository/dropbox/db/upgrade.php @@ -23,9 +23,6 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_repository_dropbox_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. diff --git a/repository/flickr/db/upgrade.php b/repository/flickr/db/upgrade.php index d60015d609a..f4ee3da39b6 100644 --- a/repository/flickr/db/upgrade.php +++ b/repository/flickr/db/upgrade.php @@ -34,9 +34,6 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_repository_flickr_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. diff --git a/repository/googledocs/db/upgrade.php b/repository/googledocs/db/upgrade.php index 2f077facd83..946a9d98a2a 100644 --- a/repository/googledocs/db/upgrade.php +++ b/repository/googledocs/db/upgrade.php @@ -23,9 +23,6 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_repository_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. diff --git a/repository/onedrive/db/upgrade.php b/repository/onedrive/db/upgrade.php index 40393af748c..cd80bbd4789 100644 --- a/repository/onedrive/db/upgrade.php +++ b/repository/onedrive/db/upgrade.php @@ -26,9 +26,6 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_repository_onedrive_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. diff --git a/repository/picasa/db/upgrade.php b/repository/picasa/db/upgrade.php index b701850ab2c..b0d2f7e70ae 100644 --- a/repository/picasa/db/upgrade.php +++ b/repository/picasa/db/upgrade.php @@ -23,9 +23,6 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_repository_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.