mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-82335 qbank_columnsortorder: Cleanup upgrade code
This commit is contained in:
parent
a25399959c
commit
c89b3279bb
@ -77,22 +77,20 @@ function xmldb_qbank_columnsortorder_upgrade(int $oldversion): bool {
|
||||
upgrade_plugin_savepoint(true, 2024051000, 'qbank', 'columnsortorder');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2024100701) {
|
||||
// When upgrading to version 2024042201, if there were any values for colsize in qbank_columnsortorder plugin,
|
||||
// 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, 2024100701, 'qbank', 'columnsortorder');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user