function ultimate_cron_run_hook in Ultimate Cron 6
Same name and namespace in other branches
- 8 ultimate_cron.module \ultimate_cron_run_hook()
- 7 ultimate_cron.module \ultimate_cron_run_hook()
Run a cron hook. Launches the cron job in a background process
Parameters
$name:
$hook:
Return value
mixed Connections file handle on success.
3 calls to ultimate_cron_run_hook()
- drush_ultimate_cron_cron_run in ./
ultimate_cron.drush.inc - Run cron job(s)
- ultimate_cron_cron in ./
ultimate_cron.module - Implementation of hook_cron().
- ultimate_cron_service_start in ./
ultimate_cron.admin.inc - Run a single function.
File
- ./
ultimate_cron.module, line 795 - @todo Add filter on overview page. @todo Add log view (with graph). @todo Make proper markup for overview page. @todo Refactor drush stuff, too many intimate relations with Background Process @todo Refactor Cron % offset stuff. Too mixed up and…
Code
function ultimate_cron_run_hook($name, $hook) {
// Run the job in background
$result = NULL;
$handle_prefix = variable_get('ultimate_cron_handle_prefix', ULTIMATE_CRON_HANDLE_PREFIX);
$handle = $handle_prefix . $name;
$process = new BackgroundProcess($handle);
// Always run cron job as anonymous user
$process->uid = 0;
// Determine service group
$process->service_group = empty($hook['settings']['service_group']) ? variable_get('ultimate_cron_service_group', ULTIMATE_CRON_SERVICE_GROUP) : $hook['settings']['service_group'];
$hook['timestamp'] = time();
unset($hook['log']['msg']);
$result = $process
->start('_ultimate_cron_run_hook', array(
$name,
$hook,
));
return $result ? $process->connection : $result;
}