From 58b56e2395286320d81b4d64b09c5cb0a74dc452 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Fri, 3 Jun 2022 18:26:52 +0200 Subject: [PATCH] MDL-71747 upgrade: remove all the < 3.9.0 upgrade steps This just deletes all the upgrade steps previous to 3.9.0. Some small adjustments, like tweaking globals can also be applied when needed. Also includes an upgrade step to prevent upgrading from any version < 2020061500 (v3.9.0) as anti-cheating measure. The next commits will proceed to deprecate / remove functions that were exclusively (usually belonging to upgradelib) being used by those, now removed, upgrade steps. This is the list of code to remove and document in upgrade.txt files: - upgrade_analytics_fix_contextids_defaults() - upgrade_convert_hub_config_site_param_names() - upgrade_rename_prediction_actions_useful_incorrectly_flagged() - \mod_forum\task\refresh_forum_post_counts adhoc task. And these is the code that has NOT been removed because it may be needed later (no matter there aren't uses now): - \core_search\manager::clean_up_non_existing_area(), used by - \core\task\clean_up_deleted_search_area_task adhoc task --- admin/tool/customlang/db/upgrade.php | 9 - admin/tool/dataprivacy/db/upgrade.php | 9 - admin/tool/log/db/upgrade.php | 9 - admin/tool/log/store/database/db/upgrade.php | 16 - admin/tool/log/store/standard/db/upgrade.php | 16 - admin/tool/mobile/db/upgrade.php | 13 - admin/tool/monitor/db/upgrade.php | 9 - admin/tool/policy/db/upgrade.php | 9 - admin/tool/usertours/db/upgrade.php | 9 - auth/cas/db/upgrade.php | 9 - auth/db/db/upgrade.php | 9 - auth/email/db/upgrade.php | 9 - auth/ldap/db/upgrade.php | 9 - auth/manual/db/upgrade.php | 9 - auth/mnet/db/upgrade.php | 9 - auth/none/db/upgrade.php | 9 - auth/oauth2/db/upgrade.php | 45 - auth/shibboleth/db/upgrade.php | 9 - blocks/badges/db/upgrade.php | 9 - blocks/calendar_month/db/upgrade.php | 9 - blocks/calendar_upcoming/db/upgrade.php | 9 - blocks/completionstatus/db/upgrade.php | 9 - blocks/course_summary/db/upgrade.php | 9 - blocks/html/db/upgrade.php | 9 - blocks/myoverview/db/upgrade.php | 45 - blocks/navigation/db/upgrade.php | 9 - blocks/recent_activity/db/upgrade.php | 9 - blocks/recentlyaccesseditems/db/upgrade.php | 25 - blocks/rss_client/db/upgrade.php | 9 - blocks/section_links/db/upgrade.php | 9 - blocks/selfcompletion/db/upgrade.php | 9 - blocks/settings/db/upgrade.php | 9 - blocks/timeline/db/upgrade.php | 9 - course/format/topics/db/upgrade.php | 9 - course/format/weeks/db/upgrade.php | 9 - enrol/database/db/upgrade.php | 9 - enrol/flatfile/db/upgrade.php | 9 - enrol/guest/db/upgrade.php | 9 - enrol/imsenterprise/db/upgrade.php | 9 - enrol/lti/db/upgrade.php | 9 - enrol/manual/db/upgrade.php | 9 - enrol/mnet/db/upgrade.php | 9 - enrol/paypal/db/upgrade.php | 9 - enrol/self/db/upgrade.php | 9 - filter/displayh5p/db/upgrade.php | 24 - filter/mathjaxloader/db/upgrade.php | 21 - filter/mediaplugin/db/upgrade.php | 9 - filter/tex/db/upgrade.php | 9 - grade/grading/form/guide/db/upgrade.php | 9 - grade/grading/form/rubric/db/upgrade.php | 9 - grade/report/overview/db/upgrade.php | 9 - grade/report/user/db/upgrade.php | 9 - lib/antivirus/clamav/db/upgrade.php | 9 - lib/db/upgrade.php | 1726 +---------------- lib/editor/atto/db/upgrade.php | 67 - .../atto/plugins/equation/db/upgrade.php | 9 - lib/editor/tinymce/db/upgrade.php | 9 - .../plugins/spellchecker/db/upgrade.php | 9 - message/output/email/db/upgrade.php | 36 - message/output/popup/db/upgrade.php | 34 - mod/assign/db/upgrade.php | 22 - mod/assign/feedback/comments/db/upgrade.php | 9 - mod/assign/feedback/editpdf/db/upgrade.php | 37 - mod/assign/feedback/file/db/upgrade.php | 9 - mod/assign/submission/comments/db/upgrade.php | 9 - mod/assign/submission/file/db/upgrade.php | 9 - .../submission/onlinetext/db/upgrade.php | 9 - mod/assignment/db/upgrade.php | 9 - mod/book/db/upgrade.php | 9 - mod/chat/db/upgrade.php | 9 - mod/choice/db/upgrade.php | 9 - mod/data/db/upgrade.php | 28 +- mod/feedback/db/upgrade.php | 9 - mod/folder/db/upgrade.php | 9 - mod/forum/db/upgrade.php | 193 -- mod/glossary/db/upgrade.php | 9 - mod/imscp/db/upgrade.php | 9 - mod/label/db/upgrade.php | 9 - mod/lesson/db/upgrade.php | 9 - mod/lti/db/upgrade.php | 100 - mod/page/db/upgrade.php | 9 - mod/quiz/db/upgrade.php | 9 - mod/quiz/report/overview/db/upgrade.php | 11 - mod/quiz/report/statistics/db/upgrade.php | 9 - mod/resource/db/upgrade.php | 9 - mod/scorm/db/upgrade.php | 22 - mod/survey/db/upgrade.php | 9 - mod/url/db/upgrade.php | 9 - mod/wiki/db/upgrade.php | 9 - mod/workshop/db/upgrade.php | 9 - mod/workshop/form/accumulative/db/upgrade.php | 9 - mod/workshop/form/comments/db/upgrade.php | 9 - mod/workshop/form/numerrors/db/upgrade.php | 9 - mod/workshop/form/rubric/db/upgrade.php | 9 - portfolio/googledocs/db/upgrade.php | 9 - .../behaviour/manualgraded/db/upgrade.php | 9 - question/type/calculated/db/upgrade.php | 9 - question/type/ddmarker/db/upgrade.php | 9 - question/type/essay/db/upgrade.php | 9 - question/type/match/db/upgrade.php | 9 - question/type/multianswer/db/upgrade.php | 9 - question/type/multichoice/db/upgrade.php | 31 +- question/type/numerical/db/upgrade.php | 9 - question/type/random/db/upgrade.php | 9 - question/type/randomsamatch/db/upgrade.php | 9 - question/type/shortanswer/db/upgrade.php | 9 - repository/dropbox/db/upgrade.php | 9 - repository/flickr/db/upgrade.php | 9 - repository/googledocs/db/upgrade.php | 9 - repository/onedrive/db/upgrade.php | 9 - 110 files changed, 7 insertions(+), 3315 deletions(-) diff --git a/admin/tool/customlang/db/upgrade.php b/admin/tool/customlang/db/upgrade.php index e1318d6c5458e..be85de3017521 100644 --- a/admin/tool/customlang/db/upgrade.php +++ b/admin/tool/customlang/db/upgrade.php @@ -29,15 +29,6 @@ function xmldb_tool_customlang_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 7d2ab3c6378ec..3cfa09b912919 100644 --- a/admin/tool/dataprivacy/db/upgrade.php +++ b/admin/tool/dataprivacy/db/upgrade.php @@ -35,15 +35,6 @@ function xmldb_tool_dataprivacy_upgrade($oldversion) { $dbman = $DB->get_manager(); - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 d36e5a29324f4..b8477f72701e9 100644 --- a/admin/tool/log/db/upgrade.php +++ b/admin/tool/log/db/upgrade.php @@ -33,15 +33,6 @@ function xmldb_tool_log_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 d8bb4b88675cf..736df698dfb41 100644 --- a/admin/tool/log/store/database/db/upgrade.php +++ b/admin/tool/log/store/database/db/upgrade.php @@ -27,22 +27,6 @@ function xmldb_logstore_database_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2019032800) { - // For existing installations, set the new jsonformat option to off (no behaviour change). - // New installations default to on. - set_config('jsonformat', 0, 'logstore_database'); - upgrade_plugin_savepoint(true, 2019032800, 'logstore', 'database'); - } - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 f2e66d0afca77..6496e66b4465a 100644 --- a/admin/tool/log/store/standard/db/upgrade.php +++ b/admin/tool/log/store/standard/db/upgrade.php @@ -27,22 +27,6 @@ function xmldb_logstore_standard_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2019032800) { - // For existing installations, set the new jsonformat option to off (no behaviour change). - // New installations default to on. - set_config('jsonformat', 0, 'logstore_standard'); - upgrade_plugin_savepoint(true, 2019032800, 'logstore', 'standard'); - } - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.0 release upgrade line. // Put any upgrade step following this. diff --git a/admin/tool/mobile/db/upgrade.php b/admin/tool/mobile/db/upgrade.php index 800f0e9809121..5b79c21fb722e 100644 --- a/admin/tool/mobile/db/upgrade.php +++ b/admin/tool/mobile/db/upgrade.php @@ -35,19 +35,6 @@ function xmldb_tool_mobile_upgrade($oldversion) { global $CFG; - if ($oldversion < 2019021100) { - $disabledfeatures = get_config('tool_mobile', 'disabledfeatures'); - $disabledfeatures = str_replace('remoteAddOn_', 'sitePlugin_', $disabledfeatures); - set_config('disabledfeatures', $disabledfeatures, 'tool_mobile'); - upgrade_plugin_savepoint(true, 2019021100, 'tool', 'mobile'); - } - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 3c5edfedfcb00..248aea174bda3 100644 --- a/admin/tool/monitor/db/upgrade.php +++ b/admin/tool/monitor/db/upgrade.php @@ -33,15 +33,6 @@ function xmldb_tool_monitor_upgrade($oldversion) { global $CFG, $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 5b45b303e655e..8aadda93dd3bc 100644 --- a/admin/tool/policy/db/upgrade.php +++ b/admin/tool/policy/db/upgrade.php @@ -34,15 +34,6 @@ function xmldb_tool_policy_upgrade($oldversion) { global $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 52362af2b7526..9370ea4463d9d 100644 --- a/admin/tool/usertours/db/upgrade.php +++ b/admin/tool/usertours/db/upgrade.php @@ -38,15 +38,6 @@ function xmldb_tool_usertours_upgrade($oldversion) { $dbman = $DB->get_manager(); - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 2123590fbc19c..5e5f5b80b264b 100644 --- a/auth/cas/db/upgrade.php +++ b/auth/cas/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_auth_cas_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 77e956a4e6727..2b45dbc3f3156 100644 --- a/auth/db/db/upgrade.php +++ b/auth/db/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_auth_db_upgrade($oldversion) { global $CFG, $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 ce7bc16f200d6..56313ac00f522 100644 --- a/auth/email/db/upgrade.php +++ b/auth/email/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_auth_email_upgrade($oldversion) { global $CFG, $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 aefeeae32cc9e..8f9d9aedf23f6 100644 --- a/auth/ldap/db/upgrade.php +++ b/auth/ldap/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_auth_ldap_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 bb03f71a5b6be..61126d77cf000 100644 --- a/auth/manual/db/upgrade.php +++ b/auth/manual/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_auth_manual_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 3264f35c97085..93b4b7414fd60 100644 --- a/auth/mnet/db/upgrade.php +++ b/auth/mnet/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_auth_mnet_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 5bda9d12d33a8..1ed589755e52e 100644 --- a/auth/none/db/upgrade.php +++ b/auth/none/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_auth_none_upgrade($oldversion) { global $CFG, $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 8627ce61729b2..f63f1b95890d9 100644 --- a/auth/oauth2/db/upgrade.php +++ b/auth/oauth2/db/upgrade.php @@ -33,51 +33,6 @@ function xmldb_auth_oauth2_upgrade($oldversion) { global $DB; - $dbman = $DB->get_manager(); - - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2019052001) { - // Fetch Facebook, Google, and Microsoft issuers. We use the URL field to determine the issuer type as it's the only - // field that contains the keyword that can somewhat let us reliably determine the issuer type. - $likefacebook = $DB->sql_like('oe.url', ':facebook'); - $likegoogle = $DB->sql_like('oe.url', ':google'); - $likemicrosoft = $DB->sql_like('oe.url', ':microsoft'); - - $params = [ - 'facebook' => '%facebook%', - 'google' => '%google%', - 'microsoft' => '%microsoft%', - ]; - - // We're querying from the oauth2_endpoint table because the base URLs of FB and Microsoft can be empty in the issuer table. - $subsql = " - SELECT DISTINCT oe.issuerid - FROM {oauth2_endpoint} oe - WHERE $likefacebook - OR $likegoogle - OR $likemicrosoft"; - - // Update non-Facebook/Google/Microsoft issuers and set requireconfirmation to 1. - $updatesql = " - UPDATE {oauth2_issuer} - SET requireconfirmation = 1 - WHERE id NOT IN ({$subsql})"; - $DB->execute($updatesql, $params); - - // Delete linked logins for non-Facebook/Google/Microsoft issuers. They can easily re-link their logins anyway. - $DB->delete_records_select('auth_oauth2_linked_login', "issuerid NOT IN ($subsql)", $params); - - upgrade_plugin_savepoint(true, 2019052001, 'auth', 'oauth2'); - } - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 772c5829d8282..e38ff299765b1 100644 --- a/auth/shibboleth/db/upgrade.php +++ b/auth/shibboleth/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_auth_shibboleth_upgrade($oldversion) { global $CFG, $DB, $OUTPUT; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 43f4e4bab2741..dd7a28c051501 100644 --- a/blocks/badges/db/upgrade.php +++ b/blocks/badges/db/upgrade.php @@ -45,15 +45,6 @@ function xmldb_block_badges_upgrade($oldversion, $block) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 8aa35f5f492fe..34d29c3ae4916 100644 --- a/blocks/calendar_month/db/upgrade.php +++ b/blocks/calendar_month/db/upgrade.php @@ -49,15 +49,6 @@ function xmldb_block_calendar_month_upgrade($oldversion, $block) { global $CFG, $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 9c5be729205e4..035376b9edc94 100644 --- a/blocks/calendar_upcoming/db/upgrade.php +++ b/blocks/calendar_upcoming/db/upgrade.php @@ -45,15 +45,6 @@ function xmldb_block_calendar_upcoming_upgrade($oldversion, $block) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 f4bc358f7cdc4..a1bff97a45152 100644 --- a/blocks/completionstatus/db/upgrade.php +++ b/blocks/completionstatus/db/upgrade.php @@ -48,15 +48,6 @@ function xmldb_block_completionstatus_upgrade($oldversion, $block) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 2ef89cb040b79..1ce524a77328d 100644 --- a/blocks/course_summary/db/upgrade.php +++ b/blocks/course_summary/db/upgrade.php @@ -48,15 +48,6 @@ function xmldb_block_course_summary_upgrade($oldversion, $block) { global $CFG, $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 e09a469589ef5..c8516356bc6c6 100644 --- a/blocks/html/db/upgrade.php +++ b/blocks/html/db/upgrade.php @@ -33,15 +33,6 @@ function xmldb_block_html_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.0 release upgrade line. // Put any upgrade step following this. diff --git a/blocks/myoverview/db/upgrade.php b/blocks/myoverview/db/upgrade.php index cdd2203ef4cb4..6c5d6666f19e3 100644 --- a/blocks/myoverview/db/upgrade.php +++ b/blocks/myoverview/db/upgrade.php @@ -36,51 +36,6 @@ function xmldb_block_myoverview_upgrade($oldversion) { global $DB, $CFG, $OUTPUT; - if ($oldversion < 2019091800) { - // Remove orphaned course favourites, which weren't being deleted when the course was deleted. - $sql = 'SELECT f.id - FROM {favourite} f - LEFT JOIN {course} c - ON (c.id = f.itemid) - WHERE f.component = :component - AND f.itemtype = :itemtype - AND c.id IS NULL'; - $params = ['component' => 'core_course', 'itemtype' => 'courses']; - - if ($records = $DB->get_fieldset_sql($sql, $params)) { - $chunks = array_chunk($records, 1000); - foreach ($chunks as $chunk) { - list($insql, $inparams) = $DB->get_in_or_equal($chunk); - $DB->delete_records_select('favourite', "id $insql", $inparams); - } - } - - upgrade_block_savepoint(true, 2019091800, 'myoverview', false); - } - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2019111801) { - // Renaming the setting from displaygroupingstarred to displaygroupingfavourites to match Moodle convention. - - // Check to see if record exists. get_config doesn't allow differentiation between not exists and false. - $dbval = $DB->get_field('config_plugins', 'value', ['plugin' => 'block_myoverview', 'name' => 'displaygroupingstarred']); - if ($dbval !== false) { - set_config('displaygroupingfavourites', $dbval, 'block_myoverview'); - unset_config('displaygroupingstarred', 'block_myoverview'); - } - - if (isset($CFG->forced_plugin_settings['block_myoverview']['displaygroupingstarred'])) { - // Check to see if the starred setting is defined in the config file. Display a warning if so. - $warn = 'Setting block_myoverview->displaygroupingstarred has been renamed '. - 'to block_myoverview->displaygroupingfavourites. Old setting present in config.php.'; - echo $OUTPUT->notification($warn, 'notifyproblem'); - } - - upgrade_block_savepoint(true, 2019111801, 'myoverview', false); - } - // Automatically generated Moodle v3.9.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 67b3b4b7bdfc4..ae213fdc735e1 100644 --- a/blocks/navigation/db/upgrade.php +++ b/blocks/navigation/db/upgrade.php @@ -55,15 +55,6 @@ function xmldb_block_navigation_upgrade($oldversion, $block) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 24e7a8676dfe3..e2968035d1855 100644 --- a/blocks/recent_activity/db/upgrade.php +++ b/blocks/recent_activity/db/upgrade.php @@ -47,15 +47,6 @@ function xmldb_block_recent_activity_upgrade($oldversion, $block) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.0 release upgrade line. // Put any upgrade step following this. diff --git a/blocks/recentlyaccesseditems/db/upgrade.php b/blocks/recentlyaccesseditems/db/upgrade.php index e0cf93332cff3..bb33d1718fac9 100644 --- a/blocks/recentlyaccesseditems/db/upgrade.php +++ b/blocks/recentlyaccesseditems/db/upgrade.php @@ -49,31 +49,6 @@ function xmldb_block_recentlyaccesseditems_upgrade($oldversion, $block) { global $DB; - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - if ($oldversion < 2019052001) { - // Query the items to be deleted as a list of IDs. We cannot delete directly from this as a - // subquery because MySQL does not support delete with subqueries. - $fordeletion = $DB->get_fieldset_sql(" - SELECT rai.id - FROM {block_recentlyaccesseditems} rai - LEFT JOIN {course} c ON c.id = rai.courseid - LEFT JOIN {course_modules} cm ON cm.id = rai.cmid - WHERE c.id IS NULL OR cm.id IS NULL"); - - // Delete the array in chunks of 500 (Oracle does not support more than 1000 parameters, - // let's leave some leeway, there are likely only one chunk anyway). - $chunks = array_chunk($fordeletion, 500); - foreach ($chunks as $chunk) { - $DB->delete_records_list('block_recentlyaccesseditems', 'id', $chunk); - } - - upgrade_block_savepoint(true, 2019052001, 'recentlyaccesseditems', false); - } - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 e01c79936deea..7a4b05cb606f0 100644 --- a/blocks/rss_client/db/upgrade.php +++ b/blocks/rss_client/db/upgrade.php @@ -33,15 +33,6 @@ function xmldb_block_rss_client_upgrade($oldversion) { global $CFG, $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 1549c7b364e9c..e5994719a99af 100644 --- a/blocks/section_links/db/upgrade.php +++ b/blocks/section_links/db/upgrade.php @@ -49,15 +49,6 @@ function xmldb_block_section_links_upgrade($oldversion, $block) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 ffb8dfc99c3b3..291942115020c 100644 --- a/blocks/selfcompletion/db/upgrade.php +++ b/blocks/selfcompletion/db/upgrade.php @@ -48,15 +48,6 @@ function xmldb_block_selfcompletion_upgrade($oldversion, $block) { global $CFG, $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 32963387bcfdb..7563270fcaf9c 100644 --- a/blocks/settings/db/upgrade.php +++ b/blocks/settings/db/upgrade.php @@ -55,15 +55,6 @@ function xmldb_block_settings_upgrade($oldversion, $block) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.0 release upgrade line. // Put any upgrade step following this. diff --git a/blocks/timeline/db/upgrade.php b/blocks/timeline/db/upgrade.php index bc05e0738f7e4..e57656360e762 100644 --- a/blocks/timeline/db/upgrade.php +++ b/blocks/timeline/db/upgrade.php @@ -48,15 +48,6 @@ function xmldb_block_timeline_upgrade($oldversion, $block) { global $CFG, $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 5ac1908711e2d..107fcc70e902d 100644 --- a/course/format/topics/db/upgrade.php +++ b/course/format/topics/db/upgrade.php @@ -33,15 +33,6 @@ function xmldb_format_topics_upgrade($oldversion) { global $CFG, $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 a7f06f6ab2739..450637118d13c 100644 --- a/course/format/weeks/db/upgrade.php +++ b/course/format/weeks/db/upgrade.php @@ -33,15 +33,6 @@ function xmldb_format_weeks_upgrade($oldversion) { global $CFG, $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 11267b11df42c..4c5f4988b16b1 100644 --- a/enrol/database/db/upgrade.php +++ b/enrol/database/db/upgrade.php @@ -27,15 +27,6 @@ function xmldb_enrol_database_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 6dce6a9948811..de858b0b9f15d 100644 --- a/enrol/flatfile/db/upgrade.php +++ b/enrol/flatfile/db/upgrade.php @@ -27,15 +27,6 @@ function xmldb_enrol_flatfile_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 0ccf3dbdc014c..7b95f4611ea43 100644 --- a/enrol/guest/db/upgrade.php +++ b/enrol/guest/db/upgrade.php @@ -27,15 +27,6 @@ function xmldb_enrol_guest_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 2b0aa1828e398..3461481064d95 100644 --- a/enrol/imsenterprise/db/upgrade.php +++ b/enrol/imsenterprise/db/upgrade.php @@ -33,15 +33,6 @@ function xmldb_enrol_imsenterprise_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 3b852efc25f41..92da6cab9b9d9 100644 --- a/enrol/lti/db/upgrade.php +++ b/enrol/lti/db/upgrade.php @@ -40,15 +40,6 @@ function xmldb_enrol_lti_upgrade($oldversion) { global $CFG, $OUTPUT, $DB; $dbman = $DB->get_manager(); - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 0dfb8696b6688..33eefc6cb131c 100644 --- a/enrol/manual/db/upgrade.php +++ b/enrol/manual/db/upgrade.php @@ -27,15 +27,6 @@ function xmldb_enrol_manual_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 078d69125c3b4..dfe361709e2df 100644 --- a/enrol/mnet/db/upgrade.php +++ b/enrol/mnet/db/upgrade.php @@ -27,15 +27,6 @@ function xmldb_enrol_mnet_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 1f9dff709a5fd..4c2a2ad3f4c1f 100644 --- a/enrol/paypal/db/upgrade.php +++ b/enrol/paypal/db/upgrade.php @@ -45,15 +45,6 @@ function xmldb_enrol_paypal_upgrade($oldversion) { global $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 9d8bf12fadac8..bd8abd163070e 100644 --- a/enrol/self/db/upgrade.php +++ b/enrol/self/db/upgrade.php @@ -27,15 +27,6 @@ function xmldb_enrol_self_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.0 release upgrade line. // Put any upgrade step following this. diff --git a/filter/displayh5p/db/upgrade.php b/filter/displayh5p/db/upgrade.php index e001cac4f9872..9ec96b9c6d1e6 100644 --- a/filter/displayh5p/db/upgrade.php +++ b/filter/displayh5p/db/upgrade.php @@ -33,30 +33,6 @@ function xmldb_filter_displayh5p_upgrade($oldversion) { global $CFG; - require_once($CFG->dirroot . '/filter/displayh5p/db/upgradelib.php'); - - if ($oldversion < 2019110800) { - // We need to move up the displayh5p filter over urltolink and activitynames filters to works properly. - filter_displayh5p_reorder(); - - upgrade_plugin_savepoint(true, 2019110800, 'filter', 'displayh5p'); - } - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2020031700) { - // References to h5p.org has to be removed as default value for the allowedsources in the filter because H5P is going - // to close it down completely so that only the author can see the test content. - $h5porgurl = 'https://h5p.org/h5p/embed/[id]'; - $config = get_config('filter_displayh5p', 'allowedsources'); - if (strpos($config, $h5porgurl) !== false) { - set_config('allowedsources', str_replace($h5porgurl, '', $config), 'filter_displayh5p'); - } - - upgrade_plugin_savepoint(true, 2020031700, 'filter', 'displayh5p'); - } - // Automatically generated Moodle v3.9.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 0570b109679b8..359320031a725 100644 --- a/filter/mathjaxloader/db/upgrade.php +++ b/filter/mathjaxloader/db/upgrade.php @@ -31,27 +31,6 @@ function xmldb_filter_mathjaxloader_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2020050401) { - // Update CDN url. - $originalurl = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js'; - $newurl = 'https://cdn.jsdelivr.net/npm/mathjax@2.7.8/MathJax.js'; - $currenturl = get_config('filter_mathjaxloader', 'httpsurl'); - if ($currenturl == $originalurl) { - set_config('httpsurl', $newurl, 'filter_mathjaxloader'); - } - - upgrade_plugin_savepoint(true, 2020050401, 'filter', 'mathjaxloader'); - } - // Automatically generated Moodle v3.9.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 f65a05a0f2470..bcfbbaa7d009f 100644 --- a/filter/mediaplugin/db/upgrade.php +++ b/filter/mediaplugin/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_filter_mediaplugin_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 be5b12e73153a..22fa10b54b9b6 100644 --- a/filter/tex/db/upgrade.php +++ b/filter/tex/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_filter_tex_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 ad84f2aef7ad6..e20aa67f2225a 100644 --- a/grade/grading/form/guide/db/upgrade.php +++ b/grade/grading/form/guide/db/upgrade.php @@ -37,15 +37,6 @@ function xmldb_gradingform_guide_upgrade($oldversion) { global $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 1cdeff373dd74..ef9112ad5643f 100644 --- a/grade/grading/form/rubric/db/upgrade.php +++ b/grade/grading/form/rubric/db/upgrade.php @@ -33,15 +33,6 @@ function xmldb_gradingform_rubric_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 e0432d498691b..9b0256924f295 100644 --- a/grade/report/overview/db/upgrade.php +++ b/grade/report/overview/db/upgrade.php @@ -32,15 +32,6 @@ */ function xmldb_gradereport_overview_upgrade($oldversion) { - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 04aa32482ad8f..4cbbf2cf80b93 100644 --- a/grade/report/user/db/upgrade.php +++ b/grade/report/user/db/upgrade.php @@ -29,15 +29,6 @@ function xmldb_gradereport_user_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 f021179b4aa3c..99ba56d580303 100644 --- a/lib/antivirus/clamav/db/upgrade.php +++ b/lib/antivirus/clamav/db/upgrade.php @@ -32,15 +32,6 @@ */ function xmldb_antivirus_clamav_upgrade($oldversion) { - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.0 release upgrade line. // Put any upgrade step following this. diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 669ea4dc90b4e..2a81dd07fd588 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -92,1734 +92,18 @@ 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.6.0 right now). - if ($oldversion < 2018120300) { + // allowed version to upgrade from (v3.9.0 right now). + if ($oldversion < 2020061500) { // Just in case somebody hacks upgrade scripts or env, we really can not continue. - echo("You need to upgrade to 3.6.x or higher first!\n"); + echo("You need to upgrade to 3.9.x or higher first!\n"); exit(1); // Note this savepoint is 100% unreachable, but needed to pass the upgrade checks. - upgrade_main_savepoint(true, 2018120300); - } - - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2018120300.01) { - // Update the FB logo URL. - $oldurl = 'https://facebookbrand.com/wp-content/themes/fb-branding/prj-fb-branding/assets/images/fb-art.png'; - $newurl = 'https://facebookbrand.com/wp-content/uploads/2016/05/flogo_rgb_hex-brc-site-250.png'; - - $updatesql = "UPDATE {oauth2_issuer} - SET image = :newimage - WHERE " . $DB->sql_compare_text('image', 100). " = :oldimage"; - $params = [ - 'newimage' => $newurl, - 'oldimage' => $oldurl - ]; - $DB->execute($updatesql, $params); - - upgrade_main_savepoint(true, 2018120300.01); - } - - if ($oldversion < 2018120300.02) { - // Set all individual conversations to enabled. - $updatesql = "UPDATE {message_conversations} - SET enabled = :enabled - WHERE type = :type"; - $DB->execute($updatesql, ['enabled' => 1, 'type' => 1]); - - upgrade_main_savepoint(true, 2018120300.02); - } - - if ($oldversion < 2018120301.02) { - upgrade_delete_orphaned_file_records(); - upgrade_main_savepoint(true, 2018120301.02); - } - - if ($oldversion < 2019011500.00) { - // Define table task_log to be created. - $table = new xmldb_table('task_log'); - - // Adding fields to table task_log. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('type', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, null); - $table->add_field('component', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null); - $table->add_field('classname', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null); - $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('timestart', XMLDB_TYPE_NUMBER, '20, 10', null, XMLDB_NOTNULL, null, null); - $table->add_field('timeend', XMLDB_TYPE_NUMBER, '20, 10', null, XMLDB_NOTNULL, null, null); - $table->add_field('dbreads', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('dbwrites', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('result', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, null); - - // Adding keys to table task_log. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - - // Adding indexes to table task_log. - $table->add_index('classname', XMLDB_INDEX_NOTUNIQUE, ['classname']); - $table->add_index('timestart', XMLDB_INDEX_NOTUNIQUE, ['timestart']); - - // Conditionally launch create table for task_log. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019011500.00); - } - - if ($oldversion < 2019011501.00) { - // Define field output to be added to task_log. - $table = new xmldb_table('task_log'); - $field = new xmldb_field('output', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null, 'result'); - - // Conditionally launch add field output. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019011501.00); - } - - if ($oldversion < 2019011801.00) { - - // Define table customfield_category to be created. - $table = new xmldb_table('customfield_category'); - - // Adding fields to table customfield_category. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('name', XMLDB_TYPE_CHAR, '400', null, XMLDB_NOTNULL, null, null); - $table->add_field('description', XMLDB_TYPE_TEXT, null, null, null, null, null); - $table->add_field('descriptionformat', XMLDB_TYPE_INTEGER, '10', null, null, null, null); - $table->add_field('sortorder', 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); - $table->add_field('component', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null); - $table->add_field('area', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null); - $table->add_field('itemid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0'); - $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, null, null, null); - - // Adding keys to table customfield_category. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - $table->add_key('contextid', XMLDB_KEY_FOREIGN, ['contextid'], 'context', ['id']); - - // Adding indexes to table customfield_category. - $table->add_index('component_area_itemid', XMLDB_INDEX_NOTUNIQUE, ['component', 'area', 'itemid', 'sortorder']); - - // Conditionally launch create table for customfield_category. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Define table customfield_field to be created. - $table = new xmldb_table('customfield_field'); - - // Adding fields to table customfield_field. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('shortname', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null); - $table->add_field('name', XMLDB_TYPE_CHAR, '400', null, XMLDB_NOTNULL, null, null); - $table->add_field('type', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null); - $table->add_field('description', XMLDB_TYPE_TEXT, null, null, null, null, null); - $table->add_field('descriptionformat', XMLDB_TYPE_INTEGER, '10', null, null, null, null); - $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, null, null, null); - $table->add_field('categoryid', XMLDB_TYPE_INTEGER, '10', null, null, null, null); - $table->add_field('configdata', XMLDB_TYPE_TEXT, null, null, null, null, null); - $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - - // Adding keys to table customfield_field. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - $table->add_key('categoryid', XMLDB_KEY_FOREIGN, ['categoryid'], 'customfield_category', ['id']); - - // Adding indexes to table customfield_field. - $table->add_index('categoryid_sortorder', XMLDB_INDEX_NOTUNIQUE, ['categoryid', 'sortorder']); - - // Conditionally launch create table for customfield_field. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Define table customfield_data to be created. - $table = new xmldb_table('customfield_data'); - - // Adding fields to table customfield_data. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('fieldid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('instanceid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('intvalue', XMLDB_TYPE_INTEGER, '10', null, null, null, null); - $table->add_field('decvalue', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null); - $table->add_field('shortcharvalue', XMLDB_TYPE_CHAR, '255', null, null, null, null); - $table->add_field('charvalue', XMLDB_TYPE_CHAR, '1333', null, null, null, null); - $table->add_field('value', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null); - $table->add_field('valueformat', 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); - $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, null, null, null); - - // Adding keys to table customfield_data. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - $table->add_key('fieldid', XMLDB_KEY_FOREIGN, ['fieldid'], 'customfield_field', ['id']); - $table->add_key('contextid', XMLDB_KEY_FOREIGN, ['contextid'], 'context', ['id']); - - // Adding indexes to table customfield_data. - $table->add_index('instanceid-fieldid', XMLDB_INDEX_UNIQUE, ['instanceid', 'fieldid']); - $table->add_index('fieldid-intvalue', XMLDB_INDEX_NOTUNIQUE, ['fieldid', 'intvalue']); - $table->add_index('fieldid-shortcharvalue', XMLDB_INDEX_NOTUNIQUE, ['fieldid', 'shortcharvalue']); - $table->add_index('fieldid-decvalue', XMLDB_INDEX_NOTUNIQUE, ['fieldid', 'decvalue']); - - // Conditionally launch create table for customfield_data. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - upgrade_main_savepoint(true, 2019011801.00); - } - - if ($oldversion < 2019011801.01) { - - // Delete all files that have been used in sections, which are already deleted. - $sql = "SELECT DISTINCT f.itemid as sectionid, f.contextid - FROM {files} f - LEFT JOIN {course_sections} s ON f.itemid = s.id - WHERE f.component = :component AND f.filearea = :filearea AND s.id IS NULL "; - - $params = [ - 'component' => 'course', - 'filearea' => 'section' - ]; - - $stalefiles = $DB->get_recordset_sql($sql, $params); - - $fs = get_file_storage(); - foreach ($stalefiles as $stalefile) { - $fs->delete_area_files($stalefile->contextid, 'course', 'section', $stalefile->sectionid); - } - $stalefiles->close(); - - upgrade_main_savepoint(true, 2019011801.01); - } - - if ($oldversion < 2019011801.02) { - // Add index 'useridfrom' to the table 'notifications'. - $table = new xmldb_table('notifications'); - $index = new xmldb_index('useridfrom', XMLDB_INDEX_NOTUNIQUE, ['useridfrom']); - - if (!$dbman->index_exists($table, $index)) { - $dbman->add_index($table, $index); - } - - upgrade_main_savepoint(true, 2019011801.02); - } - - if ($oldversion < 2019011801.03) { - // Remove duplicate entries from group memberships. - // Find records with multiple userid/groupid combinations and find the highest ID. - // Later we will remove all those entries. - $sql = " - SELECT MIN(id) as minid, userid, groupid - FROM {groups_members} - GROUP BY userid, groupid - HAVING COUNT(id) > 1"; - if ($duplicatedrows = $DB->get_recordset_sql($sql)) { - foreach ($duplicatedrows as $row) { - $DB->delete_records_select('groups_members', - 'userid = :userid AND groupid = :groupid AND id <> :minid', (array)$row); - } - } - $duplicatedrows->close(); - - // Define key useridgroupid (unique) to be added to group_members. - $table = new xmldb_table('groups_members'); - $key = new xmldb_key('useridgroupid', XMLDB_KEY_UNIQUE, array('userid', 'groupid')); - // Launch add key useridgroupid. - $dbman->add_key($table, $key); - // Main savepoint reached. - upgrade_main_savepoint(true, 2019011801.03); - } - - if ($oldversion < 2019021500.01) { - $insights = $DB->get_record('message_providers', ['component' => 'moodle', 'name' => 'insights']); - if (!empty($insights)) { - $insights->capability = null; - $DB->update_record('message_providers', $insights); - } - upgrade_main_savepoint(true, 2019021500.01); - } - - if ($oldversion < 2019021500.02) { - // Default 'off' for existing sites as this is the behaviour they had earlier. - set_config('messagingdefaultpressenter', false); - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019021500.02); - } - - if ($oldversion < 2019030100.01) { - // Create adhoc task to delete renamed My Course search area (ID core_course-mycourse). - $record = new \stdClass(); - $record->classname = '\core\task\clean_up_deleted_search_area_task'; - $record->component = 'core'; - - // Next run time based from nextruntime computation in \core\task\manager::queue_adhoc_task(). - $nextruntime = time() - 1; - $record->nextruntime = $nextruntime; - $record->customdata = json_encode('core_course-mycourse'); - - $DB->insert_record('task_adhoc', $record); - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019030100.01); - } - - if ($oldversion < 2019030700.01) { - - // Define field evaluationmode to be added to analytics_models_log. - $table = new xmldb_table('analytics_models_log'); - $field = new xmldb_field('evaluationmode', XMLDB_TYPE_CHAR, '50', null, null, null, - null, 'version'); - - // Conditionally launch add field evaluationmode. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - - $updatesql = "UPDATE {analytics_models_log} - SET evaluationmode = 'configuration'"; - $DB->execute($updatesql, []); - - // Changing nullability of field evaluationmode on table block_instances to not null. - $field = new xmldb_field('evaluationmode', XMLDB_TYPE_CHAR, '50', null, XMLDB_NOTNULL, - null, null, 'version'); - - // Launch change of nullability for field evaluationmode. - $dbman->change_field_notnull($table, $field); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019030700.01); - } - - if ($oldversion < 2019030800.00) { - // Define table 'message_conversation_actions' to be created. - // Note - I would have preferred 'message_conversation_user_actions' but due to Oracle we can't. Boo. - $table = new xmldb_table('message_conversation_actions'); - - // Adding fields to table 'message_conversation_actions'. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('conversationid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('action', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - - // Adding keys to table 'message_conversation_actions'. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - $table->add_key('userid', XMLDB_KEY_FOREIGN, ['userid'], 'user', ['id']); - $table->add_key('conversationid', XMLDB_KEY_FOREIGN, ['conversationid'], 'message_conversations', ['id']); - - // Conditionally launch create table for 'message_conversation_actions'. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019030800.00); - } - - if ($oldversion < 2019030800.02) { - // Remove any conversations and their members associated with non-existent groups. - $sql = "SELECT mc.id - FROM {message_conversations} mc - LEFT JOIN {groups} g - ON mc.itemid = g.id - WHERE mc.component = :component - AND mc.itemtype = :itemtype - AND g.id is NULL"; - $conversations = $DB->get_records_sql($sql, ['component' => 'core_group', 'itemtype' => 'groups']); - - if ($conversations) { - $conversationids = array_keys($conversations); - - $DB->delete_records_list('message_conversations', 'id', $conversationids); - $DB->delete_records_list('message_conversation_members', 'conversationid', $conversationids); - $DB->delete_records_list('message_conversation_actions', 'conversationid', $conversationids); - - // Now, go through each conversation and delete any messages and related message actions. - foreach ($conversationids as $conversationid) { - if ($messages = $DB->get_records('messages', ['conversationid' => $conversationid])) { - $messageids = array_keys($messages); - - // Delete the actions. - list($insql, $inparams) = $DB->get_in_or_equal($messageids); - $DB->delete_records_select('message_user_actions', "messageid $insql", $inparams); - - // Delete the messages. - $DB->delete_records('messages', ['conversationid' => $conversationid]); - } - } - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019030800.02); - } - - if ($oldversion < 2019030800.03) { - - // Add missing indicators to course_dropout. - $params = [ - 'target' => '\core\analytics\target\course_dropout', - 'trained' => 0, - 'enabled' => 0, - ]; - $models = $DB->get_records('analytics_models', $params); - foreach ($models as $model) { - $indicators = json_decode($model->indicators); - - $potentiallymissingindicators = [ - '\core_course\analytics\indicator\completion_enabled', - '\core_course\analytics\indicator\potential_cognitive_depth', - '\core_course\analytics\indicator\potential_social_breadth', - '\core\analytics\indicator\any_access_after_end', - '\core\analytics\indicator\any_access_before_start', - '\core\analytics\indicator\any_write_action_in_course', - '\core\analytics\indicator\read_actions' - ]; - - $missing = false; - foreach ($potentiallymissingindicators as $potentiallymissingindicator) { - if (!in_array($potentiallymissingindicator, $indicators)) { - // Add the missing indicator to sites upgraded before 2017072000.02. - $indicators[] = $potentiallymissingindicator; - $missing = true; - } - } - - if ($missing) { - $model->indicators = json_encode($indicators); - $model->version = time(); - $model->timemodified = time(); - $DB->update_record('analytics_models', $model); - } - } - - // Add missing indicators to no_teaching. - $params = [ - 'target' => '\core\analytics\target\no_teaching', - ]; - $models = $DB->get_records('analytics_models', $params); - foreach ($models as $model) { - $indicators = json_decode($model->indicators); - if (!in_array('\core_course\analytics\indicator\no_student', $indicators)) { - // Add the missing indicator to sites upgraded before 2017072000.02. - - $indicators[] = '\core_course\analytics\indicator\no_student'; - - $model->indicators = json_encode($indicators); - $model->version = time(); - $model->timemodified = time(); - $DB->update_record('analytics_models', $model); - } - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019030800.03); - } - - if ($oldversion < 2019031500.01) { - - $defaulttimesplittings = get_config('analytics', 'timesplittings'); - if ($defaulttimesplittings !== false) { - set_config('defaulttimesplittingsevaluation', $defaulttimesplittings, 'analytics'); - unset_config('timesplittings', 'analytics'); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019031500.01); - } - - if ($oldversion < 2019032200.02) { - // The no_teaching model might have been marked as not-trained by mistake (static models are always trained). - $DB->set_field('analytics_models', 'trained', 1, ['target' => '\core\analytics\target\no_teaching']); - upgrade_main_savepoint(true, 2019032200.02); - } - - if ($oldversion < 2019032900.00) { - - // Define table badge_competencies to be renamed to badge_alignment. - $table = new xmldb_table('badge_competencies'); - - // Be careful if this step gets run twice. - if ($dbman->table_exists($table)) { - $key = new xmldb_key('competenciesbadge', XMLDB_KEY_FOREIGN, ['badgeid'], 'badge', ['id']); - - // Launch drop key competenciesbadge. - $dbman->drop_key($table, $key); - - $key = new xmldb_key('alignmentsbadge', XMLDB_KEY_FOREIGN, ['badgeid'], 'badge', ['id']); - - // Launch add key alignmentsbadge. - $dbman->add_key($table, $key); - - // Launch rename table for badge_alignment. - $dbman->rename_table($table, 'badge_alignment'); - } - - upgrade_main_savepoint(true, 2019032900.00); - } - - if ($oldversion < 2019032900.01) { - $sql = "UPDATE {task_scheduled} - SET classname = ? - WHERE component = ? - AND classname = ?"; - $DB->execute($sql, [ - '\core\task\question_preview_cleanup_task', - 'moodle', - '\core\task\question_cron_task' - ]); - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019032900.01); - } - - if ($oldversion < 2019040200.01) { - // Removing the themes BSB, Clean, More from core. - // If these theme wish to be retained empty this array before upgrade. - $themes = array('theme_bootstrapbase' => 'bootstrapbase', - 'theme_clean' => 'clean', 'theme_more' => 'more'); - foreach ($themes as $key => $theme) { - if (check_dir_exists($CFG->dirroot . '/theme/' . $theme, false)) { - // Ignore the themes that have been re-downloaded. - unset($themes[$key]); - } - } - // Check we actually have themes to remove. - if (count($themes) > 0) { - list($insql, $inparams) = $DB->get_in_or_equal($themes, SQL_PARAMS_NAMED); - - // Replace the theme usage. - $DB->set_field_select('course', 'theme', 'classic', "theme $insql", $inparams); - $DB->set_field_select('course_categories', 'theme', 'classic', "theme $insql", $inparams); - $DB->set_field_select('user', 'theme', 'classic', "theme $insql", $inparams); - $DB->set_field_select('mnet_host', 'theme', 'classic', "theme $insql", $inparams); - $DB->set_field_select('cohort', 'theme', 'classic', "theme $insql", $inparams); - - // Replace the theme configs. - if (in_array(get_config('core', 'theme'), $themes)) { - set_config('theme', 'classic'); - } - if (in_array(get_config('core', 'thememobile'), $themes)) { - set_config('thememobile', 'classic'); - } - if (in_array(get_config('core', 'themelegacy'), $themes)) { - set_config('themelegacy', 'classic'); - } - if (in_array(get_config('core', 'themetablet'), $themes)) { - set_config('themetablet', 'classic'); - } - - // Hacky emulation of plugin uninstallation. - foreach ($themes as $key => $theme) { - unset_all_config_for_plugin($key); - } - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019040200.01); - } - - if ($oldversion < 2019040600.02) { - - // Define key fileid (foreign) to be dropped form analytics_train_samples. - $table = new xmldb_table('analytics_train_samples'); - $key = new xmldb_key('fileid', XMLDB_KEY_FOREIGN, ['fileid'], 'files', ['id']); - - // Launch drop key fileid. - $dbman->drop_key($table, $key); - - // Define field fileid to be dropped from analytics_train_samples. - $table = new xmldb_table('analytics_train_samples'); - $field = new xmldb_field('fileid'); - - // Conditionally launch drop field fileid. - if ($dbman->field_exists($table, $field)) { - $dbman->drop_field($table, $field); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019040600.02); - } - - if ($oldversion < 2019040600.04) { - // Define field and index to be added to backup_controllers. - $table = new xmldb_table('backup_controllers'); - $field = new xmldb_field('progress', XMLDB_TYPE_NUMBER, '15, 14', null, XMLDB_NOTNULL, null, '0', 'timemodified'); - $index = new xmldb_index('useritem_ix', XMLDB_INDEX_NOTUNIQUE, ['userid', 'itemid']); - // Conditionally launch add field progress. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - // Conditionally launch add index useritem_ix. - if (!$dbman->index_exists($table, $index)) { - $dbman->add_index($table, $index); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019040600.04); - } - - if ($oldversion < 2019041000.02) { - - // Define field fullmessagetrust to be added to messages. - $table = new xmldb_table('messages'); - $field = new xmldb_field('fullmessagetrust', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'timecreated'); - - // Conditionally launch add field fullmessagetrust. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019041000.02); - } - - if ($oldversion < 2019041300.01) { - // Add the field 'name' to the 'analytics_models' table. - $table = new xmldb_table('analytics_models'); - $field = new xmldb_field('name', XMLDB_TYPE_CHAR, '1333', null, null, null, null, 'trained'); - - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - // Main savepoint reached. - upgrade_main_savepoint(true, 2019041300.01); - } - - if ($oldversion < 2019041800.01) { - // STEP 1. For the existing and migrated self-conversations, set the type to the new MESSAGE_CONVERSATION_TYPE_SELF, update - // the convhash and star them. - $sql = "SELECT mcm.conversationid, mcm.userid, MAX(mcm.id) as maxid - FROM {message_conversation_members} mcm - INNER JOIN {user} u ON mcm.userid = u.id - WHERE u.deleted = 0 - GROUP BY mcm.conversationid, mcm.userid - HAVING COUNT(*) > 1"; - $selfconversationsrs = $DB->get_recordset_sql($sql); - $maxids = []; - foreach ($selfconversationsrs as $selfconversation) { - $DB->update_record('message_conversations', - ['id' => $selfconversation->conversationid, - 'type' => \core_message\api::MESSAGE_CONVERSATION_TYPE_SELF, - 'convhash' => \core_message\helper::get_conversation_hash([$selfconversation->userid]) - ] - ); - - // Star the existing self-conversation. - $favouriterecord = new \stdClass(); - $favouriterecord->component = 'core_message'; - $favouriterecord->itemtype = 'message_conversations'; - $favouriterecord->itemid = $selfconversation->conversationid; - $userctx = \context_user::instance($selfconversation->userid); - $favouriterecord->contextid = $userctx->id; - $favouriterecord->userid = $selfconversation->userid; - if (!$DB->record_exists('favourite', (array)$favouriterecord)) { - $favouriterecord->timecreated = time(); - $favouriterecord->timemodified = $favouriterecord->timecreated; - $DB->insert_record('favourite', $favouriterecord); - } - - // Set the self-conversation member with maxid to remove it later. - $maxids[] = $selfconversation->maxid; - } - $selfconversationsrs->close(); - - // Remove the repeated member with the higher id for all the existing self-conversations. - if (!empty($maxids)) { - list($insql, $inparams) = $DB->get_in_or_equal($maxids); - $DB->delete_records_select('message_conversation_members', "id $insql", $inparams); - } - - // STEP 2. Migrate existing self-conversation relying on old message tables, setting the type to the new - // MESSAGE_CONVERSATION_TYPE_SELF and the convhash to the proper one. Star them also. - - // On the messaging legacy tables, self-conversations are only present in the 'message_read' table, so we don't need to - // check the content in the 'message' table. - $sql = "SELECT mr.* - FROM {message_read} mr - INNER JOIN {user} u ON mr.useridfrom = u.id - WHERE mr.useridfrom = mr.useridto AND mr.notification = 0 AND u.deleted = 0"; - $legacyselfmessagesrs = $DB->get_recordset_sql($sql); - foreach ($legacyselfmessagesrs as $message) { - // Get the self-conversation or create and star it if doesn't exist. - $conditions = [ - 'type' => \core_message\api::MESSAGE_CONVERSATION_TYPE_SELF, - 'convhash' => \core_message\helper::get_conversation_hash([$message->useridfrom]) - ]; - $selfconversation = $DB->get_record('message_conversations', $conditions); - if (empty($selfconversation)) { - // Create the self-conversation. - $selfconversation = new \stdClass(); - $selfconversation->type = \core_message\api::MESSAGE_CONVERSATION_TYPE_SELF; - $selfconversation->convhash = \core_message\helper::get_conversation_hash([$message->useridfrom]); - $selfconversation->enabled = 1; - $selfconversation->timecreated = time(); - $selfconversation->timemodified = $selfconversation->timecreated; - - $selfconversation->id = $DB->insert_record('message_conversations', $selfconversation); - - // Add user to this self-conversation. - $member = new \stdClass(); - $member->conversationid = $selfconversation->id; - $member->userid = $message->useridfrom; - $member->timecreated = time(); - - $member->id = $DB->insert_record('message_conversation_members', $member); - - // Star the self-conversation. - $favouriterecord = new \stdClass(); - $favouriterecord->component = 'core_message'; - $favouriterecord->itemtype = 'message_conversations'; - $favouriterecord->itemid = $selfconversation->id; - $userctx = \context_user::instance($message->useridfrom); - $favouriterecord->contextid = $userctx->id; - $favouriterecord->userid = $message->useridfrom; - if (!$DB->record_exists('favourite', (array)$favouriterecord)) { - $favouriterecord->timecreated = time(); - $favouriterecord->timemodified = $favouriterecord->timecreated; - $DB->insert_record('favourite', $favouriterecord); - } - } - - // Create the object we will be inserting into the database. - $tabledata = new \stdClass(); - $tabledata->useridfrom = $message->useridfrom; - $tabledata->conversationid = $selfconversation->id; - $tabledata->subject = $message->subject; - $tabledata->fullmessage = $message->fullmessage; - $tabledata->fullmessageformat = $message->fullmessageformat ?? FORMAT_MOODLE; - $tabledata->fullmessagehtml = $message->fullmessagehtml; - $tabledata->smallmessage = $message->smallmessage; - $tabledata->timecreated = $message->timecreated; - - $messageid = $DB->insert_record('messages', $tabledata); - - // Check if we need to mark this message as deleted (self-conversations add this information on the - // timeuserfromdeleted field. - if ($message->timeuserfromdeleted) { - $mua = new \stdClass(); - $mua->userid = $message->useridfrom; - $mua->messageid = $messageid; - $mua->action = \core_message\api::MESSAGE_ACTION_DELETED; - $mua->timecreated = $message->timeuserfromdeleted; - - $DB->insert_record('message_user_actions', $mua); - } - - // Mark this message as read. - $mua = new \stdClass(); - $mua->userid = $message->useridto; - $mua->messageid = $messageid; - $mua->action = \core_message\api::MESSAGE_ACTION_READ; - $mua->timecreated = $message->timeread; - - $DB->insert_record('message_user_actions', $mua); - - // The self-conversation message has been migrated. Delete the record from the legacy table as soon as possible - // to avoid migrate it twice. - $DB->delete_records('message_read', ['id' => $message->id]); - } - $legacyselfmessagesrs->close(); - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019041800.01); - } - - if ($oldversion < 2019042200.01) { - - // Define table role_sortorder to be dropped. - $table = new xmldb_table('role_sortorder'); - - // Conditionally launch drop table for role_sortorder. - if ($dbman->table_exists($table)) { - $dbman->drop_table($table); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019042200.01); - } - - if ($oldversion < 2019042200.02) { - - // Let's update all (old core) targets to their new (core_course) locations. - $targets = [ - '\core\analytics\target\course_competencies' => '\core_course\analytics\target\course_competencies', - '\core\analytics\target\course_completion' => '\core_course\analytics\target\course_completion', - '\core\analytics\target\course_dropout' => '\core_course\analytics\target\course_dropout', - '\core\analytics\target\course_gradetopass' => '\core_course\analytics\target\course_gradetopass', - '\core\analytics\target\no_teaching' => '\core_course\analytics\target\no_teaching', - ]; - - foreach ($targets as $oldclass => $newclass) { - $DB->set_field('analytics_models', 'target', $newclass, ['target' => $oldclass]); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019042200.02); - } - - if ($oldversion < 2019042300.01) { - $sql = "UPDATE {capabilities} - SET name = ?, - contextlevel = ? - WHERE name = ?"; - $DB->execute($sql, ['moodle/category:viewcourselist', CONTEXT_COURSECAT, 'moodle/course:browse']); - - $sql = "UPDATE {role_capabilities} - SET capability = ? - WHERE capability = ?"; - $DB->execute($sql, ['moodle/category:viewcourselist', 'moodle/course:browse']); - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019042300.01); - } - - if ($oldversion < 2019042300.03) { - - // Add new customdata field to message table. - $table = new xmldb_table('message'); - $field = new xmldb_field('customdata', XMLDB_TYPE_TEXT, null, null, null, null, null, 'eventtype'); - - // Conditionally launch add field output. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Add new customdata field to notifications and messages table. - $table = new xmldb_table('notifications'); - $field = new xmldb_field('customdata', XMLDB_TYPE_TEXT, null, null, null, null, null, 'timecreated'); - - // Conditionally launch add field output. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - $table = new xmldb_table('messages'); - // Conditionally launch add field output. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019042300.03); - } - - if ($oldversion < 2019042700.01) { - - // Define field firstanalysis to be added to analytics_used_analysables. - $table = new xmldb_table('analytics_used_analysables'); - - // Declaring it as null initially (although it is NOT NULL). - $field = new xmldb_field('firstanalysis', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'analysableid'); - - // Conditionally launch add field firstanalysis. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - - // Set existing values to the current timeanalysed value. - $recordset = $DB->get_recordset('analytics_used_analysables'); - foreach ($recordset as $record) { - $record->firstanalysis = $record->timeanalysed; - $DB->update_record('analytics_used_analysables', $record); - } - $recordset->close(); - - // Now make the field 'NOT NULL'. - $field = new xmldb_field('firstanalysis', XMLDB_TYPE_INTEGER, '10', - null, XMLDB_NOTNULL, null, null, 'analysableid'); - $dbman->change_field_notnull($table, $field); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019042700.01); - } - - if ($oldversion < 2019050300.01) { - // Delete all stale favourite records which were left behind when a course was deleted. - $params = ['component' => 'core_message', 'itemtype' => 'message_conversations']; - $sql = "SELECT fav.id as id - FROM {favourite} fav - LEFT JOIN {context} ctx ON (ctx.id = fav.contextid) - WHERE fav.component = :component - AND fav.itemtype = :itemtype - AND ctx.id IS NULL"; - - if ($records = $DB->get_fieldset_sql($sql, $params)) { - // Just for safety, delete by chunks. - $chunks = array_chunk($records, 1000); - foreach ($chunks as $chunk) { - list($insql, $inparams) = $DB->get_in_or_equal($chunk); - $DB->delete_records_select('favourite', "id $insql", $inparams); - } - } - - upgrade_main_savepoint(true, 2019050300.01); - } - - if ($oldversion < 2019050600.00) { - - // Define field apiversion to be added to badge_backpack. - $table = new xmldb_table('badge_backpack'); - $field = new xmldb_field('apiversion', XMLDB_TYPE_CHAR, '12', null, XMLDB_NOTNULL, null, '1.0', 'password'); - - // Conditionally launch add field apiversion. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Define table badge_external_backpack to be created. - $table = new xmldb_table('badge_external_backpack'); - - // Adding fields to table badge_external_backpack. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('backpackapiurl', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null); - $table->add_field('backpackweburl', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null); - $table->add_field('apiversion', XMLDB_TYPE_CHAR, '12', null, XMLDB_NOTNULL, null, '1.0'); - $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0'); - $table->add_field('password', XMLDB_TYPE_CHAR, '255', null, null, null, null); - - // Adding keys to table badge_external_backpack. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - $table->add_key('backpackapiurlkey', XMLDB_KEY_UNIQUE, ['backpackapiurl']); - $table->add_key('backpackweburlkey', XMLDB_KEY_UNIQUE, ['backpackweburl']); - - // Conditionally launch create table for badge_external_backpack. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Define field entityid to be added to badge_external. - $table = new xmldb_table('badge_external'); - $field = new xmldb_field('entityid', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'collectionid'); - - // Conditionally launch add field entityid. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Define table badge_external_identifier to be created. - $table = new xmldb_table('badge_external_identifier'); - - // Adding fields to table badge_external_identifier. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('sitebackpackid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('internalid', XMLDB_TYPE_CHAR, '128', null, XMLDB_NOTNULL, null, null); - $table->add_field('externalid', XMLDB_TYPE_CHAR, '128', null, XMLDB_NOTNULL, null, null); - $table->add_field('type', XMLDB_TYPE_CHAR, '16', null, XMLDB_NOTNULL, null, null); - - // Adding keys to table badge_external_identifier. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - $table->add_key('fk_backpackid', XMLDB_KEY_FOREIGN, ['sitebackpackid'], 'badge_backpack', ['id']); - $table->add_key('backpack-internal-external', XMLDB_KEY_UNIQUE, ['sitebackpackid', 'internalid', 'externalid', 'type']); - - // Conditionally launch create table for badge_external_identifier. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Define field externalbackpackid to be added to badge_backpack. - $table = new xmldb_table('badge_backpack'); - $field = new xmldb_field('externalbackpackid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'password'); - - // Conditionally launch add field externalbackpackid. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Define key externalbackpack (foreign) to be added to badge_backpack. - $key = new xmldb_key('externalbackpack', XMLDB_KEY_FOREIGN, ['externalbackpackid'], 'badge_external_backpack', ['id']); - - // Launch add key externalbackpack. - $dbman->add_key($table, $key); - - $field = new xmldb_field('apiversion'); - - // Conditionally launch drop field apiversion. - if ($dbman->field_exists($table, $field)) { - $dbman->drop_field($table, $field); - } - - $field = new xmldb_field('backpackurl'); - - // Conditionally launch drop field backpackurl. - if ($dbman->field_exists($table, $field)) { - $dbman->drop_field($table, $field); - } - - // Add default backpacks. - require_once($CFG->dirroot . '/badges/upgradelib.php'); // Core install and upgrade related functions only for badges. - badges_install_default_backpacks(); - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019050600.00); - } - - if ($oldversion < 2019051300.01) { - $DB->set_field('analytics_models', 'enabled', '1', ['target' => '\core_user\analytics\target\upcoming_activities_due']); - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019051300.01); - } - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2019060600.02) { - // Renaming 'opentogoogle' config to 'opentowebcrawlers'. - $opentogooglevalue = get_config('core', 'opentogoogle'); - - // Move the value over if it was previously configured. - if ($opentogooglevalue !== false) { - set_config('opentowebcrawlers', $opentogooglevalue); - } - - // Remove the now unused value. - unset_config('opentogoogle'); - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019060600.02); - } - - if ($oldversion < 2019062900.00) { - // Debugsmtp is now only available via config.php. - $DB->delete_records('config', array('name' => 'debugsmtp')); - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019062900.00); - } - - if ($oldversion < 2019070400.01) { - - $basecolors = ['#81ecec', '#74b9ff', '#a29bfe', '#dfe6e9', '#00b894', - '#0984e3', '#b2bec3', '#fdcb6e', '#fd79a8', '#6c5ce7']; - - $colornr = 1; - foreach ($basecolors as $color) { - set_config('coursecolor' . $colornr, $color, 'core_admin'); - $colornr++; - } - - upgrade_main_savepoint(true, 2019070400.01); - } - - if ($oldversion < 2019072200.00) { - - // Define field relativedatesmode to be added to course. - $table = new xmldb_table('course'); - $field = new xmldb_field('relativedatesmode', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'enddate'); - - // Conditionally launch add field relativedatesmode. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019072200.00); - } - - if ($oldversion < 2019072500.01) { - // Remove the "popup" processor from the list of default processors for the messagecontactrequests notification. - $oldloggedinconfig = get_config('message', 'message_provider_moodle_messagecontactrequests_loggedin'); - $oldloggedoffconfig = get_config('message', 'message_provider_moodle_messagecontactrequests_loggedoff'); - $newloggedinconfig = implode(',', array_filter(explode(',', $oldloggedinconfig), function($value) { - return $value != 'popup'; - })); - $newloggedoffconfig = implode(',', array_filter(explode(',', $oldloggedoffconfig), function($value) { - return $value != 'popup'; - })); - set_config('message_provider_moodle_messagecontactrequests_loggedin', $newloggedinconfig, 'message'); - set_config('message_provider_moodle_messagecontactrequests_loggedoff', $newloggedoffconfig, 'message'); - - upgrade_main_savepoint(true, 2019072500.01); - } - - if ($oldversion < 2019072500.03) { - unset_config('httpswwwroot'); - - upgrade_main_savepoint(true, 2019072500.03); - } - - if ($oldversion < 2019073100.00) { - // Update the empty tag instructions to null. - $instructions = get_config('core', 'auth_instructions'); - - if (trim(html_to_text($instructions)) === '') { - set_config('auth_instructions', ''); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019073100.00); - } - - if ($oldversion < 2019083000.01) { - - // If block_community is no longer present, remove it. - if (!file_exists($CFG->dirroot . '/blocks/community/communitycourse.php')) { - // Drop table that is no longer needed. - $table = new xmldb_table('block_community'); - if ($dbman->table_exists($table)) { - $dbman->drop_table($table); - } - - // Delete instances. - $instances = $DB->get_records_list('block_instances', 'blockname', ['community']); - $instanceids = array_keys($instances); - - if (!empty($instanceids)) { - $DB->delete_records_list('block_positions', 'blockinstanceid', $instanceids); - $DB->delete_records_list('block_instances', 'id', $instanceids); - list($sql, $params) = $DB->get_in_or_equal($instanceids, SQL_PARAMS_NAMED); - $params['contextlevel'] = CONTEXT_BLOCK; - $DB->delete_records_select('context', "contextlevel=:contextlevel AND instanceid " . $sql, $params); - - $preferences = array(); - foreach ($instances as $instanceid => $instance) { - $preferences[] = 'block' . $instanceid . 'hidden'; - $preferences[] = 'docked_block_instance_' . $instanceid; - } - $DB->delete_records_list('user_preferences', 'name', $preferences); - } - - // Delete the block from the block table. - $DB->delete_records('block', array('name' => 'community')); - - // Remove capabilities. - capabilities_cleanup('block_community'); - // Clean config. - unset_all_config_for_plugin('block_community'); - - // Remove Moodle-level community based capabilities. - $capabilitiestoberemoved = ['block/community:addinstance', 'block/community:myaddinstance']; - // Delete any role_capabilities for the old roles. - $DB->delete_records_list('role_capabilities', 'capability', $capabilitiestoberemoved); - // Delete the capability itself. - $DB->delete_records_list('capabilities', 'name', $capabilitiestoberemoved); - } - - upgrade_main_savepoint(true, 2019083000.01); - } - - if ($oldversion < 2019083000.02) { - // Remove unused config. - unset_config('enablecoursepublishing'); - upgrade_main_savepoint(true, 2019083000.02); - } - - if ($oldversion < 2019083000.04) { - // Delete "orphaned" subscriptions. - $sql = "SELECT DISTINCT es.userid - FROM {event_subscriptions} es - LEFT JOIN {user} u ON u.id = es.userid - WHERE u.deleted = 1 OR u.id IS NULL"; - $deletedusers = $DB->get_fieldset_sql($sql); - if ($deletedusers) { - list($sql, $params) = $DB->get_in_or_equal($deletedusers); - - // Delete orphaned subscriptions. - $DB->execute("DELETE FROM {event_subscriptions} WHERE userid " . $sql, $params); - } - - upgrade_main_savepoint(true, 2019083000.04); - } - - if ($oldversion < 2019090500.01) { - - // Define index analysableid (not unique) to be added to analytics_used_analysables. - $table = new xmldb_table('analytics_used_analysables'); - $index = new xmldb_index('analysableid', XMLDB_INDEX_NOTUNIQUE, ['analysableid']); - - // Conditionally launch add index analysableid. - if (!$dbman->index_exists($table, $index)) { - $dbman->add_index($table, $index); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019090500.01); - } - - if ($oldversion < 2019092700.01) { - upgrade_rename_prediction_actions_useful_incorrectly_flagged(); - upgrade_main_savepoint(true, 2019092700.01); - } - - if ($oldversion < 2019100800.02) { - // Rename the official moodle sites directory the site is registered with. - $DB->execute("UPDATE {registration_hubs} - SET hubname = ?, huburl = ? - WHERE huburl = ?", ['moodle', 'https://stats.moodle.org', 'https://moodle.net']); - - // Convert the hub site specific settings to the new naming format without the hub URL in the name. - $hubconfig = get_config('hub'); - - if (!empty($hubconfig)) { - foreach (upgrade_convert_hub_config_site_param_names($hubconfig, 'https://moodle.net') as $name => $value) { - set_config($name, $value, 'hub'); - } - } - - upgrade_main_savepoint(true, 2019100800.02); - } - - if ($oldversion < 2019100900.00) { - // If block_participants is no longer present, remove it. - if (!file_exists($CFG->dirroot . '/blocks/participants/block_participants.php')) { - // Delete instances. - $instances = $DB->get_records_list('block_instances', 'blockname', ['participants']); - $instanceids = array_keys($instances); - - if (!empty($instanceids)) { - $DB->delete_records_list('block_positions', 'blockinstanceid', $instanceids); - $DB->delete_records_list('block_instances', 'id', $instanceids); - list($sql, $params) = $DB->get_in_or_equal($instanceids, SQL_PARAMS_NAMED); - $params['contextlevel'] = CONTEXT_BLOCK; - $DB->delete_records_select('context', "contextlevel=:contextlevel AND instanceid " . $sql, $params); - - $preferences = array(); - foreach ($instances as $instanceid => $instance) { - $preferences[] = 'block' . $instanceid . 'hidden'; - $preferences[] = 'docked_block_instance_' . $instanceid; - } - $DB->delete_records_list('user_preferences', 'name', $preferences); - } - - // Delete the block from the block table. - $DB->delete_records('block', array('name' => 'participants')); - - // Remove capabilities. - capabilities_cleanup('block_participants'); - - // Clean config. - unset_all_config_for_plugin('block_participants'); - } - - upgrade_main_savepoint(true, 2019100900.00); - } - - if ($oldversion < 2019101600.01) { - - // Change the setting $CFG->requestcategoryselection into $CFG->lockrequestcategory with opposite value. - set_config('lockrequestcategory', empty($CFG->requestcategoryselection)); - - upgrade_main_savepoint(true, 2019101600.01); - } - - if ($oldversion < 2019101800.02) { - - // Get the table by its previous name. - $table = new xmldb_table('analytics_models'); - if ($dbman->table_exists($table)) { - - // Define field contextids to be added to analytics_models. - $field = new xmldb_field('contextids', XMLDB_TYPE_TEXT, null, null, null, null, null, 'version'); - - // Conditionally launch add field contextids. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019101800.02); - } - - if ($oldversion < 2019102500.04) { - // Define table h5p_libraries to be created. - $table = new xmldb_table('h5p_libraries'); - - // Adding fields to table h5p_libraries. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('machinename', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null); - $table->add_field('title', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null); - $table->add_field('majorversion', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, null); - $table->add_field('minorversion', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, null); - $table->add_field('patchversion', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, null); - $table->add_field('runnable', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null); - $table->add_field('fullscreen', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0'); - $table->add_field('embedtypes', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null); - $table->add_field('preloadedjs', XMLDB_TYPE_TEXT, null, null, null, null, null); - $table->add_field('preloadedcss', XMLDB_TYPE_TEXT, null, null, null, null, null); - $table->add_field('droplibrarycss', XMLDB_TYPE_TEXT, null, null, null, null, null); - $table->add_field('semantics', XMLDB_TYPE_TEXT, null, null, null, null, null); - $table->add_field('addto', XMLDB_TYPE_TEXT, null, null, null, null, null); - - // Adding keys to table h5p_libraries. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - - // Adding indexes to table h5p_libraries. - $table->add_index('machinemajorminorpatch', XMLDB_INDEX_NOTUNIQUE, - ['machinename', 'majorversion', 'minorversion', 'patchversion', 'runnable']); - - // Conditionally launch create table for h5p_libraries. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Define table h5p_library_dependencies to be created. - $table = new xmldb_table('h5p_library_dependencies'); - - // Adding fields to table h5p_library_dependencies. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('libraryid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('requiredlibraryid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('dependencytype', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null); - - // Adding keys to table h5p_library_dependencies. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - $table->add_key('libraryid', XMLDB_KEY_FOREIGN, ['libraryid'], 'h5p_libraries', ['id']); - $table->add_key('requiredlibraryid', XMLDB_KEY_FOREIGN, ['requiredlibraryid'], 'h5p_libraries', ['id']); - - // Conditionally launch create table for h5p_library_dependencies. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Define table h5p to be created. - $table = new xmldb_table('h5p'); - - // Adding fields to table h5p. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('jsoncontent', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null); - $table->add_field('mainlibraryid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('displayoptions', XMLDB_TYPE_INTEGER, '4', null, null, null, null); - $table->add_field('pathnamehash', XMLDB_TYPE_CHAR, '40', null, XMLDB_NOTNULL, null, null); - $table->add_field('contenthash', XMLDB_TYPE_CHAR, '40', null, XMLDB_NOTNULL, null, null); - $table->add_field('filtered', XMLDB_TYPE_TEXT, null, null, null, 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 h5p. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - $table->add_key('mainlibraryid', XMLDB_KEY_FOREIGN, ['mainlibraryid'], 'h5p_libraries', ['id']); - - // Conditionally launch create table for h5p. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Define table h5p_contents_libraries to be created. - $table = new xmldb_table('h5p_contents_libraries'); - - // Adding fields to table h5p_contents_libraries. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('h5pid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('libraryid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('dependencytype', XMLDB_TYPE_CHAR, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('dropcss', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null); - $table->add_field('weight', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - - // Adding keys to table h5p_contents_libraries. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - $table->add_key('h5pid', XMLDB_KEY_FOREIGN, ['h5pid'], 'h5p', ['id']); - $table->add_key('libraryid', XMLDB_KEY_FOREIGN, ['libraryid'], 'h5p_libraries', ['id']); - - // Conditionally launch create table for h5p_contents_libraries. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Define table h5p_libraries_cachedassets to be created. - $table = new xmldb_table('h5p_libraries_cachedassets'); - - // Adding fields to table h5p_libraries_cachedassets. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('libraryid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('hash', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null); - - // Adding keys to table h5p_libraries_cachedassets. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - $table->add_key('libraryid', XMLDB_KEY_FOREIGN, ['libraryid'], 'h5p_libraries_cachedassets', ['id']); - - // Conditionally launch create table for h5p_libraries_cachedassets. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019102500.04); - } - - if ($oldversion < 2019103000.13) { - - upgrade_analytics_fix_contextids_defaults(); - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019103000.13); - } - - if ($oldversion < 2019111300.00) { - - // Define field coremajor to be added to h5p_libraries. - $table = new xmldb_table('h5p_libraries'); - $field = new xmldb_field('coremajor', XMLDB_TYPE_INTEGER, '4', null, null, null, null, 'addto'); - - // Conditionally launch add field coremajor. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - $field = new xmldb_field('coreminor', XMLDB_TYPE_INTEGER, '4', null, null, null, null, 'coremajor'); - - // Conditionally launch add field coreminor. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019111300.00); - } - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2019120500.01) { - // Delete any role assignments for roles which no longer exist. - $DB->delete_records_select('role_assignments', "roleid NOT IN (SELECT id FROM {role})"); - - // Main savepoint reached. - upgrade_main_savepoint(true, 2019120500.01); - } - - if ($oldversion < 2019121800.00) { - // Upgrade MIME types for existing streaming files. - $filetypes = array( - '%.fmp4' => 'video/mp4', - '%.ts' => 'video/MP2T', - '%.mpd' => 'application/dash+xml', - '%.m3u8' => 'application/x-mpegURL', - ); - - $select = $DB->sql_like('filename', '?', false); - foreach ($filetypes as $extension => $mimetype) { - $DB->set_field_select( - 'files', - 'mimetype', - $mimetype, - $select, - array($extension) - ); - } - - upgrade_main_savepoint(true, 2019121800.00); - } - - if ($oldversion < 2019122000.01) { - // Clean old upgrade setting not used anymore. - unset_config('linkcoursesectionsupgradescriptwasrun'); - upgrade_main_savepoint(true, 2019122000.01); - } - - if ($oldversion < 2020010900.02) { - $table = new xmldb_table('event'); - - // This index will improve the performance when the Events API retrieves category and group events. - $index = new xmldb_index('eventtype', XMLDB_INDEX_NOTUNIQUE, ['eventtype']); - if (!$dbman->index_exists($table, $index)) { - $dbman->add_index($table, $index); - } - - // This index improves the performance of backups, deletion and visibilty changes on activities. - $index = new xmldb_index('modulename-instance', XMLDB_INDEX_NOTUNIQUE, ['modulename', 'instance']); - if (!$dbman->index_exists($table, $index)) { - $dbman->add_index($table, $index); - } - - upgrade_main_savepoint(true, 2020010900.02); - } - - if ($oldversion < 2020011700.02) { - // Delete all orphaned subscription events. - $select = "subscriptionid IS NOT NULL - AND subscriptionid NOT IN (SELECT id from {event_subscriptions})"; - $DB->delete_records_select('event', $select); - - upgrade_main_savepoint(true, 2020011700.02); - } - - if ($oldversion < 2020013000.01) { - global $DB; - // Delete any associated files. - $fs = get_file_storage(); - $sql = "SELECT cuc.id, cuc.userid - FROM {competency_usercomp} cuc - LEFT JOIN {user} u ON cuc.userid = u.id - WHERE u.deleted = 1"; - $usercompetencies = $DB->get_records_sql($sql); - foreach ($usercompetencies as $usercomp) { - $DB->delete_records('competency_evidence', ['usercompetencyid' => $usercomp->id]); - $DB->delete_records('competency_usercompcourse', ['userid' => $usercomp->userid]); - $DB->delete_records('competency_usercompplan', ['userid' => $usercomp->userid]); - $DB->delete_records('competency_usercomp', ['userid' => $usercomp->userid]); - } - - $sql = "SELECT cue.id, cue.userid - FROM {competency_userevidence} cue - LEFT JOIN {user} u ON cue.userid = u.id - WHERE u.deleted = 1"; - $userevidences = $DB->get_records_sql($sql); - foreach ($userevidences as $userevidence) { - $DB->delete_records('competency_userevidencecomp', ['userevidenceid' => $userevidence->id]); - $DB->delete_records('competency_userevidence', ['id' => $userevidence->id]); - - if ($record = $DB->get_record('context', ['contextlevel' => CONTEXT_USER, 'instanceid' => $userevidence->userid], - '*', IGNORE_MISSING)) { - // Delete all orphaned user evidences files. - $fs->delete_area_files($record->id, 'core_competency', 'userevidence', $userevidence->userid); - } - } - - $sql = "SELECT cp.id - FROM {competency_plan} cp - LEFT JOIN {user} u ON cp.userid = u.id - WHERE u.deleted = 1"; - $userplans = $DB->get_records_sql($sql); - foreach ($userplans as $userplan) { - $DB->delete_records('competency_plancomp', ['planid' => $userplan->id]); - $DB->delete_records('competency_plan', ['id' => $userplan->id]); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2020013000.01); - } - - if ($oldversion < 2020040200.01) { - // Clean up completion criteria records referring to courses that no longer exist. - $select = 'criteriatype = :type AND courseinstance NOT IN (SELECT id FROM {course})'; - $params = ['type' => 8]; // COMPLETION_CRITERIA_TYPE_COURSE. - - $DB->delete_records_select('course_completion_criteria', $select, $params); - - // Main savepoint reached. - upgrade_main_savepoint(true, 2020040200.01); - } - - if ($oldversion < 2020040700.00) { - // Remove deprecated Mozilla OpenBadges backpack. - $url = 'https://backpack.openbadges.org'; - $bp = $DB->get_record('badge_external_backpack', ['backpackapiurl' => $url]); - if ($bp) { - // Remove connections for users to this backpack. - $sql = "SELECT DISTINCT bb.id - FROM {badge_backpack} bb - LEFT JOIN {badge_external} be ON be. backpackid = bb.externalbackpackid - WHERE bb.externalbackpackid = :backpackid"; - $params = ['backpackid' => $bp->id]; - $externalbackpacks = $DB->get_fieldset_sql($sql, $params); - if ($externalbackpacks) { - list($sql, $params) = $DB->get_in_or_equal($externalbackpacks); - - // Delete user external collections references to this backpack. - $DB->execute("DELETE FROM {badge_external} WHERE backpackid " . $sql, $params); - } - $DB->delete_records('badge_backpack', ['externalbackpackid' => $bp->id]); - - // Delete deprecated backpack entry. - $DB->delete_records('badge_external_backpack', ['backpackapiurl' => $url]); - } - - // Set active external backpack to Badgr.io. - $url = 'https://api.badgr.io/v2'; - if ($bp = $DB->get_record('badge_external_backpack', ['backpackapiurl' => $url])) { - set_config('badges_site_backpack', $bp->id); - } else { - unset_config('badges_site_backpack'); - } - - upgrade_main_savepoint(true, 2020040700.00); - } - - if ($oldversion < 2020041500.00) { - // Define table to store contentbank contents. - $table = new xmldb_table('contentbank_content'); - - // Adding fields to table content_bank. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null); - $table->add_field('contenttype', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null); - $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('instanceid', XMLDB_TYPE_INTEGER, '10', null, null, null, null); - $table->add_field('configdata', XMLDB_TYPE_TEXT, null, null, null, null, null); - $table->add_field('usercreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null); - $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0'); - $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, '0'); - - // Adding keys to table contentbank_content. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - $table->add_key('contextid', XMLDB_KEY_FOREIGN, ['contextid'], 'context', ['id']); - $table->add_key('usermodified', XMLDB_KEY_FOREIGN, ['usermodified'], 'user', ['id']); - $table->add_key('usercreated', XMLDB_KEY_FOREIGN, ['usercreated'], 'user', ['id']); - - // Adding indexes to table contentbank_content. - $table->add_index('name', XMLDB_INDEX_NOTUNIQUE, ['name']); - $table->add_index('instance', XMLDB_INDEX_NOTUNIQUE, ['contextid', 'contenttype', 'instanceid']); - - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2020041500.00); - } - - if ($oldversion < 2020041700.01) { - // Upgrade h5p MIME type for existing h5p files. - $select = $DB->sql_like('filename', '?', false); - $DB->set_field_select( - 'files', - 'mimetype', - 'application/zip.h5p', - $select, - array('%.h5p') - ); - - upgrade_main_savepoint(true, 2020041700.01); - } - - if ($oldversion < 2020042800.01) { - // Delete obsolete config value. - unset_config('enablesafebrowserintegration'); - // Clean up config of the old plugin. - unset_all_config_for_plugin('quizaccess_safebrowser'); - - upgrade_main_savepoint(true, 2020042800.01); - } - - if ($oldversion < 2020051900.01) { - // Define field component to be added to event. - $table = new xmldb_table('event'); - $field = new xmldb_field('component', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'repeatid'); - - // Conditionally launch add field component. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Define index component (not unique) to be added to event. - $table = new xmldb_table('event'); - $index = new xmldb_index('component', XMLDB_INDEX_NOTUNIQUE, ['component', 'eventtype', 'instance']); - - // Conditionally launch add index component. - if (!$dbman->index_exists($table, $index)) { - $dbman->add_index($table, $index); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2020051900.01); - } - - if ($oldversion < 2020052000.00) { - // Define table badge_backpack_oauth2 to be created. - $table = new xmldb_table('badge_backpack_oauth2'); - - // Adding fields to table badge_backpack_oauth2. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', 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'); - $table->add_field('userid', 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('externalbackpackid', 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('refreshtoken', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null); - $table->add_field('expires', XMLDB_TYPE_INTEGER, '10', null, null, null, null); - $table->add_field('scope', XMLDB_TYPE_TEXT, null, null, null, null, null); - - // Adding keys to table badge_backpack_oauth2. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - $table->add_key('usermodified', XMLDB_KEY_FOREIGN, ['usermodified'], 'user', ['id']); - $table->add_key('userid', XMLDB_KEY_FOREIGN, ['userid'], 'user', ['id']); - $table->add_key('issuerid', XMLDB_KEY_FOREIGN, ['issuerid'], 'oauth2_issuer', ['id']); - $table->add_key('externalbackpackid', XMLDB_KEY_FOREIGN, ['externalbackpackid'], 'badge_external_backpack', ['id']); - // Conditionally launch create table for badge_backpack_oauth2. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Define field oauth2_issuerid to be added to badge_external_backpack. - $tablebadgeexternalbackpack = new xmldb_table('badge_external_backpack'); - $fieldoauth2issuerid = new xmldb_field('oauth2_issuerid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'password'); - $keybackpackoauth2key = new xmldb_key('backpackoauth2key', XMLDB_KEY_FOREIGN, ['oauth2_issuerid'], 'oauth2_issuer', ['id']); - - // Conditionally launch add field oauth2_issuerid. - if (!$dbman->field_exists($tablebadgeexternalbackpack, $fieldoauth2issuerid)) { - $dbman->add_field($tablebadgeexternalbackpack, $fieldoauth2issuerid); - - // Launch add key backpackoauth2key. - $dbman->add_key($tablebadgeexternalbackpack, $keybackpackoauth2key); - } - - // Define field assertion to be added to badge_external. - $tablebadgeexternal = new xmldb_table('badge_external'); - $fieldassertion = new xmldb_field('assertion', XMLDB_TYPE_TEXT, null, null, null, null, null, 'entityid'); - - // Conditionally launch add field assertion. - if (!$dbman->field_exists($tablebadgeexternal, $fieldassertion)) { - $dbman->add_field($tablebadgeexternal, $fieldassertion); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2020052000.00); - } - - if ($oldversion < 2020052200.01) { - - // Define field custom to be added to license. - $table = new xmldb_table('license'); - $field = new xmldb_field('custom', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0'); - - // Conditionally launch add field custom. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Define field sortorder to be added to license. - $field = new xmldb_field('sortorder', XMLDB_TYPE_INTEGER, '5', null, XMLDB_NOTNULL, null, '0'); - - // Conditionally launch add field sortorder. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Define index license (not unique) to be added to files. - $table = new xmldb_table('files'); - $index = new xmldb_index('license', XMLDB_INDEX_NOTUNIQUE, ['license']); - - // Conditionally launch add index license. - if (!$dbman->index_exists($table, $index)) { - $dbman->add_index($table, $index); - } - - // Upgrade the core license details. - upgrade_core_licenses(); - - // Main savepoint reached. - upgrade_main_savepoint(true, 2020052200.01); - } - - if ($oldversion < 2020060500.01) { - // Define field moodlenetprofile to be added to user. - $table = new xmldb_table('user'); - $field = new xmldb_field('moodlenetprofile', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'alternatename'); - - // Conditionally launch add field moodlenetprofile. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Main savepoint reached. - upgrade_main_savepoint(true, 2020060500.01); + upgrade_main_savepoint(true, 2020061500); } // Automatically generated Moodle v3.9.0 release upgrade line. // Put any upgrade step following this. + if ($oldversion < 2020061500.02) { // Update default digital age consent map according to the current legislation on each country. diff --git a/lib/editor/atto/db/upgrade.php b/lib/editor/atto/db/upgrade.php index 8fe00c36002a3..16b432545e724 100644 --- a/lib/editor/atto/db/upgrade.php +++ b/lib/editor/atto/db/upgrade.php @@ -32,73 +32,6 @@ function xmldb_editor_atto_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2019090900) { - $toolbar = get_config('editor_atto', 'toolbar'); - - if (strpos($toolbar, 'h5p') === false) { - $glue = "\r\n"; - if (strpos($toolbar, $glue) === false) { - $glue = "\n"; - } - $groups = explode($glue, $toolbar); - // Try to put h5p in the files group. - foreach ($groups as $i => $group) { - $parts = explode('=', $group); - if (trim($parts[0]) == 'files') { - $groups[$i] = 'files = ' . trim($parts[1]) . ', h5p'; - // Update config variable. - $toolbar = implode($glue, $groups); - set_config('toolbar', $toolbar, 'editor_atto'); - } - } - } - // Atto editor savepoint reached. - upgrade_plugin_savepoint(true, 2019090900, 'editor', 'atto'); - } - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2020052100) { - // The old default toolbar config for 38 and below. - $oldtoolbar = 'collapse = collapse -style1 = title, bold, italic -list = unorderedlist, orderedlist -links = link -files = image, media, recordrtc, managefiles, h5p -style2 = underline, strike, subscript, superscript -align = align -indent = indent -insert = equation, charmap, table, clear -undo = undo -accessibility = accessibilitychecker, accessibilityhelper -other = html'; - - // Check if the current toolbar config matches the old toolbar config. - if (get_config('editor_atto', 'toolbar') === $oldtoolbar) { - // If the site is still using the old defaults, upgrade to the new default. - $newtoolbar = 'collapse = collapse -style1 = title, bold, italic -list = unorderedlist, orderedlist, indent -links = link -files = emojipicker, image, media, recordrtc, managefiles, h5p -style2 = underline, strike, subscript, superscript -align = align -insert = equation, charmap, table, clear -undo = undo -accessibility = accessibilitychecker, accessibilityhelper -other = html'; - set_config('toolbar', $newtoolbar, 'editor_atto'); - } - - upgrade_plugin_savepoint(true, 2020052100, 'editor', 'atto'); - } - // Automatically generated Moodle v3.9.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 be720c047e425..7434c24196f64 100644 --- a/lib/editor/atto/plugins/equation/db/upgrade.php +++ b/lib/editor/atto/plugins/equation/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_atto_equation_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 54318c6e3335f..ab7b762e611bb 100644 --- a/lib/editor/tinymce/db/upgrade.php +++ b/lib/editor/tinymce/db/upgrade.php @@ -27,15 +27,6 @@ function xmldb_editor_tinymce_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 94b01aa8bdf49..bac24a44a07f9 100644 --- a/lib/editor/tinymce/plugins/spellchecker/db/upgrade.php +++ b/lib/editor/tinymce/plugins/spellchecker/db/upgrade.php @@ -27,15 +27,6 @@ function xmldb_tinymce_spellchecker_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 30bd74f940877..0215611bba598 100644 --- a/message/output/email/db/upgrade.php +++ b/message/output/email/db/upgrade.php @@ -32,42 +32,6 @@ function xmldb_message_email_upgrade($oldversion) { global $DB; - $dbman = $DB->get_manager(); - - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2019032500) { - // Define table message_email_messages to be created. - $table = new xmldb_table('message_email_messages'); - - // Adding fields to table message_email_messages. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('useridto', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('conversationid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('messageid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - - // Adding keys to table message_email_messages. - $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); - $table->add_key('useridto', XMLDB_KEY_FOREIGN, array('useridto'), 'user', array('id')); - $table->add_key('conversationid', XMLDB_KEY_FOREIGN, array('conversationid'), 'message_conversations', array('id')); - $table->add_key('messageid', XMLDB_KEY_FOREIGN, array('messageid'), 'messages', array('id')); - - // Conditionally launch create table for message_email_messages. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Savepoint reached. - upgrade_plugin_savepoint(true, 2019032500, 'message', 'email'); - } - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 7296a1c3d199a..dcaf4051a5bf9 100644 --- a/message/output/popup/db/upgrade.php +++ b/message/output/popup/db/upgrade.php @@ -32,40 +32,6 @@ function xmldb_message_popup_upgrade($oldversion) { global $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2020020600) { - // Clean up orphaned popup notification records. - $fromsql = "FROM {message_popup_notifications} mpn - LEFT JOIN {notifications} n - ON mpn.notificationid = n.id - WHERE n.id IS NULL"; - $total = $DB->count_records_sql("SELECT COUNT(mpn.id) " . $fromsql); - if ($total > 0) { - $i = 0; - $pbar = new progress_bar('deletepopupnotification', 500, true); - do { - if ($popupnotifications = $DB->get_records_sql("SELECT mpn.id " . $fromsql, null, 0, 1000)) { - list($insql, $inparams) = $DB->get_in_or_equal(array_keys($popupnotifications)); - $DB->delete_records_select('message_popup_notifications', "id $insql", $inparams); - // Update progress. - $i += count($inparams); - $pbar->update($i, $total, "Cleaning up orphaned popup notification records - $i/$total."); - } - } while ($popupnotifications); - } - - // Popup message processor savepoint reached. - upgrade_plugin_savepoint(true, 2020020600, 'message', 'popup'); - } - // Automatically generated Moodle v3.9.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 fd8bd7aa3acc3..528ca095e502c 100644 --- a/mod/assign/db/upgrade.php +++ b/mod/assign/db/upgrade.php @@ -34,28 +34,6 @@ function xmldb_assign_upgrade($oldversion) { $dbman = $DB->get_manager(); - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2018120500) { - // Define field hidegrader to be added to assign. - $table = new xmldb_table('assign'); - $field = new xmldb_field('hidegrader', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'blindmarking'); - - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Assignment savepoint reached. - upgrade_mod_savepoint(true, 2018120500, 'assign'); - } - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 35a01705b0865..ec852cfcb1c7f 100644 --- a/mod/assign/feedback/comments/db/upgrade.php +++ b/mod/assign/feedback/comments/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_assignfeedback_comments_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 cd82d03c88b51..dc6029be3890c 100644 --- a/mod/assign/feedback/editpdf/db/upgrade.php +++ b/mod/assign/feedback/editpdf/db/upgrade.php @@ -34,43 +34,6 @@ function xmldb_assignfeedback_editpdf_upgrade($oldversion) { $dbman = $DB->get_manager(); - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2019010800) { - // Define table assignfeedback_editpdf_rot to be created. - $table = new xmldb_table('assignfeedback_editpdf_rot'); - - // Adding fields to table assignfeedback_editpdf_rot. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('gradeid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0'); - $table->add_field('pageno', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0'); - $table->add_field('pathnamehash', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null); - $table->add_field('isrotated', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0'); - $table->add_field('degree', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0'); - - // Adding keys to table assignfeedback_editpdf_rot. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - $table->add_key('gradeid', XMLDB_KEY_FOREIGN, ['gradeid'], 'assign_grades', ['id']); - - // Adding indexes to table assignfeedback_editpdf_rot. - $table->add_index('gradeid_pageno', XMLDB_INDEX_UNIQUE, ['gradeid', 'pageno']); - - // Conditionally launch create table for assignfeedback_editpdf_rot. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Editpdf savepoint reached. - upgrade_plugin_savepoint(true, 2019010800, 'assignfeedback', 'editpdf'); - } - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 0a53e1307f139..318007fee968f 100644 --- a/mod/assign/feedback/file/db/upgrade.php +++ b/mod/assign/feedback/file/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_assignfeedback_file_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 4bffd778122ac..e4dc9ef3672ae 100644 --- a/mod/assign/submission/comments/db/upgrade.php +++ b/mod/assign/submission/comments/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_assignsubmission_comments_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 f096ace885690..8486cb8ac2a41 100644 --- a/mod/assign/submission/file/db/upgrade.php +++ b/mod/assign/submission/file/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_assignsubmission_file_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 ed84c5bc4f37c..388da9ea6792c 100644 --- a/mod/assign/submission/onlinetext/db/upgrade.php +++ b/mod/assign/submission/onlinetext/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_assignsubmission_onlinetext_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 82d122eb16a8d..1264c427a7821 100644 --- a/mod/assignment/db/upgrade.php +++ b/mod/assignment/db/upgrade.php @@ -24,15 +24,6 @@ function xmldb_assignment_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 b3f700ce6ddba..db6abc235998e 100644 --- a/mod/book/db/upgrade.php +++ b/mod/book/db/upgrade.php @@ -34,15 +34,6 @@ function xmldb_book_upgrade($oldversion) { $dbman = $DB->get_manager(); - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 9afe701c36e4c..0a8c96abbefb8 100644 --- a/mod/chat/db/upgrade.php +++ b/mod/chat/db/upgrade.php @@ -27,15 +27,6 @@ function xmldb_chat_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 0f68b1131bb2f..d8eb3b88d94e2 100644 --- a/mod/choice/db/upgrade.php +++ b/mod/choice/db/upgrade.php @@ -26,15 +26,6 @@ function xmldb_choice_upgrade($oldversion) { $dbman = $DB->get_manager(); - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 010ed6408c1bf..1fb0b4c4ee35c 100644 --- a/mod/data/db/upgrade.php +++ b/mod/data/db/upgrade.php @@ -22,33 +22,7 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_data_upgrade($oldversion) { - global $CFG, $DB; - - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2019052001) { - - $columns = $DB->get_columns('data'); - - $oldclass = "mod-data-default-template ##approvalstatus##"; - $newclass = "mod-data-default-template ##approvalstatusclass##"; - - // Update existing classes. - $DB->replace_all_text('data', $columns['singletemplate'], $oldclass, $newclass); - $DB->replace_all_text('data', $columns['listtemplate'], $oldclass, $newclass); - $DB->replace_all_text('data', $columns['addtemplate'], $oldclass, $newclass); - $DB->replace_all_text('data', $columns['rsstemplate'], $oldclass, $newclass); - $DB->replace_all_text('data', $columns['asearchtemplate'], $oldclass, $newclass); - - // Data savepoint reached. - upgrade_mod_savepoint(true, 2019052001, 'data'); - } - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. + global $CFG; // Automatically generated Moodle v3.9.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 ad13f90f6c602..3e198a1c3b2a7 100644 --- a/mod/feedback/db/upgrade.php +++ b/mod/feedback/db/upgrade.php @@ -44,15 +44,6 @@ function xmldb_feedback_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 e9e5e74d9efc8..b39d5f92d4f0b 100644 --- a/mod/folder/db/upgrade.php +++ b/mod/folder/db/upgrade.php @@ -49,15 +49,6 @@ function xmldb_folder_upgrade($oldversion) { $dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes. - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.0 release upgrade line. // Put any upgrade step following this. if ($oldversion < 2021052501) { diff --git a/mod/forum/db/upgrade.php b/mod/forum/db/upgrade.php index 710ba87350780..8236d25a597ee 100644 --- a/mod/forum/db/upgrade.php +++ b/mod/forum/db/upgrade.php @@ -47,199 +47,6 @@ function xmldb_forum_upgrade($oldversion) { $dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes. - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2019031200) { - // Define field privatereplyto to be added to forum_posts. - $table = new xmldb_table('forum_posts'); - $field = new xmldb_field('privatereplyto', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'mailnow'); - - // Conditionally launch add field privatereplyto. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - upgrade_mod_savepoint(true, 2019031200, 'forum'); - } - - if ($oldversion < 2019040400) { - - $table = new xmldb_table('forum'); - - // Define field duedate to be added to forum. - $field = new xmldb_field('duedate', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'introformat'); - - // Conditionally launch add field duedate. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Define field cutoffdate to be added to forum. - $field = new xmldb_field('cutoffdate', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'duedate'); - - // Conditionally launch add field cutoffdate. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - upgrade_mod_savepoint(true, 2019040400, 'forum'); - } - - if ($oldversion < 2019040402) { - // Define field deleted to be added to forum_posts. - $table = new xmldb_table('forum_discussions'); - $field = new xmldb_field('timelocked', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'pinned'); - - // Conditionally launch add field deleted. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Forum savepoint reached. - upgrade_mod_savepoint(true, 2019040402, 'forum'); - } - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2019071901) { - - // Define field wordcount to be added to forum_posts. - $table = new xmldb_table('forum_posts'); - $field = new xmldb_field('wordcount', XMLDB_TYPE_INTEGER, '20', null, null, null, null, 'privatereplyto'); - - // Conditionally launch add field wordcount. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Define field charcount to be added to forum_posts. - $table = new xmldb_table('forum_posts'); - $field = new xmldb_field('charcount', XMLDB_TYPE_INTEGER, '20', null, null, null, null, 'wordcount'); - - // Conditionally launch add field charcount. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Forum savepoint reached. - upgrade_mod_savepoint(true, 2019071901, 'forum'); - } - - if ($oldversion < 2019071902) { - // Create adhoc task for upgrading of existing forum_posts. - $record = new \stdClass(); - $record->classname = '\mod_forum\task\refresh_forum_post_counts'; - $record->component = 'mod_forum'; - - // Next run time based from nextruntime computation in \core\task\manager::queue_adhoc_task(). - $nextruntime = time() - 1; - $record->nextruntime = $nextruntime; - $DB->insert_record('task_adhoc', $record); - - // Main savepoint reached. - upgrade_mod_savepoint(true, 2019071902, 'forum'); - } - - if ($oldversion < 2019081100) { - - // Define field grade_forum to be added to forum. - $table = new xmldb_table('forum'); - $field = new xmldb_field('grade_forum', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'scale'); - - // Conditionally launch add field grade_forum. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Forum savepoint reached. - upgrade_mod_savepoint(true, 2019081100, 'forum'); - - } - - if ($oldversion < 2019100100) { - // Define table forum_grades to be created. - $table = new xmldb_table('forum_grades'); - - // Adding fields to table forum_grades. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('forum', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('itemnumber', 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('grade', XMLDB_TYPE_NUMBER, '10, 5', 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 forum_grades. - $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); - $table->add_key('forum', XMLDB_KEY_FOREIGN, ['forum'], 'forum', ['id']); - - // Adding indexes to table forum_grades. - $table->add_index('userid', XMLDB_INDEX_NOTUNIQUE, ['userid']); - $table->add_index('forumusergrade', XMLDB_INDEX_UNIQUE, ['forum', 'itemnumber', 'userid']); - - // Conditionally launch create table for forum_grades. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Forum savepoint reached. - upgrade_mod_savepoint(true, 2019100100, 'forum'); - } - - if ($oldversion < 2019100108) { - - // Define field sendstudentnotifications_forum to be added to forum. - $table = new xmldb_table('forum'); - $field = new xmldb_field('sendstudentnotifications_forum', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0', - 'grade_forum'); - - // Conditionally launch add field sendstudentnotifications_forum. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Forum savepoint reached. - upgrade_mod_savepoint(true, 2019100108, 'forum'); - } - - if ($oldversion < 2019100109) { - - $table = new xmldb_table('forum'); - $field = new xmldb_field('sendstudentnotifications_forum'); - if ($dbman->field_exists($table, $field)) { - $field->set_attributes(XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0', 'grade_forum'); - $dbman->rename_field($table, $field, 'grade_forum_notify'); - } - - // Forum savepoint reached. - upgrade_mod_savepoint(true, 2019100109, 'forum'); - - } - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2019111801) { - $sql = "SELECT d.id AS discussionid, p.userid AS correctuser - FROM {forum_discussions} d - INNER JOIN {forum_posts} p ON p.id = d.firstpost - WHERE d.userid <> p.userid"; - $recordset = $DB->get_recordset_sql($sql); - foreach ($recordset as $record) { - $object = new stdClass(); - $object->id = $record->discussionid; - $object->userid = $record->correctuser; - $DB->update_record('forum_discussions', $object); - } - - $recordset->close(); - - // Forum savepoint reached. - upgrade_mod_savepoint(true, 2019111801, 'forum'); - } - // Automatically generated Moodle v3.9.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 ebbf95ecb7aa4..ce7d25f32a04c 100644 --- a/mod/glossary/db/upgrade.php +++ b/mod/glossary/db/upgrade.php @@ -22,15 +22,6 @@ function xmldb_glossary_upgrade($oldversion) { global $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 cc45c11d308c0..5f6b6c21ba97f 100644 --- a/mod/imscp/db/upgrade.php +++ b/mod/imscp/db/upgrade.php @@ -31,15 +31,6 @@ function xmldb_imscp_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 a1baf5d6278c1..7f631dd7f1639 100644 --- a/mod/label/db/upgrade.php +++ b/mod/label/db/upgrade.php @@ -47,15 +47,6 @@ function xmldb_label_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 c04f877964425..2e31c5f7c54e2 100644 --- a/mod/lesson/db/upgrade.php +++ b/mod/lesson/db/upgrade.php @@ -52,15 +52,6 @@ function xmldb_lesson_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 9c56ed8af472a..8529e4c441b1c 100644 --- a/mod/lti/db/upgrade.php +++ b/mod/lti/db/upgrade.php @@ -63,106 +63,6 @@ function xmldb_lti_upgrade($oldversion) { $dbman = $DB->get_manager(); - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2019031300) { - // Define table lti_access_tokens to be updated. - $table = new xmldb_table('lti_types'); - - // Define field ltiversion to be added to lti_types. - $field = new xmldb_field('ltiversion', XMLDB_TYPE_CHAR, 10, null, XMLDB_NOTNULL, null, null, 'coursevisible'); - - // Conditionally launch add field ltiversion. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - $DB->set_field_select('lti_types', 'ltiversion', 'LTI-1p0', 'toolproxyid IS NULL'); - $DB->set_field_select('lti_types', 'ltiversion', 'LTI-2p0', 'toolproxyid IS NOT NULL'); - } - - // Define field clientid to be added to lti_types. - $field = new xmldb_field('clientid', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'ltiversion'); - - // Conditionally launch add field clientid. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Define index clientid (unique) to be added to lti_types. - $index = new xmldb_index('clientid', XMLDB_INDEX_UNIQUE, array('clientid')); - - // Conditionally launch add index clientid. - if (!$dbman->index_exists($table, $index)) { - $dbman->add_index($table, $index); - } - - require_once($CFG->dirroot . '/mod/lti/upgradelib.php'); - - $warning = mod_lti_verify_private_key(); - if (!empty($warning)) { - echo $OUTPUT->notification($warning, 'notifyproblem'); - } - - // Lti savepoint reached. - upgrade_mod_savepoint(true, 2019031300, 'lti'); - } - - if ($oldversion < 2019031301) { - // Define table lti_access_tokens to be created. - $table = new xmldb_table('lti_access_tokens'); - - // Adding fields to table lti_access_tokens. - $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('typeid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('scope', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null); - $table->add_field('token', XMLDB_TYPE_CHAR, '128', null, XMLDB_NOTNULL, null, null); - $table->add_field('validuntil', 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('lastaccess', XMLDB_TYPE_INTEGER, '10', null, null, null, null); - - // Adding keys to table lti_access_tokens. - $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); - $table->add_key('typeid', XMLDB_KEY_FOREIGN, array('typeid'), 'lti_types', array('id')); - - // Add an index. - $table->add_index('token', XMLDB_INDEX_UNIQUE, array('token')); - - // Conditionally launch create table for lti_access_tokens. - if (!$dbman->table_exists($table)) { - $dbman->create_table($table); - } - - // Lti savepoint reached. - upgrade_mod_savepoint(true, 2019031301, 'lti'); - } - - if ($oldversion < 2019031302) { - // Define field typeid to be added to lti_tool_settings. - $table = new xmldb_table('lti_tool_settings'); - $field = new xmldb_field('typeid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'toolproxyid'); - - // Conditionally launch add field typeid. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Define key typeid (foreign) to be added to lti_tool_settings. - $table = new xmldb_table('lti_tool_settings'); - $key = new xmldb_key('typeid', XMLDB_KEY_FOREIGN, ['typeid'], 'lti_types', ['id']); - - // Launch add key typeid. - $dbman->add_key($table, $key); - - // Lti savepoint reached. - upgrade_mod_savepoint(true, 2019031302, 'lti'); - } - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 fadde9a07f750..37ee7c7917607 100644 --- a/mod/page/db/upgrade.php +++ b/mod/page/db/upgrade.php @@ -47,15 +47,6 @@ function xmldb_page_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 98ed984381bc9..8b403c999702b 100644 --- a/mod/quiz/db/upgrade.php +++ b/mod/quiz/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_quiz_upgrade($oldversion) { global $CFG, $DB; $dbman = $DB->get_manager(); - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 79a49c6fad612..a50c233c69f2b 100644 --- a/mod/quiz/report/overview/db/upgrade.php +++ b/mod/quiz/report/overview/db/upgrade.php @@ -31,17 +31,6 @@ function xmldb_quiz_overview_upgrade($oldversion) { global $DB; - $dbman = $DB->get_manager(); - - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 88be859cdd4ab..554275e12a515 100644 --- a/mod/quiz/report/statistics/db/upgrade.php +++ b/mod/quiz/report/statistics/db/upgrade.php @@ -30,15 +30,6 @@ function xmldb_quiz_statistics_upgrade($oldversion) { global $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 693bbbdd53469..44a113f24b2c2 100644 --- a/mod/resource/db/upgrade.php +++ b/mod/resource/db/upgrade.php @@ -47,15 +47,6 @@ function xmldb_resource_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 8f70776ca7d3c..5debec2b9440e 100644 --- a/mod/scorm/db/upgrade.php +++ b/mod/scorm/db/upgrade.php @@ -34,28 +34,6 @@ function xmldb_scorm_upgrade($oldversion) { $dbman = $DB->get_manager(); - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - if ($oldversion < 2018123100) { - - // Remove un-used/large index on element field. - $table = new xmldb_table('scorm_scoes_track'); - $index = new xmldb_index('element', XMLDB_INDEX_UNIQUE, ['element']); - if ($dbman->index_exists($table, $index)) { - $dbman->drop_index($table, $index); - } - - // Scorm savepoint reached. - upgrade_mod_savepoint(true, 2018123100, 'scorm'); - } - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 60e4d2a569d85..c470a7ad8f742 100644 --- a/mod/survey/db/upgrade.php +++ b/mod/survey/db/upgrade.php @@ -24,15 +24,6 @@ function xmldb_survey_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 c55da89b9cc3e..8742b326351b6 100644 --- a/mod/url/db/upgrade.php +++ b/mod/url/db/upgrade.php @@ -47,15 +47,6 @@ function xmldb_url_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 74f3a5844f3b5..d036dce73169e 100644 --- a/mod/wiki/db/upgrade.php +++ b/mod/wiki/db/upgrade.php @@ -40,15 +40,6 @@ function xmldb_wiki_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 9c02464cd84a6..c1788e94262c8 100644 --- a/mod/workshop/db/upgrade.php +++ b/mod/workshop/db/upgrade.php @@ -39,15 +39,6 @@ function xmldb_workshop_upgrade($oldversion) { $dbman = $DB->get_manager(); - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 1d760457463d7..f1997ed531b87 100644 --- a/mod/workshop/form/accumulative/db/upgrade.php +++ b/mod/workshop/form/accumulative/db/upgrade.php @@ -33,15 +33,6 @@ function xmldb_workshopform_accumulative_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 b6b05f6490377..bc26a8e99be0a 100644 --- a/mod/workshop/form/comments/db/upgrade.php +++ b/mod/workshop/form/comments/db/upgrade.php @@ -33,15 +33,6 @@ function xmldb_workshopform_comments_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 ea4cf9db74eff..fda5e4fd48026 100644 --- a/mod/workshop/form/numerrors/db/upgrade.php +++ b/mod/workshop/form/numerrors/db/upgrade.php @@ -33,15 +33,6 @@ function xmldb_workshopform_numerrors_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 596e83ba40094..80e7d8b6082f4 100644 --- a/mod/workshop/form/rubric/db/upgrade.php +++ b/mod/workshop/form/rubric/db/upgrade.php @@ -33,15 +33,6 @@ function xmldb_workshopform_rubric_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 cd2b5c1d99f99..b45ba40139564 100644 --- a/portfolio/googledocs/db/upgrade.php +++ b/portfolio/googledocs/db/upgrade.php @@ -23,15 +23,6 @@ function xmldb_portfolio_googledocs_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 f1e9311952b28..9af4a074a24e3 100644 --- a/question/behaviour/manualgraded/db/upgrade.php +++ b/question/behaviour/manualgraded/db/upgrade.php @@ -30,15 +30,6 @@ function xmldb_qbehaviour_manualgraded_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 57eab3ecc2edd..47e570924c575 100644 --- a/question/type/calculated/db/upgrade.php +++ b/question/type/calculated/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_qtype_calculated_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 942b6864a66a7..14f37b9ce2c40 100644 --- a/question/type/ddmarker/db/upgrade.php +++ b/question/type/ddmarker/db/upgrade.php @@ -33,15 +33,6 @@ function xmldb_qtype_ddmarker_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 b06f9be34e57c..02a0d6c021ebb 100644 --- a/question/type/essay/db/upgrade.php +++ b/question/type/essay/db/upgrade.php @@ -34,15 +34,6 @@ function xmldb_qtype_essay_upgrade($oldversion) { $dbman = $DB->get_manager(); - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.0 release upgrade line. // Put any upgrade step following this. diff --git a/question/type/match/db/upgrade.php b/question/type/match/db/upgrade.php index bbd5618fc04c4..0abddda57e062 100644 --- a/question/type/match/db/upgrade.php +++ b/question/type/match/db/upgrade.php @@ -31,15 +31,6 @@ function xmldb_qtype_match_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 d52f539d31f66..70bbb0eb3c03d 100644 --- a/question/type/multianswer/db/upgrade.php +++ b/question/type/multianswer/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_qtype_multianswer_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 bde5eda44dd7e..96dfd0accda30 100644 --- a/question/type/multichoice/db/upgrade.php +++ b/question/type/multichoice/db/upgrade.php @@ -30,37 +30,8 @@ * @param int $oldversion the version we are upgrading from. */ function xmldb_qtype_multichoice_upgrade($oldversion) { - global $CFG, $DB; + global $CFG; - $dbman = $DB->get_manager(); - - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - - // Add a new checkbox for the question author to decide - // Whether standard instruction ('Select one:' or 'Select one or more:') is displayed. - $newversion = 2020041600; - if ($oldversion < $newversion) { - - // Define field showstandardinstruction to be added to qtype_multichoice_options. - $table = new xmldb_table('qtype_multichoice_options'); - $field = new xmldb_field('showstandardinstruction', XMLDB_TYPE_INTEGER, '2', - null, XMLDB_NOTNULL, null, '1', 'shownumcorrect'); - - // Conditionally launch add field showstandardinstruction. - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - // Multichoice savepoint reached. - upgrade_plugin_savepoint(true, $newversion, 'qtype', 'multichoice'); - } // Automatically generated Moodle v3.9.0 release upgrade line. // Put any upgrade step following this. diff --git a/question/type/numerical/db/upgrade.php b/question/type/numerical/db/upgrade.php index 1efb057cb2681..5e429b9988aa8 100644 --- a/question/type/numerical/db/upgrade.php +++ b/question/type/numerical/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_qtype_numerical_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 b39ed76f96701..cae4a1692765f 100644 --- a/question/type/random/db/upgrade.php +++ b/question/type/random/db/upgrade.php @@ -31,15 +31,6 @@ function xmldb_qtype_random_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 484f3c423a5a7..462b89c678572 100644 --- a/question/type/randomsamatch/db/upgrade.php +++ b/question/type/randomsamatch/db/upgrade.php @@ -31,15 +31,6 @@ function xmldb_qtype_randomsamatch_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 38f6c9bcad9dd..dc41f891d84b4 100644 --- a/question/type/shortanswer/db/upgrade.php +++ b/question/type/shortanswer/db/upgrade.php @@ -32,15 +32,6 @@ function xmldb_qtype_shortanswer_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 161cc43695f22..8f57fd67da464 100644 --- a/repository/dropbox/db/upgrade.php +++ b/repository/dropbox/db/upgrade.php @@ -23,15 +23,6 @@ function xmldb_repository_dropbox_upgrade($oldversion) { global $CFG, $DB; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 bb4bab4b919a4..bbbe7d529fd98 100644 --- a/repository/flickr/db/upgrade.php +++ b/repository/flickr/db/upgrade.php @@ -34,15 +34,6 @@ function xmldb_repository_flickr_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 e65091998605c..efdc38b4df738 100644 --- a/repository/googledocs/db/upgrade.php +++ b/repository/googledocs/db/upgrade.php @@ -23,15 +23,6 @@ function xmldb_repository_googledocs_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.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 97b7bb32472d6..1a6c92e38aa0b 100644 --- a/repository/onedrive/db/upgrade.php +++ b/repository/onedrive/db/upgrade.php @@ -26,15 +26,6 @@ function xmldb_repository_onedrive_upgrade($oldversion) { global $CFG; - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - // Automatically generated Moodle v3.9.0 release upgrade line. // Put any upgrade step following this.