public function UltimateCronBackgroundProcessLegacyLauncher::cron_pre_schedule in Ultimate Cron 7.2
Implements hook_cron_alter().
Overrides UltimateCronPlugin::cron_pre_schedule
File
- plugins/
ultimate_cron/ launcher/ background_process_legacy.class.php, line 37 - Background Process 1.x launcher for Ultimate Cron.
Class
- UltimateCronBackgroundProcessLegacyLauncher
- Ultimate Cron launcher plugin class.
Code
public function cron_pre_schedule($job) {
if ($job->name !== 'ultimate_cron_plugin_launcher_background_process_legacy_cleanup') {
return;
}
$job->hook['override_congestion_protection'] = TRUE;
// Unlock background if too old.
// @todo Move to some access handler or pre-execute?
if ($lock_id = $job
->isLocked()) {
$process = background_process_get_process('uc-ultimate_cron_plugin_launcher_background_process_legacy_cleanup');
if ($process && $process->start + variable_get('background_process_cleanup_age', BACKGROUND_PROCESS_CLEANUP_AGE) < time()) {
$log_entry = $job
->resumeLog($lock_id);
$log_entry
->log('bgpl_launcher', 'Self unlocking stale lock', array(), WATCHDOG_NOTICE);
$log_entry
->finish();
$job
->sendSignal('background_process_legacy_dont_log');
$job
->unlock($lock_id);
unset($job->lock_id);
}
}
}