Skip to content

Commit

Permalink
Merge pull request civicrm#13 from ginkgostreet/status-page-1
Browse files Browse the repository at this point in the history
CRM-13823 Handle situation when cron hasn't run at all
  • Loading branch information
agh1 committed Apr 27, 2015
2 parents ac9307a + 0f3f005 commit 4a2e71c
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions CRM/Utils/Check/Env.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,15 @@ public function checkLastCron() {
$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',
Expand All @@ -222,7 +226,7 @@ public function checkLastCron() {
$message->addHelp(ts('Learn more in the <a href="%1">Administrator\'s Guide supplement</a>', 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,
Expand All @@ -235,4 +239,28 @@ public function checkLastCron() {

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
}
}

0 comments on commit 4a2e71c

Please sign in to comment.