You are here

function civicrm_cron_cron in CiviCRM Cron 8

Same name and namespace in other branches
  1. 6 civicrm_cron.module \civicrm_cron_cron()
  2. 7.2 civicrm_cron.module \civicrm_cron_cron()
  3. 7 civicrm_cron.module \civicrm_cron_cron()

Implements hook_cron().

File

./civicrm_cron.module, line 11
CiviCRM Cron Module.

Code

function civicrm_cron_cron() {

  /** @var \Drupal\civicrm_cron\CronRunner $runner */
  $runner = \Drupal::service('civicrm_cron.cron_runner');

  /** @var \Psr\Log\LoggerInterface $logger */
  $logger = \Drupal::logger('civicrm_cron');
  try {
    $runner
      ->runCron();
    $logger
      ->notice(t('CiviCRM Cron: Successfully Run'));
  } catch (\Exception $e) {
    $logger
      ->error(t('CiviCRM Cron:') . ' ' . $e
      ->getMessage());
  }
}