MDL-64429 tool_usertours: upgrade step to fix existing tours sortorder.
This commit is contained in:
@@ -897,6 +897,9 @@ class manager {
|
||||
}
|
||||
$existingtourrecords->close();
|
||||
|
||||
// Ensure we correct the sortorder in any existing tours, prior to adding latest shipped tours.
|
||||
helper::reset_tour_sortorder();
|
||||
|
||||
foreach (array_reverse($shippedtours) as $filename => $version) {
|
||||
$filepath = $CFG->dirroot . "/{$CFG->admin}/tool/usertours/tours/" . $filename;
|
||||
$tourjson = file_get_contents($filepath);
|
||||
|
||||
@@ -61,5 +61,12 @@ function xmldb_tool_usertours_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2020031900) {
|
||||
// Updating shipped tours will fix broken sortorder records in existing tours.
|
||||
manager::update_shipped_tours();
|
||||
|
||||
upgrade_plugin_savepoint(true, 2020031900, 'tool', 'usertours');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2019120400; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2020031900; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2019111200; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_usertours'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
Reference in New Issue
Block a user