function ultimate_cron_get_hooks in Ultimate Cron 7.2
Same name and namespace in other branches
- 8 ultimate_cron.module \ultimate_cron_get_hooks()
- 6 ultimate_cron.module \ultimate_cron_get_hooks()
- 7 ultimate_cron.module \ultimate_cron_get_hooks()
Get all cron hooks defined.
Parameters
bool $reset: Reset static cache.
Return value
array All hook definitions available.
3 calls to ultimate_cron_get_hooks()
- ultimate_cron_get_hook in ./
ultimate_cron.module - Get a specific cron hook.
- ultimate_cron_job_ctools_export_ui::list_form in plugins/
ctools/ export_ui/ ultimate_cron_job_ctools_export_ui.class.php - Create the filter/sort form at the top of a list of exports.
- _ultimate_cron_job_load_all in ./
ultimate_cron.module - CTools Export load all callback.
File
- ./
ultimate_cron.module, line 1491
Code
function ultimate_cron_get_hooks($reset = FALSE) {
static $cache = NULL;
if (!$reset && isset($cache)) {
return $cache;
}
$cache = cache_get('ultimate_cron_hooks');
if ($cache && $cache->data) {
$cache = $cache->data;
return $cache;
}
$hooks = array();
// Generate list of jobs provided by modules.
$modules = module_list();
foreach ($modules as $module) {
$hooks += ultimate_cron_get_module_hooks($module);
}
// Generate list of jobs provided by plugins.
$hooks += ultimate_cron_get_plugin_hooks();
// Add default values to hooks.
ultimate_cron_prepare_hooks($hooks);
// Allow other to manipulate the hook list.
drupal_alter('cron', $hooks);
// Keep track on when we first registered new cron jobs.
// This is used for as a base for time comparison in behind schedule
// calculation for jobs that haven't run.
$registered = variable_get('ultimate_cron_hooks_registered', array());
$new = array();
foreach ($hooks as $name => $hook) {
$new[$name] = empty($registered[$name]) ? REQUEST_TIME : $registered[$name];
}
if ($registered != $new) {
variable_set('ultimate_cron_hooks_registered', $new);
}
$cache = $hooks;
cache_set('ultimate_cron_hooks', $cache);
return $cache;
}