You are here

function elysia_cron_internal_execute_channel in Elysia Cron 6.2

Same name and namespace in other branches
  1. 7.2 elysia_cron.module \elysia_cron_internal_execute_channel()

Internal function to execute all jobs in a channel elysia_cron_lock_env() must be called BEFORE calling this method

2 calls to elysia_cron_internal_execute_channel()
elysia_cron_run in ./elysia_cron.module
Public function to invoke a complete cron_run
elysia_cron_run_channel in ./elysia_cron.module
Public function to execute all jobs in a channel

File

./elysia_cron.module, line 1209

Code

function elysia_cron_internal_execute_channel($channel, $jobs, $ignore_running = false) {
  global $elysia_cron_current_channel, $cron_completed, $cron_completed_time;
  elysia_cron_debug('Cron channel %channel run started.', array(
    '%channel' => $channel,
  ));
  $elysia_cron_current_channel = $channel;
  elysia_cron_set($elysia_cron_current_channel, true, array(
    'running' => time(),
    'last_run' => time(),
  ));

  // Register shutdown callback
  register_shutdown_function('elysia_cron_internal_execute_channel_cleanup');

  // Now I can unlock cron semaphore
  elysia_cron_unlock_env();
  elysia_cron_before_execution();
  foreach ($jobs as $job) {
    if ($ignore_running || !elysia_cron_check_run_job($job)) {
      elysia_cron_internal_execute_job($job);
    }
  }
  elysia_cron_after_execution();
  $cron_completed = true;
  $cron_completed_time = time();

  // Cron is really completed after shutdown functions
  register_shutdown_function('elysia_cron_internal_execute_channel_completed');
}