From d1066fc795d15eabbd1b5d378a18a56173db8ac3 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 12 Jul 2020 22:03:53 -0400 Subject: [PATCH] Downgrade checkEnvironment level and skip non-prod checks --- CRM/Utils/Check/Component/Env.php | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/CRM/Utils/Check/Component/Env.php b/CRM/Utils/Check/Component/Env.php index d6c19a097353..132ecca5365f 100644 --- a/CRM/Utils/Check/Component/Env.php +++ b/CRM/Utils/Check/Component/Env.php @@ -142,7 +142,7 @@ public function checkDebug() { ts('Warning: Debug is enabled in system settings. This should not be enabled on production servers.', [1 => CRM_Utils_System::url('civicrm/admin/setting/debug', 'reset=1')]), ts('Debug Mode Enabled'), - \Psr\Log\LogLevel::WARNING, + CRM_Core_Config::environment() == 'Production' ? \Psr\Log\LogLevel::WARNING : \Psr\Log\LogLevel::INFO, 'fa-bug' ); $message->addAction( @@ -163,6 +163,11 @@ public function checkDebug() { public function checkOutboundMail() { $messages = []; + // CiviMail doesn't work in non-production environments; skip. + if (CRM_Core_Config::environment() != 'Production') { + return $messages; + } + $mailingInfo = Civi::settings()->get('mailing_backend'); if (($mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_REDIRECT_TO_DB || (defined('CIVICRM_MAIL_LOG') && CIVICRM_MAIL_LOG) @@ -189,6 +194,11 @@ public function checkOutboundMail() { public function checkDomainNameEmail() { $messages = []; + // CiviMail doesn't work in non-production environments; skip. + if (CRM_Core_Config::environment() != 'Production') { + return $messages; + } + list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE); $domain = CRM_Core_BAO_Domain::getDomain(); $domainName = $domain->name; @@ -233,6 +243,12 @@ public function checkDomainNameEmail() { */ public function checkDefaultMailbox() { $messages = []; + + // CiviMail doesn't work in non-production environments; skip. + if (CRM_Core_Config::environment() != 'Production') { + return $messages; + } + $config = CRM_Core_Config::singleton(); if (in_array('CiviMail', $config->enableComponents) && @@ -264,6 +280,11 @@ public function checkDefaultMailbox() { public function checkLastCron() { $messages = []; + // Cron doesn't work in non-production environments; skip. + if (CRM_Core_Config::environment() != 'Production') { + return $messages; + } + $statusPreference = new CRM_Core_DAO_StatusPreference(); $statusPreference->domain_id = CRM_Core_Config::domainID(); $statusPreference->name = 'checkLastCron'; @@ -795,6 +816,11 @@ public function checkDbEngine() { public function checkReplyIdForMailing() { $messages = []; + // CiviMail doesn't work in non-production environments; skip. + if (CRM_Core_Config::environment() != 'Production') { + return $messages; + } + if (!CRM_Mailing_PseudoConstant::defaultComponent('Reply', '')) { $messages[] = new CRM_Utils_Check_Message( __FUNCTION__, @@ -839,7 +865,7 @@ public function checkEnvironment() { __FUNCTION__, ts('The environment of this CiviCRM instance is set to \'%1\'. Certain functionality like scheduled jobs has been disabled.', [1 => $environment]), ts('Non-Production Environment'), - \Psr\Log\LogLevel::ALERT, + \Psr\Log\LogLevel::NOTICE, 'fa-bug' ); }