Changeset View
Changeset View
Standalone View
Standalone View
branches/5.3.x/core/kernel/managers/scheduled_task_manager.php
Show First 20 Lines • Show All 181 Lines • ▼ Show 20 Line(s) | |||||
$this->update($scheduled_task_data, $fields_hash); | $this->update($scheduled_task_data, $fields_hash); | ||||
$scheduled_task = $this->Application->recallObject('scheduled-task', null, Array ('skip_autoload' => true)); | $scheduled_task = $this->Application->recallObject('scheduled-task', null, Array ('skip_autoload' => true)); | ||||
/* @var $scheduled_task kDBItem */ | /* @var $scheduled_task kDBItem */ | ||||
$scheduled_task->LoadFromHash($scheduled_task_data); | $scheduled_task->LoadFromHash($scheduled_task_data); | ||||
$event->redirect = false; | $event->redirect = false; | ||||
// The fake MasterEvent is needed so that $event can access $scheduled_task! | |||||
$event->MasterEvent = new kEvent('scheduled-task:OnRun'); | $event->MasterEvent = new kEvent('scheduled-task:OnRun'); | ||||
$this->Application->HandleEvent($event); | $this->Application->HandleEvent($event); | ||||
$now = time(); | $now = time(); | ||||
$next_run = $cron_helper->getMatch($scheduled_task_data['RunSchedule'], $start_time); | $next_run = $cron_helper->getMatch($scheduled_task_data['RunSchedule'], $start_time); | ||||
while ($next_run < $now) { | while ($next_run < $now) { | ||||
// in case event execution took longer, then RunSchedule (don't use <=, because RunSchedule can be 0) | // in case event execution took longer, then RunSchedule (don't use <=, because RunSchedule can be 0) | ||||
Show All 25 Lines | |||||
$this->Conn->doUpdate( | $this->Conn->doUpdate( | ||||
$fields_hash, | $fields_hash, | ||||
$this->Application->getUnitConfig('scheduled-task')->getTableName(), | $this->Application->getUnitConfig('scheduled-task')->getTableName(), | ||||
'Name = ' . $this->Conn->qstr($scheduled_task_data['Name']) | 'Name = ' . $this->Conn->qstr($scheduled_task_data['Name']) | ||||
); | ); | ||||
$scheduled_task_data = array_merge($scheduled_task_data, $fields_hash); | $scheduled_task_data = array_merge($scheduled_task_data, $fields_hash); | ||||
} | } | ||||
} | } | ||||
No newline at end of file |