You are here

function elysia_cron_module_jobs in Elysia Cron 7.2

Same name and namespace in other branches
  1. 5.2 elysia_cron.module \elysia_cron_module_jobs()
  2. 5 elysia_cron.module \elysia_cron_module_jobs()
  3. 6.2 elysia_cron.module \elysia_cron_module_jobs()
  4. 6 elysia_cron.module \elysia_cron_module_jobs()
  5. 7 elysia_cron.module \elysia_cron_module_jobs()

Fetch information about cron jobs from modules.

Return value

array Array with jobs information.

1 call to elysia_cron_module_jobs()
elysia_cron_initialize in ./elysia_cron.module

File

./elysia_cron.module, line 1013

Code

function elysia_cron_module_jobs() {
  static $jobs;
  if (!isset($jobs)) {
    $jobs = array();
    foreach (module_implements('cron') as $module) {
      if ($module != 'elysia_cron') {
        $jobs[$module . '_cron'] = array(
          'module' => $module,
          'callback' => $module . '_cron',
          'arguments' => array(),
        );
      }
    }
    foreach (module_implements('cronapi') as $module) {
      $function = $module . '_cronapi';
      if (function_exists($function)) {
        $job_list = $function('list');
        if (is_array($job_list)) {
          foreach ($job_list as $job => $data) {
            if (is_array($data)) {
              $jobs[$job] = $data;
            }
            else {

              // Compatibility with v1.x settings.
              $jobs[$job] = array(
                'description' => $data,
                'rule' => ($rule = $function('rule', $job)) ? $rule : FALSE,
                'weight' => ($weight = $function('weight', $job)) ? $weight : 0,
              );
            }
            $jobs[$job] = $jobs[$job] + array(
              'module' => $module,
              'callback' => $job,
              'arguments' => array(),
            );
          }
        }
      }
    }
    if (function_exists('drupal_alter')) {
      drupal_alter('cron', $jobs);
    }
  }
  return $jobs;
}