You are here

function ultimate_cron_get_schedule in Ultimate Cron 8

Same name and namespace in other branches
  1. 6 ultimate_cron.module \ultimate_cron_get_schedule()
  2. 7 ultimate_cron.module \ultimate_cron_get_schedule()

Get a list of functions that should be run now.

Parameters

$hooks: Array of cron hooks to check.

Return value

array Functions to run now.

2 calls to ultimate_cron_get_schedule()
drush_ultimate_cron_cron_run in ./ultimate_cron.drush.inc
Run cron job(s)
ultimate_cron_cron_run in ./ultimate_cron.module
The cron handler takes over the normal Drupal cron handler and runs the normal hook_cron() plus the hook_cronapi().

File

./ultimate_cron.module, line 947
@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_schedule($hooks) {

  // Create list of scheduled functions
  $schedule = array();
  foreach ($hooks as $name => &$hook) {
    ultimate_cron_load_hook_data($hook);

    // Store last run in hook for sorting purposes
    $last_run = isset($hook['log']['start']) ? $hook['log']['start'] : 0;
    $hook['last_run'] = $last_run;
    if (ultimate_cron_hook_should_run($hook)) {
      $schedule[$name] = $hook;
    }
  }

  // Sort by last run time
  uasort($schedule, '_ultimate_cron_sort_schedule');

  // Allow other to manipulate the schedule
  drupal_alter('cron_schedule', $schedule);
  return $schedule;
}