public function UltimateCronCrontabScheduler::formatLabelVerbose in Ultimate Cron 7.2
Label for schedule.
Overrides UltimateCronPlugin::formatLabelVerbose
File
- plugins/
ultimate_cron/ scheduler/ crontab.class.php, line 32 - Crontab cron job scheduler for Ultimate Cron.
Class
- UltimateCronCrontabScheduler
- Crontab scheduler.
Code
public function formatLabelVerbose($job) {
$settings = $job
->getSettings($this->type);
$job->log_entry = isset($job->log_entry) ? $job->log_entry : $job
->loadLatestLogEntry();
$parsed = '';
$next_schedule = NULL;
$time = REQUEST_TIME;
$skew = $this
->getSkew($job);
foreach ($settings['rules'] as $rule) {
$cron = CronRule::factory($rule, $time, $skew);
$parsed .= $cron
->parseRule() . "\n";
$result = $cron
->getNextSchedule();
$next_schedule = is_null($next_schedule) || $next_schedule > $result ? $result : $next_schedule;
$result = $cron
->getLastSchedule();
// If job didn't run at its last schedule, check if the catch up time
// will triger it, and adjust $next_schedule accordingly.
if ($job->log_entry->start_time < $result && $time < $result + $settings['catch_up']) {
$result = floor($time / 60) * 60 + 60;
$next_schedule = $next_schedule > $result ? $result : $next_schedule;
}
}
$parsed .= t('Next scheduled run at @datetime', array(
'@datetime' => format_date($next_schedule, 'custom', 'Y-m-d H:i:s'),
));
return $parsed;
}