Merge "Removes deprecated $wgUseCommaCount variable"
[lhc/web/wiklou.git] / includes / UserMailer.php
index d3e8cb8..c9db90f 100644 (file)
@@ -239,7 +239,17 @@ class UserMailer {
                # -- hashar 20120218
 
                $headers['From'] = $from->toString();
-               $headers['Return-Path'] = $from->address;
+               $returnPath = $from->address;
+               $extraParams = $wgAdditionalMailParams;
+
+               // Hook to generate custom VERP address for 'Return-Path'
+               wfRunHooks( 'UserMailerChangeReturnPath', array( $to, &$returnPath ) );
+               # Add the envelope sender address using the -f command line option when PHP mail() is used.
+               # Will default to the $from->address when the UserMailerChangeReturnPath hook fails and the
+               # generated VERP address when the hook runs effectively.
+               $extraParams .= ' -f ' . $returnPath;
+
+               $headers['Return-Path'] = $returnPath;
 
                if ( $replyto ) {
                        $headers['Reply-To'] = $replyto->toString();
@@ -371,7 +381,7 @@ class UserMailer {
                                                        self::quotedPrintable( $subject ),
                                                        $body,
                                                        $headers,
-                                                       $wgAdditionalMailParams
+                                                       $extraParams
                                                );
                                        }
                                }
@@ -544,7 +554,6 @@ class EmailNotification {
                                $fname = __METHOD__;
                                $dbw->onTransactionIdle(
                                        function() use ( $dbw, $timestamp, $watchers, $title, $fname ) {
-                                               $dbw->begin( $fname );
                                                $dbw->update( 'watchlist',
                                                        array( /* SET */
                                                                'wl_notificationtimestamp' => $dbw->timestamp( $timestamp )
@@ -554,7 +563,6 @@ class EmailNotification {
                                                                'wl_title' => $title->getDBkey(),
                                                        ), $fname
                                                );
-                                               $dbw->commit( $fname );
                                        }
                                );
                        }