From: Tim Otten Date: Fri, 4 Apr 2014 04:37:58 +0000 (-0700) Subject: CRM-14423 - CRM_Utils_Check_Env - Add check for other environmental configuration... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1e927c4546ff2c200308002a0723f0daf57395d4;p=civicrm-core.git CRM-14423 - CRM_Utils_Check_Env - Add check for other environmental configuration issues --- diff --git a/CRM/Utils/Check.php b/CRM/Utils/Check.php index 65a4ff331d..08b8d7af7c 100644 --- a/CRM/Utils/Check.php +++ b/CRM/Utils/Check.php @@ -95,8 +95,10 @@ class CRM_Utils_Check { */ public function checkAll() { $security = new CRM_Utils_Check_Security(); + $env = new CRM_Utils_Check_Env(); $messages = array_merge( - $security->checkAll() + $security->checkAll(), + $env->checkAll() ); return $messages; } diff --git a/CRM/Utils/Check/Env.php b/CRM/Utils/Check/Env.php new file mode 100644 index 0000000000..7170b453e7 --- /dev/null +++ b/CRM/Utils/Check/Env.php @@ -0,0 +1,68 @@ + + */ + public function checkAll() { + $messages = array_merge( + $this->checkMysqlTime() + ); + return $messages; + } + + public function checkMysqlTime() { + $messages = array(); + + $phpNow = date('Y-m-d H:i'); + $sqlNow = CRM_Core_DAO::singleValueQuery("SELECT date_format(now(), '%Y-%m-%d %H:%i')"); + if ($phpNow != $sqlNow) { + $messages[] = new CRM_Utils_Check_Message( + 'checkMysqlTime', + ts('Timestamps reported by MySQL (eg "%2") and PHP (eg "%3" ) are mismatched.
Read more about this warning', array( + 1 => CRM_Utils_System::getWikiBaseURL() . 'checkMysqlTime', + 2 => $sqlNow, + 3 => $phpNow, + )), + ts('Environment Settings') + ); + } + + return $messages; + } +} \ No newline at end of file