function ultimate_cron_get_hooks in Ultimate Cron 6
Same name and namespace in other branches
- 8 ultimate_cron.module \ultimate_cron_get_hooks()
- 7.2 ultimate_cron.module \ultimate_cron_get_hooks()
- 7 ultimate_cron.module \ultimate_cron_get_hooks()
Get cron hooks available.
Return value
array List of modules.
13 calls to ultimate_cron_get_hooks()
- drush_ultimate_cron_cron_disable in ./
ultimate_cron.drush.inc - Disable a cron job
- drush_ultimate_cron_cron_enable in ./
ultimate_cron.drush.inc - Enable a cron job
- drush_ultimate_cron_cron_list in ./
ultimate_cron.drush.inc - List cron jobs.
- drush_ultimate_cron_cron_run in ./
ultimate_cron.drush.inc - Run cron job(s)
- drush_ultimate_cron_cron_unlock in ./
ultimate_cron.drush.inc - Unlock a cron job
File
- ./
ultimate_cron.module, line 1002 - @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_get_hooks() {
static $hooks = NULL;
if (isset($hooks)) {
return $hooks;
}
$hooks = array();
$delta = 0;
// Which modules are not hook_cron() safe?
$uncronable_modules = ultimate_cron_uncronable_modules();
// Generate list of hooks
$modules = module_list();
foreach ($modules as $module) {
$file = drupal_get_path('module', $module) . '/' . $module . '.info';
$info = drupal_parse_info_file($file);
foreach (ultimate_cron_easy_hooks() as $hook => $description) {
if (module_hook($module, $hook)) {
$name = $module . '_' . $hook;
$hooks[$name]['unsafe'] = isset($uncronable_modules[$module]) && $hook === 'cron' ? TRUE : FALSE;
$hooks[$name]['description'] = $description;
$hooks[$name]['module'] = $module;
$hooks[$name]['configure'] = isset($info['configure']) ? $info['configure'] : '';
$hooks[$name]['settings'] = ultimate_cron_get_default_settings($module, $name, ultimate_cron_easy_hooks_rule($hook));
}
}
if ($cronapi = module_invoke($module, 'cronapi', 'list')) {
foreach ($cronapi as $name => $description) {
$hooks[$name]['unsafe'] = isset($hooks[$name]['unsafe']) ? $hooks[$name]['unsafe'] : FALSE;
$hooks[$name]['description'] = $description;
$hooks[$name]['module'] = $module;
$hooks[$name]['settings'] = ultimate_cron_get_default_settings($module, $name, ultimate_cron_easy_hooks_rule('cron'));
$hooks[$name]['configure'] = module_invoke($module, 'cronapi', 'configure', $name);
}
}
}
foreach ($hooks as $name => &$hook) {
$hook['callback'] = $hook['function'] = $name;
$hook['background_process'] = array();
$hook['delta'] = $delta++;
}
// Remove ourselves from the list
unset($hooks['ultimate_cron_cron']);
unset($hooks['parallel_cron_cron']);
// Remove Drupal Queue as Ultimate Cron will handle this
unset($hooks['drupal_queue_cron']);
// Allow other to manipulate the hook list
drupal_alter('cron', $hooks);
return $hooks;
}