MDL-52385 tasks: Queue ad-hoc tasks in future

This commit is contained in:
Daniel Neis Araujo
2016-04-07 11:49:52 +08:00
committed by Andrew Nicols
parent aeccf4bd94
commit dfb9daeae2
2 changed files with 55 additions and 11 deletions
+4 -2
View File
@@ -135,8 +135,10 @@ class manager {
global $DB;
$record = self::record_from_adhoc_task($task);
// Schedule it immediately.
$record->nextruntime = time() - 1;
// Schedule it immediately if nextruntime not explicitly set.
if (!$task->get_next_run_time()) {
$record->nextruntime = time() - 1;
}
$result = $DB->insert_record('task_adhoc', $record);
return $result;