MDL-59159 upgrade: clean < 3.1.0 upgrade steps

LTS (3.5) requires previous LTS (3.1)

This just deletes all the upgrade steps previous to 3.1.0. Some
small adjustments, like adding missing MOODLE_INTERNAL or tweaking
globals can also be applied when needed.

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

Next commit will get rid of/deprecate all the upgradelib functions
not used anymore in codebase.
parent 41116117
......@@ -29,9 +29,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_tool_customlang_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -33,9 +33,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_tool_log_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -35,9 +35,6 @@ function xmldb_tool_monitor_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2016052305) {
// Define field inactivedate to be added to tool_monitor_subscriptions.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_auth_cas_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2017020700) {
......
......@@ -45,9 +45,6 @@
function xmldb_block_badges_upgrade($oldversion, $block) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -45,9 +45,6 @@
function xmldb_block_calendar_month_upgrade($oldversion, $block) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -45,9 +45,6 @@
function xmldb_block_calendar_upcoming_upgrade($oldversion, $block) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -46,9 +46,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_block_community_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -45,9 +45,6 @@
function xmldb_block_quiz_results_upgrade($oldversion, $block) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -45,9 +45,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_enrol_paypal_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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, $DB;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2016052301) {
// Get roles with manager archetype.
$managerroles = get_archetype_roles('manager');
......
......@@ -33,26 +33,6 @@ function xmldb_filter_mathjaxloader_upgrade($oldversion) {
require_once($CFG->dirroot . '/filter/mathjaxloader/db/upgradelib.php');
if ($oldversion < 2016032200) {
$httpurl = get_config('filter_mathjaxloader', 'httpurl');
// Don't change the config if it has been manually changed to something besides the default setting value.
if ($httpurl === "http://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js") {
set_config('httpurl', 'http://cdn.mathjax.org/mathjax/2.6-latest/MathJax.js', 'filter_mathjaxloader');
}
$httpsurl = get_config('filter_mathjaxloader', 'httpsurl');
// Don't change the config if it has been manually changed to something besides the default setting value.
if ($httpsurl === "https://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js") {
set_config('httpsurl', 'https://cdn.mathjax.org/mathjax/2.6-latest/MathJax.js', 'filter_mathjaxloader');
}
upgrade_plugin_savepoint(true, 2016032200, 'filter', 'mathjaxloader');
}
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2016080200) {
// We are consolodating the two settings for http and https url into only the https
// setting. Since it is preferably to always load the secure resource.
......@@ -78,8 +58,10 @@ function xmldb_filter_mathjaxloader_upgrade($oldversion) {
}
upgrade_plugin_savepoint(true, 2016102500, 'filter', 'mathjaxloader');
}
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
//
if ($oldversion < 2017040300) {
$httpsurl = get_config('filter_mathjaxloader', 'httpsurl');
......@@ -97,6 +79,7 @@ function xmldb_filter_mathjaxloader_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017040300, 'filter', 'mathjaxloader');
}
if ($oldversion < 2017042602) {
$httpsurl = get_config('filter_mathjaxloader', 'httpsurl');
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_filter_mediaplugin_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -37,18 +37,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_gradingform_guide_upgrade($oldversion) {
global $DB;
if ($oldversion < 2016051100) {
// Clean up empty string or null marking guide comments.
$sql = $DB->sql_isempty('gradingform_guide_comments', 'description', true, true);
$sql .= " OR description IS NULL ";
$DB->delete_records_select('gradingform_guide_comments', $sql);
// Main savepoint reached.
upgrade_plugin_savepoint(true, 2016051100, 'gradingform', 'guide');
}
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -29,9 +29,6 @@
function xmldb_gradereport_user_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -31,8 +31,6 @@ defined('MOODLE_INTERNAL') || die();
* @return bool
*/
function xmldb_antivirus_clamav_upgrade($oldversion) {
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2016101700) {
// Remove setting that has been deprecated long time ago at MDL-44260.
......
This diff is collapsed.
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_editor_atto_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_message_email_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.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 $CFG, $DB;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
$dbman = $DB->get_manager();
if ($oldversion < 2016052309) {
......
......@@ -34,9 +34,6 @@ function xmldb_assign_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2016100301) {
// Define table assign_overrides to be created.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_assignfeedback_comments_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -34,31 +34,6 @@ function xmldb_assignfeedback_editpdf_upgrade($oldversion) {
$dbman = $DB->get_manager();
if ($oldversion < 2016021600) {
// Define table assignfeedback_editpdf_queue to be created.
$table = new xmldb_table('assignfeedback_editpdf_queue');
// Adding fields to table assignfeedback_editpdf_queue.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('submissionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
$table->add_field('submissionattempt', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
// Adding keys to table assignfeedback_editpdf_queue.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
// Conditionally launch create table for assignfeedback_editpdf_queue.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// Editpdf savepoint reached.
upgrade_plugin_savepoint(true, 2016021600, 'assignfeedback', 'editpdf');
}
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_assignfeedback_file_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_assignsubmission_comments_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_assignsubmission_file_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_assignsubmission_onlinetext_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -24,9 +24,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_assignment_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -32,9 +32,6 @@ defined('MOODLE_INTERNAL') || die;
function xmldb_book_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -27,9 +27,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_chat_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -24,9 +24,6 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_choice_upgrade($oldversion) {
global $CFG;
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
......
......@@ -26,25 +26,6 @@ function xmldb_data_upgrade($oldversion) {
$dbman = $DB->get_manager();
if ($oldversion < 2016030300) {
// Define field timemodified to be added to data.
$table = new xmldb_table('data');
$field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'notification');
// Conditionally launch add field timemodified.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Data savepoint reached.
upgrade_mod_savepoint(true, 2016030300, 'data');
}
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2016090600) {
// Define field config to be added to data.
......
......@@ -42,101 +42,6 @@ function xmldb_feedback_upgrade($oldversion) {
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
if ($oldversion < 2016031600) {