From 9c4e1d7706ece5bec6f0f71c4c49146fdf092e0d Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Wed, 9 Jul 2025 13:23:01 +0200 Subject: [PATCH] MDL-85660 format: Disable social course format The social course format is now disabled by default for all new and upgraded installations. Existing courses using this format will continue to function, but administrators must re-enable it to create new social courses. --- .upgradenotes/MDL-85660-2025070903232232.yml | 9 ++++++ course/format/social/db/install.php | 32 ++++++++++++++++++++ public/admin/presets/classes/helper.php | 6 ---- public/lib/db/upgrade.php | 15 +++++++++ public/version.php | 2 +- 5 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 .upgradenotes/MDL-85660-2025070903232232.yml create mode 100644 course/format/social/db/install.php diff --git a/.upgradenotes/MDL-85660-2025070903232232.yml b/.upgradenotes/MDL-85660-2025070903232232.yml new file mode 100644 index 00000000000..8b78d382cca --- /dev/null +++ b/.upgradenotes/MDL-85660-2025070903232232.yml @@ -0,0 +1,9 @@ +issueNumber: MDL-85660 +notes: + format_social: + - message: >- + The social course format is now disabled by default for all new and + upgraded installations. Existing courses using this format will continue + to function, but administrators must re-enable it to create new social + courses. + type: deprecated diff --git a/course/format/social/db/install.php b/course/format/social/db/install.php new file mode 100644 index 00000000000..1025351f890 --- /dev/null +++ b/course/format/social/db/install.php @@ -0,0 +1,32 @@ +. + +/** + * Install script for format_social. + * + * @package format_social + * @copyright 2025 Sara Arjona + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Perform the post-install procedures. + */ +function xmldb_format_social_install() { + // Disable the Social course format on new installs by default. + $manager = \core_plugin_manager::resolve_plugininfo_class('format'); + $manager::enable_plugin('social', 0); +} diff --git a/public/admin/presets/classes/helper.php b/public/admin/presets/classes/helper.php index 252c5f48c66..6d124c29bdd 100644 --- a/public/admin/presets/classes/helper.php +++ b/public/admin/presets/classes/helper.php @@ -236,9 +236,6 @@ class helper { static::add_plugin($presetid, 'block', 'recentlyaccessedcourses', false); static::add_plugin($presetid, 'block', 'starredcourses', false); - // Course formats: Disable Social format. - static::add_plugin($presetid, 'format', 'social', false); - // Data formats: Disable Javascript Object Notation (.json). static::add_plugin($presetid, 'dataformat', 'json', false); @@ -332,9 +329,6 @@ class helper { static::add_plugin($presetid, 'block', 'recentlyaccessedcourses', true); static::add_plugin($presetid, 'block', 'starredcourses', true); - // Course formats: Enable Social format. - static::add_plugin($presetid, 'format', 'social', true); - // Data formats: Enable Javascript Object Notation (.json). static::add_plugin($presetid, 'dataformat', 'json', true); diff --git a/public/lib/db/upgrade.php b/public/lib/db/upgrade.php index c615725915c..0fbad8bb7dd 100644 --- a/public/lib/db/upgrade.php +++ b/public/lib/db/upgrade.php @@ -2067,5 +2067,20 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2025081900.04); } + if ($oldversion < 2025082600.01) { + if (get_config('moodlecourse', 'format') === 'social') { + // If the social course format is set as default, change it to topics. + set_config('format', 'topics', 'moodlecourse'); + } + $DB->delete_records('adminpresets_plug', ['plugin' => 'format', 'name' => 'social']); + + // Disable Social course format. + $manager = \core_plugin_manager::resolve_plugininfo_class('format'); + $manager::enable_plugin('social', 0); + + // Main savepoint reached. + upgrade_main_savepoint(true, 2025082600.01); + } + return true; } diff --git a/public/version.php b/public/version.php index 947d9d7c2e3..c0d6a50caf6 100644 --- a/public/version.php +++ b/public/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2025082600.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2025082600.01; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '5.1dev+ (Build: 20250826)'; // Human-friendly version name