From fba5f6ac100e2789b13e8696b3ba3fb15b4c1465 Mon Sep 17 00:00:00 2001 From: Andrew Hunt Date: Mon, 27 Apr 2015 11:06:25 -0400 Subject: [PATCH] CRM-13823 Handle situation when cron hasn't run at all ---------------------------------------- * CRM-13823: Admin Status Page https://issues.civicrm.org/jira/browse/CRM-13823 --- CRM/Utils/Check/Env.php | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/CRM/Utils/Check/Env.php b/CRM/Utils/Check/Env.php index 7d176ce1b8..5203ccc633 100644 --- a/CRM/Utils/Check/Env.php +++ b/CRM/Utils/Check/Env.php @@ -199,11 +199,15 @@ class CRM_Utils_Check_Env { $statusPreference->domain_id = CRM_Core_Config::domainID(); $statusPreference->name = 'checkLastCron'; - $statusPreference->find(TRUE); - - $lastCron = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_StatusPreference', $statusPreference->id, 'check_info'); + 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.'); + } - $msg = ts('Last cron run at %1', array(1 => CRM_Utils_Date::customFormat(date('c', $lastCron)))); if ($lastCron > gmdate('U') - 3600) { $messages[] = new CRM_Utils_Check_Message( 'checkLastCron', @@ -222,7 +226,7 @@ class CRM_Utils_Check_Env { $message->addHelp(ts('Learn more in the Administrator\'s Guide supplement', array(1 => 'http://book.civicrm.org/user/advanced-configuration/email-system-configuration/'))); $messages[] = $message; } - elseif ($lastCron <= gmdate('U') - 86400) { + else { $message = new CRM_Utils_Check_Message( 'checkLastCron', $msg, @@ -235,4 +239,28 @@ class CRM_Utils_Check_Env { return $messages; } + + /** + * Checks if new versions are available + * @return array + */ + + public function checkVersion() { + $messages = array(); + + // check turned off: + // return message with status of notice saying check is turned off + + // up-to-date + // return message with status of info saying it's okay + + // new non-security release + // warning + + // new security release + // critical + + // release is eol + // error + } } -- 2.25.1