public function JobScheduler::reschedule in Job Scheduler 7.2
Re-schedule a job if intended to run again.
(If cannot determine the next time, drop the job)
2 calls to JobScheduler::reschedule()
- JobScheduler::check in ./
JobScheduler.inc - Check whether a job exists in the queue and update its parameters if so.
- JobScheduler::execute in ./
JobScheduler.inc - Executes a job that.
File
- ./
JobScheduler.inc, line 204 - JobScheduler class.
Class
- JobScheduler
- Manage scheduled jobs.
Code
public function reschedule($job) {
$job['scheduled'] = 0;
if (!empty($job['crontab'])) {
$crontab = new JobSchedulerCronTab($job['crontab']);
$job['next'] = $crontab
->nextTime($job['last']);
}
else {
$job['next'] = $job['last'] + $job['period'];
}
if ($job['next']) {
drupal_write_record('job_schedule', $job, array(
'item_id',
));
}
else {
// If no next time, it may mean it won't run again the next year (crontab)
$this
->remove($job);
}
}