function background_process_cron_schedule_alter in Background Process 7.2
Implements hook_schedule_alter().
Cleaning up is important. If our cron job is scheduled, make sure it's run first.
File
- ./
background_process.module, line 398
Code
function background_process_cron_schedule_alter(&$items) {
// We need to unlock ourselves if we're stale (chicken and the egg...)
if (!isset($items['background_process_cron'])) {
$hooks = ultimate_cron_get_hooks();
if (isset($hooks['background_process_cron']['background_process'])) {
$process =& $hooks['background_process_cron']['background_process'];
// Self unlock if too old ...
if ($process && $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_cron'])) {
$org_items = $items;
$items = array();
$items['background_process_cron'] = $org_items['background_process_cron'];
$items += $org_items;
}
}