MDL-82335 qbank_columnsortorder: Cleanup upgrade code

This commit is contained in:
Huong Nguyen
2024-11-07 13:40:01 +07:00
parent 27073a36b6
commit 91d352a085
+3 -5
View File
@@ -82,11 +82,9 @@ function xmldb_qbank_columnsortorder_upgrade(int $oldversion): bool {
// they were getting incorrectly updated, resulting in corrupted colsize value,
// e.g., '"width":"30"}-"width":"30"},"width":"180"}-"width":"180"} and thus breaking the question bank page.
$pluginconfig = $DB->get_record('config_plugins', ['plugin' => 'qbank_columnsortorder', 'name' => 'colsize']);
if ($pluginconfig) {
$pattern = '/"width":"[^"]*"}-"width":"[^"]*"}/';
if (preg_match($pattern, $pluginconfig->value)) {
$DB->delete_records('config_plugins', ['plugin' => 'qbank_columnsortorder', 'name' => 'colsize']);
}
$pattern = '/"width":"[^"]*"}-"width":"[^"]*"}/';
if ($pluginconfig && preg_match($pattern, $pluginconfig->value)) {
$DB->delete_records('config_plugins', ['plugin' => 'qbank_columnsortorder', 'name' => 'colsize']);
}
upgrade_plugin_savepoint(true, 2024042203, 'qbank', 'columnsortorder');
}