From ac7e41492aef55f91acd30d85aebe778f0bed5a9 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sun, 31 Oct 2010 11:47:03 +0000 Subject: [PATCH] * (bug 25642) A exception is now thrown instead of a fatal error when using $wgSMTP without PEAR mail package Patch by Dmitriy (http://bug-attachment.wikimedia.org/attachment.cgi?id=7754) with correction --- RELEASE-NOTES | 2 ++ includes/UserMailer.php | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ce586ea6b9..67337bc6f7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -377,6 +377,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Use an actual minus sign in diff views, instead of a hyphen. * (bug 23732) Clarified "n links" message on Special:MostLinkedFiles * (bug 23731) Clarified "n links" message on Special:MostLinkedTemplates +* (bug 25642) A exception is now thrown instead of a fatal error when using + $wgSMTP without PEAR mail package === API changes in 1.17 === * (bug 22738) Allow filtering by action type on query=logevent. diff --git a/includes/UserMailer.php b/includes/UserMailer.php index a15f5c886a..3033779689 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -127,6 +127,17 @@ class UserMailer { } if (is_array( $wgSMTP )) { + $found = false; + $pathArray = explode( PATH_SEPARATOR, get_include_path() ); + foreach ( $pathArray as $path ) { + if ( file_exists( $path . DIRECTORY_SEPARATOR . 'Mail.php' ) ) { + $found = true; + break; + } + } + if ( !$found ) { + throw new MWException( 'PEAR mail package is not installed' ); + } require_once( 'Mail.php' ); $msgid = str_replace(" ", "_", microtime()); -- 2.20.1