From 4bf6bb37c2cccfafac41c7cf111bb6d90976a266 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Fri, 21 Apr 2023 07:39:17 +0800 Subject: [PATCH] MDL-77927 core: Delete other mod_assignment subplugins Non-core mod_assignment subplugin data may still be present on the database. We need to make sure to remove these too during upgrade. --- lib/db/upgrade.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 7d5566200e6..c94cf1768f2 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -3237,6 +3237,17 @@ privatefiles,moodle|/user/files.php'; uninstall_plugin('assignment', 'upload'); uninstall_plugin('assignment', 'uploadsingle'); + // Delete other mod_assignment subplugins. + $pluginnamelike = $DB->sql_like('plugin', ':pluginname'); + $subplugins = $DB->get_fieldset_select('config_plugins', 'plugin', "$pluginnamelike AND name = :name", [ + 'pluginname' => $DB->sql_like_escape('assignment_') . '%', + 'name' => 'version', + ]); + foreach ($subplugins as $subplugin) { + [$plugin, $subpluginname] = explode('_', $subplugin, 2); + uninstall_plugin($plugin, $subpluginname); + } + // Delete mod_assignment. uninstall_plugin('mod', 'assignment'); }