From 4c2b9922df14923d22117be8bfecfc8ea2519072 Mon Sep 17 00:00:00 2001 From: Amaia Anabitarte Date: Fri, 22 Nov 2024 10:42:56 +0100 Subject: [PATCH] MDL-82034 mod_subsection: Enable mod_subsection when upgrading --- config-dist.php | 9 +++++++++ lib/db/upgrade.php | 12 ++++++++++++ version.php | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/config-dist.php b/config-dist.php index bdbda3dd473..3cd38fc0956 100644 --- a/config-dist.php +++ b/config-dist.php @@ -899,6 +899,15 @@ $CFG->admin = 'admin'; // Force result of checks used to determine whether a site is considered "public" or not (such as for site registration). // $CFG->site_is_public = false; // +// The mod_subsection feature has been added in 4.5 but is disabled by default. For new 5.0 sites, however, it will be enabled +// by default. When upgrading from an earlier version to 5.0 or later, mod_subsection will also be enabled unless the +// 'keepsubsectiondisabled' setting is set to true. In that case, the status of mod_subsection will remain unchanged during the +// upgrade process. +// This setting applies only to upgrades from version 4.5 where subsections already exist. It does not affect other upgrades or +// new installations. +// Note that the 'keepsubsectiondisabled' setting will be removed in version 6.0. (MDL-83791) +// $CFG->keepsubsectiondisabled = false; +// //========================================================================= // 8. FORCED SETTINGS //========================================================================= diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 914be39fd52..fe3867b3e36 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -1341,5 +1341,17 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2024121800.00); } + if ($oldversion < 2024121900.01) { + // Enable mod_subsection unless 'keepsubsectiondisabled' is set. + if ((empty($CFG->keepsubsectiondisabled) || !$CFG->keepsubsectiondisabled) + && $DB->get_record('modules', ['name' => 'subsection'])) { + $manager = \core_plugin_manager::resolve_plugininfo_class('mod'); + $manager::enable_plugin('subsection', 1); + } + + // Main savepoint reached. + upgrade_main_savepoint(true, 2024121900.01); + } + return true; } diff --git a/version.php b/version.php index 7a96cfbf2e3..c9bb4624ea3 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2024121900.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2024121900.01; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '5.0dev (Build: 20241219)'; // Human-friendly version name