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.
This commit is contained in:
Jun Pataleta
2023-04-21 12:32:10 +08:00
committed by Stevani Andolo
parent 0720524804
commit 4bf6bb37c2
+11
View File
@@ -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');
}