| Línea 37... |
Línea 37... |
| 37 |
// Before Moodle 4.3, config_plugins settings for qbank_columnsortorder (disabledcol, enabledcol) had a value like
|
37 |
// Before Moodle 4.3, config_plugins settings for qbank_columnsortorder (disabledcol, enabledcol) had a value like
|
| 38 |
// qbank_statistics\columns\facility_index,qbank_statistics\columns\discriminative_efficiency, ...
|
38 |
// qbank_statistics\columns\facility_index,qbank_statistics\columns\discriminative_efficiency, ...
|
| 39 |
// In Moodle 4.3, the values are stored as qbank_statistics\columns\discriminative_efficiency-discriminative_efficiency.
|
39 |
// In Moodle 4.3, the values are stored as qbank_statistics\columns\discriminative_efficiency-discriminative_efficiency.
|
| 40 |
// So updating the old values to match the new format.
|
40 |
// So updating the old values to match the new format.
|
| 41 |
// Update the columns records for qbank_columnsortorder plugin.
|
41 |
// Update the columns records for qbank_columnsortorder plugin.
|
| 42 |
$pluginconfigs = $DB->get_records('config_plugins', ['plugin' => 'qbank_columnsortorder'], 'name, value');
|
42 |
$pluginconfigs = $DB->get_records('config_plugins', ['plugin' => 'qbank_columnsortorder'], 'name');
|
| Línea 43... |
Línea 43... |
| 43 |
|
43 |
|
| 44 |
foreach ($pluginconfigs as $config) {
|
44 |
foreach ($pluginconfigs as $config) {
|
| 45 |
if ($config->name == 'version') {
|
45 |
if (!in_array($config->name, ['hiddencols', 'enabledcol', 'disabledcol'])) {
|
| 46 |
continue;
|
46 |
continue;
|
| 47 |
}
|
47 |
}
|
| 48 |
$fields = explode(',', $config->value);
|
48 |
$fields = explode(',', $config->value);
|
| 49 |
$updatedcols = [];
|
49 |
$updatedcols = [];
|
| Línea 69... |
Línea 69... |
| 69 |
|
69 |
|
| 70 |
// Custom sort order savepoint reached.
|
70 |
// Custom sort order savepoint reached.
|
| 71 |
upgrade_plugin_savepoint(true, 2024042201, 'qbank', 'columnsortorder');
|
71 |
upgrade_plugin_savepoint(true, 2024042201, 'qbank', 'columnsortorder');
|
| Línea 72... |
Línea 72... |
| 72 |
}
|
72 |
}
|
| 73 |
|
73 |
|
| 74 |
if ($oldversion < 2024042202) {
|
74 |
if ($oldversion < 2024051000) {
|
| 75 |
// Remove plugin entry created by previously incorrect 2024042201 savepoint.
|
75 |
// Remove plugin entry created by previously incorrect 2024042201 savepoint.
|
| 76 |
$DB->delete_records('config_plugins', ['plugin' => 'qbank_qbank_columnsortorder']);
|
76 |
$DB->delete_records('config_plugins', ['plugin' => 'qbank_qbank_columnsortorder']);
|
| Línea -... |
Línea 77... |
| - |
|
77 |
upgrade_plugin_savepoint(true, 2024051000, 'qbank', 'columnsortorder');
|
| - |
|
78 |
}
|
| - |
|
79 |
|
| - |
|
80 |
// Automatically generated Moodle v4.5.0 release upgrade line.
|
| - |
|
81 |
// Put any upgrade step following this.
|
| - |
|
82 |
|
| - |
|
83 |
if ($oldversion < 2024100701) {
|
| - |
|
84 |
// When upgrading to version 2024042201, if there were any values for colsize in qbank_columnsortorder plugin,
|
| - |
|
85 |
// they were getting incorrectly updated, resulting in corrupted colsize value,
|
| - |
|
86 |
// e.g., '"width":"30"}-"width":"30"},"width":"180"}-"width":"180"}' and thus breaking the question bank page.
|
| - |
|
87 |
$pluginconfig = $DB->get_record('config_plugins', ['plugin' => 'qbank_columnsortorder', 'name' => 'colsize']);
|
| - |
|
88 |
$pattern = '/"width":"[^"]*"}-"width":"[^"]*"}/';
|
| - |
|
89 |
if ($pluginconfig && preg_match($pattern, $pluginconfig->value)) {
|
| - |
|
90 |
$DB->delete_records('config_plugins', ['plugin' => 'qbank_columnsortorder', 'name' => 'colsize']);
|
| - |
|
91 |
}
|
| - |
|
92 |
upgrade_plugin_savepoint(true, 2024100701, 'qbank', 'columnsortorder');
|
| - |
|
93 |
}
|
| - |
|
94 |
|
| 77 |
upgrade_plugin_savepoint(true, 2024042202, 'qbank', 'columnsortorder');
|
95 |
// Automatically generated Moodle v5.0.0 release upgrade line.
|
| 78 |
}
|
96 |
// Put any upgrade step following this.
|