function background_process_ass_cron_schedule_alter in Background Process 7.2
Implements hook_cron_schedule_alter().
File
- background_process_ass/
background_process_ass.module, line 85 - @todo Implement admin interface. @todo Fix runtime check of running process.
Code
function background_process_ass_cron_schedule_alter(&$items) {
// We need to unlock ourselves if we're stale (chicken and the egg...)
if (!isset($items['background_process_ass_cron'])) {
$hooks = ultimate_cron_get_hooks();
if (isset($hooks['background_process_ass_cron']['background_process'])) {
$process =& $hooks['background_process_ass_cron']['background_process'];
// Self unlock if too old ...
if ($process
->getStartTime() + 120 < time()) {
$process
->log(t('Self unlocking stale cleanup job'))
->unlock();
$process = NULL;
}
}
}
// Put our cron job first in the list.
if (isset($items['background_process_ass_cron'])) {
$org_items = $items;
$items = array();
$items['background_process_ass_cron'] = $org_items['background_process_ass_cron'];
$items += $org_items;
}
}