Пример #1
0
 /**
  * @param bool $auth
  */
 public function execute($auth = TRUE)
 {
     $this->logEntry('Starting scheduled jobs execution');
     if ($auth && !CRM_Utils_System::authenticateKey(TRUE)) {
         $this->logEntry('Could not authenticate the site key.');
     }
     require_once 'api/api.php';
     // it's not asynchronous at this stage
     CRM_Utils_Hook::cron($this);
     foreach ($this->jobs as $job) {
         if ($job->is_active) {
             if ($job->needsRunning()) {
                 $this->executeJob($job);
             }
         }
     }
     $this->logEntry('Finishing scheduled jobs execution.');
     // Set last cron date for the status check
     $statusPref = array('name' => 'checkLastCron', 'check_info' => gmdate('U'));
     CRM_Core_BAO_StatusPreference::create($statusPref);
 }