From 94acc8fa8d9f018c38a79a9893fb9567a91fa352 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Thu, 17 May 2018 18:56:00 -0700 Subject: [PATCH] Only load PEAR Smtp mailer from vendor/composer, not from `pear` itself Change-Id: I91c42a3eafd079039ddbc17a11ad3c7b6579e3c1 --- RELEASE-NOTES-1.31 | 3 +++ composer.json | 6 +++--- includes/mail/UserMailer.php | 13 +------------ 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index a20970811a..4c70dccc15 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -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. diff --git a/composer.json b/composer.json index 70462bd1ac..771dbdab0d 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/includes/mail/UserMailer.php b/includes/mail/UserMailer.php index 7b48ad095a..bdd4f44874 100644 --- a/includes/mail/UserMailer.php +++ b/includes/mail/UserMailer.php @@ -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(); -- 2.20.1