public function JobScheduler::check in Job Scheduler 7.2
Check whether a job exists in the queue and update its parameters if so.
File
- ./
JobScheduler.inc, line 226 - JobScheduler class.
Class
- JobScheduler
- Manage scheduled jobs.
Code
public function check($job) {
$job += array(
'id' => 0,
'period' => 0,
'crontab' => '',
);
$existing = db_select('job_schedule')
->fields('job_schedule')
->condition('name', $this->name)
->condition('type', $job['type'])
->condition('id', $job['id'])
->execute()
->fetchAssoc();
// If existing, and changed period or crontab, we need to reschedule the
// job.
if ($existing) {
if ($job['period'] != $existing['period'] || $job['crontab'] != $existing['crontab']) {
$existing['period'] = $job['period'];
$existing['crontab'] = $job['crontab'];
$this
->reschedule($existing);
}
return $existing;
}
}