Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#1863 Downgrade checkEnvironment level and skip non-prod checks #17807

Merged
merged 1 commit into from
Jul 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions CRM/Utils/Check/Component/Env.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function checkDebug() {
ts('Warning: Debug is enabled in <a href="%1">system settings</a>. 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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't get pop ups for info do you?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right

'fa-bug'
);
$message->addAction(
Expand All @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -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) &&
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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__,
Expand Down Expand Up @@ -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'
);
}
Expand Down