MDL-69308 upgrade: remove all the < 3.6.0 upgrade steps

This just deletes all the upgrade steps previous to 3.6.0. Some
small adjustments, like tweaking globals can also be applied
when needed.

Also includes an upgrade step to prevent upgrading from any
version < 2018120300 (v3.6.0) as anti-cheating measure.

Note that in this case, there wasn't any case of upgradelib
functions being used, hence we haven't to deprecate/remove
anything in codebase. When there is such a need, that is done
in separate commits (one for each function) and documented here.

See MDL-65809 commits for an example removing/deprecating a
good number of functions.
parent cc0e5e22
......@@ -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.
......
This diff is collapsed.
......@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_tool_log_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_logstore_database_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_logstore_standard_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_tool_monitor_upgrade($oldversion) {
global $CFG, $DB;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -34,32 +34,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_tool_policy_upgrade($oldversion) {
global $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2018082900) {
// Add field agreementstyle to the table tool_policy_versions.
$table = new xmldb_table('tool_policy_versions');
$field = new xmldb_field('agreementstyle', XMLDB_TYPE_INTEGER, '3', null, XMLDB_NOTNULL, null, '0', 'policyid');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_plugin_savepoint(true, 2018082900, 'tool', 'policy');
}
if ($oldversion < 2018091800) {
// Add field "optional" to the table "tool_policy_versions".
$table = new xmldb_table('tool_policy_versions');
$field = new xmldb_field('optional', XMLDB_TYPE_INTEGER, '3', null, XMLDB_NOTNULL, null, '0', 'agreementstyle');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_plugin_savepoint(true, 2018091800, 'tool', 'policy');
}
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -36,9 +36,6 @@ use tool_usertours\tour;
function xmldb_tool_usertours_upgrade($oldversion) {
global $CFG, $DB;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_auth_cas_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_auth_db_upgrade($oldversion) {
global $CFG, $DB;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_auth_email_upgrade($oldversion) {
global $CFG, $DB;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_auth_ldap_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_auth_manual_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_auth_mnet_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_auth_none_upgrade($oldversion) {
global $CFG, $DB;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -35,9 +35,6 @@ function xmldb_auth_oauth2_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_auth_shibboleth_upgrade($oldversion) {
global $CFG, $DB;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -45,9 +45,6 @@
function xmldb_block_badges_upgrade($oldversion, $block) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -45,9 +45,6 @@
function xmldb_block_calendar_month_upgrade($oldversion, $block) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -45,9 +45,6 @@
function xmldb_block_calendar_upcoming_upgrade($oldversion, $block) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -48,9 +48,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_block_completionstatus_upgrade($oldversion, $block) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -48,9 +48,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_block_course_summary_upgrade($oldversion, $block) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_block_html_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -55,9 +55,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_block_navigation_upgrade($oldversion, $block) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -45,9 +45,6 @@
function xmldb_block_quiz_results_upgrade($oldversion, $block) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -47,9 +47,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_block_recent_activity_upgrade($oldversion, $block) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_block_rss_client_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -49,9 +49,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_block_section_links_upgrade($oldversion, $block) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -48,9 +48,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_block_selfcompletion_upgrade($oldversion, $block) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -55,9 +55,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_block_settings_upgrade($oldversion, $block) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_format_topics_upgrade($oldversion) {
global $CFG, $DB;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_format_weeks_upgrade($oldversion) {
global $CFG, $DB;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_enrol_database_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_enrol_flatfile_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_enrol_guest_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_enrol_imsenterprise_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -39,9 +39,6 @@
function xmldb_enrol_lti_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_enrol_manual_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_enrol_mnet_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -45,90 +45,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_enrol_paypal_upgrade($oldversion) {
global $DB;
$dbman = $DB->get_manager();
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2018053000) {
// Define field instanceid to be added to enrol_paypal.
// For some reason, some Moodle instances that are upgraded from old versions do not have this field.
$table = new xmldb_table('enrol_paypal');
$field = new xmldb_field('instanceid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'userid');
// Conditionally launch add field instanceid.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Paypal savepoint reached.
upgrade_plugin_savepoint(true, 2018053000, 'enrol', 'paypal');
}
if ($oldversion < 2018062500) {
// Define key courseid (foreign) to be added to enrol_paypal.
$table = new xmldb_table('enrol_paypal');
$key = new xmldb_key('courseid', XMLDB_KEY_FOREIGN, array('courseid'), 'course', array('id'));
// Launch add key courseid.
$dbman->add_key($table, $key);
// Paypal savepoint reached.
upgrade_plugin_savepoint(true, 2018062500, 'enrol', 'paypal');
}
if ($oldversion < 2018062501) {
// Define key userid (foreign) to be added to enrol_paypal.
$table = new xmldb_table('enrol_paypal');
$key = new xmldb_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
// Launch add key userid.
$dbman->add_key($table, $key);
// Paypal savepoint reached.
upgrade_plugin_savepoint(true, 2018062501, 'enrol', 'paypal');
}
if ($oldversion < 2018062502) {
// Define key instanceid (foreign) to be added to enrol_paypal.
$table = new xmldb_table('enrol_paypal');
$key = new xmldb_key('instanceid', XMLDB_KEY_FOREIGN, array('instanceid'), 'enrol', array('id'));
// Launch add key instanceid.
$dbman->add_key($table, $key);
// Paypal savepoint reached.
upgrade_plugin_savepoint(true, 2018062502, 'enrol', 'paypal');
}
if ($oldversion < 2018062503) {
$table = new xmldb_table('enrol_paypal');
// Define index business (not unique) to be added to enrol_paypal.
$index = new xmldb_index('business', XMLDB_INDEX_NOTUNIQUE, array('business'));
// Conditionally launch add index business.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Define index receiver_email (not unique) to be added to enrol_paypal.
$index = new xmldb_index('receiver_email', XMLDB_INDEX_NOTUNIQUE, array('receiver_email'));
// Conditionally launch add index receiver_email.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Paypal savepoint reached.
upgrade_plugin_savepoint(true, 2018062503, 'enrol', 'paypal');
}
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_enrol_self_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -31,9 +31,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_filter_mathjaxloader_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_filter_mediaplugin_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_filter_tex_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -37,9 +37,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_gradingform_guide_upgrade($oldversion) {
global $DB;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_gradingform_rubric_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
*/
function xmldb_gradereport_overview_upgrade($oldversion) {
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -29,9 +29,6 @@
function xmldb_gradereport_user_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
*/
function xmldb_antivirus_clamav_upgrade($oldversion) {
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
This diff is collapsed.
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_editor_atto_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_atto_equation_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_editor_tinymce_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_tinymce_spellchecker_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -34,9 +34,6 @@ function xmldb_message_email_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_message_jabber_upgrade($oldversion) {
global $CFG;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_message_popup_upgrade($oldversion) {
global $DB;
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.