*/ public function checkAll() { $messages = array_merge( $this->checkMysqlTime(), $this->checkDebug(), $this->checkOutboundMail() ); return $messages; } /** * Check that the MySQL time settings match the PHP time settings. * * @return array an empty array, or a list of warnings */ 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 (!CRM_Utils_Time::isEqual($phpNow, $sqlNow, 2.5 * 60)) { $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'), \Psr\Log\LogLevel::ERROR ); } return $messages; } /** * @return array */ public function checkDebug() { $messages = array(); $config = CRM_Core_Config::singleton(); if ($config->debug) { $messages[] = new CRM_Utils_Check_Message( 'checkDebug', ts('Warning: Debug is enabled in system settings. This should not be enabled on production servers.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/debug', 'reset=1'))), ts('Debug Mode'), \Psr\Log\LogLevel::WARNING ); } return $messages; } /** * @return array */ public function checkOutboundMail() { $messages = array(); $mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'mailing_backend'); if (($mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_REDIRECT_TO_DB || (defined('CIVICRM_MAIL_LOG') && CIVICRM_MAIL_LOG) || $mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_DISABLED || $mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_MOCK) ) { $messages[] = new CRM_Utils_Check_Message( 'checkOutboundMail', ts('Warning: Outbound email is disabled in system settings. Proper settings should be enabled on production servers.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1'))), ts('Outbound Email Settings'), \Psr\Log\LogLevel::WARNING ); } return $messages; } }