Remove mcrypt warning except for affected sites.
authoreileen <emcnaughton@wikimedia.org>
Mon, 27 Aug 2018 21:48:56 +0000 (09:48 +1200)
committereileen <emcnaughton@wikimedia.org>
Mon, 27 Aug 2018 21:48:56 +0000 (09:48 +1200)
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

index 0615165c4c49e213cbdfc8fcc713353e87371196..592a306a3308f657b6fb7262f80afa9602ead953 100644 (file)
@@ -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,