You are here

function elysia_cron_run_channel in Elysia Cron 7.2

Same name and namespace in other branches
  1. 6.2 elysia_cron.module \elysia_cron_run_channel()

Public function to execute all jobs in a channel.

Parameters

bool $ignore_disable: Run the channel (and all it's jobs) even if disabled.

bool $ignore_time: Run channel (and all it's jobs) job even if not ready.

bool $ignore_running: Run the channel (and all it's jobs) even if already running.

Return value

bool Result of execution.

1 call to elysia_cron_run_channel()
drush_elysia_cron_run_wrapper in ./elysia_cron.drush.inc
Custom callback for 'elysia-cron' drush command.

File

./elysia_cron.module, line 1330

Code

function elysia_cron_run_channel($channel, $ignore_disable = FALSE, $ignore_time = FALSE, $ignore_running = FALSE) {
  global $_elysia_cron_settings_by_channel;

  // Always $manual_run.
  elysia_cron_prepare_run(TRUE);
  if ($execute = elysia_cron_lock_env($channel)) {
    elysia_cron_initialize();
    $jobs = FALSE;
    if (isset($_elysia_cron_settings_by_channel[$channel])) {
      if ($ignore_disable || empty($_elysia_cron_settings_by_channel[$channel]['#data']['disabled'])) {
        $jobs = elysia_cron_check_run_channel($channel, $ignore_disable, $ignore_time, $ignore_running);
        if ($jobs && count($jobs)) {

          // elysia_cron_internal_execute_channel calls elysia_cron_unlock_env.
          elysia_cron_internal_execute_channel($channel, $jobs, $ignore_running);
        }
        else {
          elysia_cron_debug('Channel already running or no jobs ready to be executed, skipping');
        }
      }
      else {
        elysia_cron_warning('Channel is disabled, skipping');
      }
    }
    else {
      elysia_cron_warning('Channel not found, skipping');
    }
    if (!$jobs) {

      // No jobs should be executed, i must unlock cron semaphore.
      elysia_cron_unlock_env();
    }
  }
  elysia_cron_unprepare_run(TRUE);
  return $execute;
}