From 1184d56f229b2b3d27a4465acadb30a9340406f8 Mon Sep 17 00:00:00 2001
From: eileen <emcnaughton@wikimedia.org>
Date: Tue, 28 Aug 2018 09:48:56 +1200
Subject: [PATCH] Remove mcrypt warning except for affected sites.

Extensions that wish to have a version of this should implement it themselves as
it is basically pretty trivial & it doesn't make sense to spam non-affected people
---
 CRM/Utils/Check/Component/Env.php | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/CRM/Utils/Check/Component/Env.php b/CRM/Utils/Check/Component/Env.php
index 0615165c4c..592a306a33 100644
--- a/CRM/Utils/Check/Component/Env.php
+++ b/CRM/Utils/Check/Component/Env.php
@@ -125,13 +125,21 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
    */
   public function checkPhpEcrypt() {
     $messages = array();
+    $mailingBackend = Civi::settings()->get('mailing_backend');
+    if (!is_array($mailingBackend)
+      || !isset($mailingBackend['outBound_option'])
+      || $mailingBackend['outBound_option'] != CRM_Mailing_Config::OUTBOUND_OPTION_SMTP
+      || !CRM_Utils_Array::value('smtpAuth', $mailingBackend)
+    ) {
+      return $messages;
+    }
+
     $test_pass = 'iAmARandomString';
     $encrypted_test_pass = CRM_Utils_Crypt::encrypt($test_pass);
     if ($encrypted_test_pass == base64_encode($test_pass)) {
       $messages[] = new CRM_Utils_Check_Message(
         __FUNCTION__,
-        ts('Your PHP does not include the recommended encryption functions. Some passwords will not be stored encrypted, and if you have recently upgraded from a PHP that does include these functions, your encrypted passwords will not be decrypted correctly. If you are using PHP 7.0 or earlier, you probably want to include the "%1" extension.',
-          array('1' => 'mcrypt')
+        ts('Your PHP does not include the mcrypt encryption functions. Your SMTP password will not be stored encrypted, and if you have recently upgraded from a PHP that stored it with encryption, it will not be decrypted correctly.'
         ),
         ts('PHP Missing Extension "mcrypt"'),
         \Psr\Log\LogLevel::WARNING,
-- 
2.25.1