MDL-58777 core: Remove redundant refresh events tasks

There were 4 instances of the calendar refresh events task being
queued, which is redundant as we now have the "one true task" to
fix the events table, and it needs to be run for everybody.
This commit is contained in:
Cameron Ball 2017-05-02 14:51:57 +08:00
parent 9eb5a0417c
commit 79b80ee540
No known key found for this signature in database
GPG Key ID: 305B7F70214D810C
2 changed files with 16 additions and 48 deletions

View File

@ -2566,19 +2566,6 @@ function xmldb_main_upgrade($oldversion) {
$dbman->add_field($table, $field);
}
// Create adhoc task for upgrading of existing calendar events.
$record = new \stdClass();
$record->classname = "\\core\\task\\refresh_mod_calendar_events_task";
$record->component = 'core';
// Next run time based from nextruntime computation in \core\task\manager::queue_adhoc_task().
$nextruntime = time() - 1;
$record->nextruntime = $nextruntime;
$DB->insert_record('task_adhoc', $record);
// This same task is queued again in a later step, but if we already queue it here
// then there is no need to queue it again. We use this flag in the second step.
$refresheventsadhocadded = true;
// Main savepoint reached.
upgrade_main_savepoint(true, 2017030700.00);
}
@ -2671,21 +2658,6 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2017040402.00);
}
if ($oldversion < 2017040403.00) {
// Create adhoc task for upgrading of existing calendar events.
$record = new \stdClass();
$record->classname = "\\core\\task\\refresh_mod_calendar_events_task";
$record->component = 'core';
// Next run time based from nextruntime computation in \core\task\manager::queue_adhoc_task().
$nextruntime = time() - 1;
$record->nextruntime = $nextruntime;
$DB->insert_record('task_adhoc', $record);
// Main savepoint reached.
upgrade_main_savepoint(true, 2017040403.00);
}
if ($oldversion < 2017040700.01) {
// Define table oauth2_issuer to be created.
@ -2838,25 +2810,6 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2017041801.00);
}
if ($oldversion < 2017042600.01) {
// If the previous step didn't execute and queue the task.
if (!isset($refresheventsadhocadded)) {
// Create adhoc task for upgrading of existing calendar events.
$record = new \stdClass();
$record->classname = "\\core\\task\\refresh_mod_calendar_events_task";
$record->component = 'core';
// Next run time based from nextruntime computation in \core\task\manager::queue_adhoc_task().
$nextruntime = time() - 1;
$record->nextruntime = $nextruntime;
$DB->insert_record('task_adhoc', $record);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2017042600.01);
}
if ($oldversion < 2017050500.01) {
// Get the list of parent event IDs.
$sql = "SELECT DISTINCT repeatid
@ -2894,5 +2847,20 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2017050500.02);
}
if ($oldversion < 2017050900.01) {
// Create adhoc task for upgrading of existing calendar events.
$record = new \stdClass();
$record->classname = '\core\task\refresh_mod_calendar_events_task';
$record->component = 'core';
// Next run time based from nextruntime computation in \core\task\manager::queue_adhoc_task().
$nextruntime = time() - 1;
$record->nextruntime = $nextruntime;
$DB->insert_record('task_adhoc', $record);
// Main savepoint reached.
upgrade_main_savepoint(true, 2017050900.01);
}
return true;
}

View File

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2017050900.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2017050900.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.