MDL-59042 upgrade: fix for non existent table in core upgrade.
Moved upgrade step to the assign mod where table is known to exist.
This commit is contained in:
@@ -2864,28 +2864,6 @@ function xmldb_main_upgrade($oldversion) {
|
||||
|
||||
// Automatically generated Moodle v3.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
if ($oldversion < 2017051500.04) {
|
||||
// Data fix any assign group override event priorities which may have been accidentally nulled due to a bug on the group
|
||||
// overrides edit form.
|
||||
|
||||
// First, find all assign group override events having null priority (and join their corresponding assign_overrides entry).
|
||||
$sql = "SELECT e.id AS id, o.sortorder AS priority
|
||||
FROM {assign_overrides} o
|
||||
JOIN {event} e ON (e.modulename = 'assign' AND o.assignid = e.instance AND e.groupid = o.groupid)
|
||||
WHERE o.groupid IS NOT NULL AND e.priority IS NULL
|
||||
ORDER BY o.id";
|
||||
$affectedrs = $DB->get_recordset_sql($sql);
|
||||
|
||||
// Now update the event's priority based on the assign_overrides sortorder we found. This uses similar logic to
|
||||
// assign_refresh_events(), except we've restricted the set of assignments and overrides we're dealing with here.
|
||||
foreach ($affectedrs as $record) {
|
||||
$DB->set_field('event', 'priority', $record->priority, ['id' => $record->id]);
|
||||
}
|
||||
$affectedrs->close();
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2017051500.04);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -295,6 +295,28 @@ function xmldb_assign_upgrade($oldversion) {
|
||||
|
||||
// Automatically generated Moodle v3.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
if ($oldversion < 2017051501) {
|
||||
// Data fix any assign group override event priorities which may have been accidentally nulled due to a bug on the group
|
||||
// overrides edit form.
|
||||
|
||||
// First, find all assign group override events having null priority (and join their corresponding assign_overrides entry).
|
||||
$sql = "SELECT e.id AS id, o.sortorder AS priority
|
||||
FROM {assign_overrides} o
|
||||
JOIN {event} e ON (e.modulename = 'assign' AND o.assignid = e.instance AND e.groupid = o.groupid)
|
||||
WHERE o.groupid IS NOT NULL AND e.priority IS NULL
|
||||
ORDER BY o.id";
|
||||
$affectedrs = $DB->get_recordset_sql($sql);
|
||||
|
||||
// Now update the event's priority based on the assign_overrides sortorder we found. This uses similar logic to
|
||||
// assign_refresh_events(), except we've restricted the set of assignments and overrides we're dealing with here.
|
||||
foreach ($affectedrs as $record) {
|
||||
$DB->set_field('event', 'priority', $record->priority, ['id' => $record->id]);
|
||||
}
|
||||
$affectedrs->close();
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2017051501, 'assign');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->component = 'mod_assign'; // Full name of the plugin (used for diagnostics).
|
||||
$plugin->version = 2017051500; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2017051501; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2017050500; // Requires this Moodle version.
|
||||
$plugin->cron = 60;
|
||||
|
||||
Reference in New Issue
Block a user