mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 02:46:40 +02:00
MDL-82335 qbank_columnsortorder: Cleanup upgrade code
This commit is contained in:
parent
a25399959c
commit
c89b3279bb
1 changed files with 6 additions and 8 deletions
|
@ -77,22 +77,20 @@ function xmldb_qbank_columnsortorder_upgrade(int $oldversion): bool {
|
||||||
upgrade_plugin_savepoint(true, 2024051000, 'qbank', 'columnsortorder');
|
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) {
|
if ($oldversion < 2024100701) {
|
||||||
// When upgrading to version 2024042201, if there were any values for colsize in qbank_columnsortorder plugin,
|
// 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,
|
// 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.
|
// 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']);
|
$pluginconfig = $DB->get_record('config_plugins', ['plugin' => 'qbank_columnsortorder', 'name' => 'colsize']);
|
||||||
if ($pluginconfig) {
|
|
||||||
$pattern = '/"width":"[^"]*"}-"width":"[^"]*"}/';
|
$pattern = '/"width":"[^"]*"}-"width":"[^"]*"}/';
|
||||||
if (preg_match($pattern, $pluginconfig->value)) {
|
if ($pluginconfig && preg_match($pattern, $pluginconfig->value)) {
|
||||||
$DB->delete_records('config_plugins', ['plugin' => 'qbank_columnsortorder', 'name' => 'colsize']);
|
$DB->delete_records('config_plugins', ['plugin' => 'qbank_columnsortorder', 'name' => 'colsize']);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
upgrade_plugin_savepoint(true, 2024100701, 'qbank', 'columnsortorder');
|
upgrade_plugin_savepoint(true, 2024100701, 'qbank', 'columnsortorder');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Automatically generated Moodle v4.5.0 release upgrade line.
|
|
||||||
// Put any upgrade step following this.
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue