You are here

function elysia_cron_cron in Elysia Cron 5

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

Hook cron is invoked only by standard drupal cron. It's used to replace drupal cron.

File

./elysia_cron.module, line 139

Code

function elysia_cron_cron() {

  // First cron run is executed in standard drupal way. This is to enable the use of install profiles
  if (variable_get('cron_last', 0) == 0) {
    return;
  }

  // If the path is 'admin/*' this is a manual cron run (probably by admin/logs/status)
  $manual_run = arg(0) == 'admin';
  $result = elysia_cron_run($manual_run);
  if (EC_DRUPAL_VERSION < 7) {

    // I must check for cron_semaphore and delete it if set (is not always deleted by elysia_cron_run, and this situation is only when called by drupal cron, so a check here is right)
    if (variable_get('cron_semaphore', false)) {
      global $conf;
      _ec_variable_del('cron_semaphore');
      $conf['cron_semaphore'] = false;
    }
  }
  if ($manual_run) {
    if ($result) {
      drupal_set_message(t('Cron ran successfully'));
    }
    else {
      drupal_set_message(t('Cron run failed, disabled or nothing to do'));
    }
    drupal_goto(_dcf_internal_path('admin/reports/status'));
  }
  exit;
}