Exemplo n.º 1
0
 /**
  * Checks if cron has run in a reasonable amount of time
  * @return array
  */
 public function checkLastCron()
 {
     $messages = array();
     $statusPreference = new CRM_Core_DAO_StatusPreference();
     $statusPreference->domain_id = CRM_Core_Config::domainID();
     $statusPreference->name = 'checkLastCron';
     if ($statusPreference->find(TRUE)) {
         $lastCron = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_StatusPreference', $statusPreference->id, 'check_info');
         $msg = ts('Last cron run at %1.', array(1 => CRM_Utils_Date::customFormat(date('c', $lastCron))));
     } else {
         $lastCron = 0;
         $msg = ts('No cron runs have been recorded.');
     }
     if ($lastCron > gmdate('U') - 3600) {
         $messages[] = new CRM_Utils_Check_Message(__FUNCTION__, $msg, ts('Cron Running OK'), \Psr\Log\LogLevel::INFO, 'fa-clock-o');
     } elseif ($lastCron > gmdate('U') - 86400) {
         $message = new CRM_Utils_Check_Message(__FUNCTION__, $msg, ts('Cron Not Running'), \Psr\Log\LogLevel::WARNING, 'fa-clock-o');
         $message->addHelp(ts('Learn more in the <a href="%1">Administrator\'s Guide supplement</a>', array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs')));
         $messages[] = $message;
     } else {
         $message = new CRM_Utils_Check_Message(__FUNCTION__, $msg, ts('Cron Not Running'), \Psr\Log\LogLevel::ERROR, 'fa-clock-o');
         $message->addHelp(ts('Learn more in the <a href="%1">Administrator\'s Guide supplement</a>', array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs')));
         $messages[] = $message;
     }
     return $messages;
 }
Exemplo n.º 2
0
 /**
  * Checks if cron has run in a reasonable amount of time
  * @return array
  */
 public function checkLastCron()
 {
     $messages = array();
     $statusPreference = new CRM_Core_DAO_StatusPreference();
     $statusPreference->domain_id = CRM_Core_Config::domainID();
     $statusPreference->name = 'checkLastCron';
     if ($statusPreference->find(TRUE) && !empty($statusPreference->check_info)) {
         $lastCron = $statusPreference->check_info;
         $msg = ts('Last cron run at %1.', array(1 => CRM_Utils_Date::customFormat(date('c', $lastCron))));
     } else {
         $lastCron = 0;
         $msg = ts('No cron runs have been recorded.');
     }
     if ($lastCron > gmdate('U') - 3600) {
         $messages[] = new CRM_Utils_Check_Message(__FUNCTION__, $msg, ts('Cron Running OK'), \Psr\Log\LogLevel::INFO, 'fa-clock-o');
     } else {
         $message = new CRM_Utils_Check_Message(__FUNCTION__, $msg, ts('Cron Not Running'), $lastCron > gmdate('U') - 86400 ? \Psr\Log\LogLevel::WARNING : \Psr\Log\LogLevel::ERROR, 'fa-clock-o');
         $docUrl = 'target="_blank" href="' . CRM_Utils_System::docURL(array('resource' => 'wiki', 'page' => 'Managing Scheduled Jobs', 'URLonly' => TRUE)) . '""';
         $message->addHelp(ts('Configuring cron on your server is necessary for running scheduled jobs such as sending mail and scheduled reminders.') . '<br />' . ts("Learn more in the <a %1>online documentation</a>.", array(1 => $docUrl)));
         $messages[] = $message;
     }
     return $messages;
 }