* (bug 25642) A exception is now thrown instead of a fatal error when using $wgSMTP...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 31 Oct 2010 11:47:03 +0000 (11:47 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 31 Oct 2010 11:47:03 +0000 (11:47 +0000)
Patch by Dmitriy (http://bug-attachment.wikimedia.org/attachment.cgi?id=7754) with correction

RELEASE-NOTES
includes/UserMailer.php

index ce586ea..67337bc 100644 (file)
@@ -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.
index a15f5c8..3033779 100644 (file)
@@ -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());