From 1e927c4546ff2c200308002a0723f0daf57395d4 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 3 Apr 2014 21:37:58 -0700 Subject: [PATCH] CRM-14423 - CRM_Utils_Check_Env - Add check for other environmental configuration issues --- CRM/Utils/Check.php | 4 ++- CRM/Utils/Check/Env.php | 68 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 CRM/Utils/Check/Env.php 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 -- 2.25.1