Only load PEAR Smtp mailer from vendor/composer, not from `pear` itself 1.31.0-rc.1
authorChad Horohoe <chadh@wikimedia.org>
Fri, 18 May 2018 01:56:00 +0000 (18:56 -0700)
committerChad Horohoe <chadh@wikimedia.org>
Thu, 24 May 2018 22:24:33 +0000 (15:24 -0700)
Change-Id: I91c42a3eafd079039ddbc17a11ad3c7b6579e3c1

RELEASE-NOTES-1.31
composer.json
includes/mail/UserMailer.php

index a209708..4c70dcc 100644 (file)
@@ -110,6 +110,9 @@ production.
   discussion pages) now have a tooltip to indicate state, not just colour.
 
 === External library changes in 1.31 ===
+* pear/mail, pear/mail_mime and pear/mail_mime-decode have been moved from
+  suggested to required. These packages now must be installed via composer
+  and not via PEAR itself.
 
 ==== Upgraded external libraries ====
 * Updated jquery.chosen from v0.9.14 to v1.8.2.
index 70462bd..771dbda 100644 (file)
@@ -26,6 +26,9 @@
                "liuggio/statsd-php-client": "1.0.18",
                "oojs/oojs-ui": "v0.26.4",
                "oyejorge/less.php": "1.7.0.14",
+               "pear/mail": "1.4.1",
+               "pear/mail_mime": "1.10.2",
+               "pear/mail_mime-decode": "1.5.5.2",
                "php": ">=5.6.99",
                "psr/log": "1.0.2",
                "wikimedia/assert": "0.2.2",
@@ -73,9 +76,6 @@
                "ext-wikidiff2": "Diff accelerator",
                "monolog/monolog": "Flexible debug logging system",
                "nmred/kafka-php": "Send debug log events to kafka",
-               "pear/mail": "Mail sending support",
-               "pear/mail_mime": "Mail sending support",
-               "pear/mail_mime-decode": "Mail sending support",
                "wikimedia/avro": "Binary serialization format used with kafka"
        },
        "autoload": {
index 7b48ad0..bdd4f44 100644 (file)
@@ -198,14 +198,8 @@ class UserMailer {
        private static function isMailMimeUsable() {
                static $usable = null;
                if ( $usable === null ) {
-                       // If the class is not already loaded, and it's in the include path,
-                       // try requiring it.
-                       if ( !class_exists( 'Mail_mime' ) && stream_resolve_include_path( 'Mail/mime.php' ) ) {
-                               require_once 'Mail/mime.php';
-                       }
                        $usable = class_exists( 'Mail_mime' );
                }
-
                return $usable;
        }
 
@@ -218,11 +212,6 @@ class UserMailer {
        private static function isMailUsable() {
                static $usable = null;
                if ( $usable === null ) {
-                       // If the class is not already loaded, and it's in the include path,
-                       // try requiring it.
-                       if ( !class_exists( 'Mail' ) && stream_resolve_include_path( 'Mail.php' ) ) {
-                               require_once 'Mail.php';
-                       }
                        $usable = class_exists( 'Mail' );
                }
 
@@ -396,7 +385,7 @@ class UserMailer {
                        Wikimedia\suppressWarnings();
 
                        // Create the mail object using the Mail::factory method
-                       $mail_object =& Mail::factory( 'smtp', $wgSMTP );
+                       $mail_object = Mail::factory( 'smtp', $wgSMTP );
                        if ( PEAR::isError( $mail_object ) ) {
                                wfDebug( "PEAR::Mail factory failed: " . $mail_object->getMessage() . "\n" );
                                Wikimedia\restoreWarnings();