X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FUserMailer.php;h=b9ce9e0574d14122fc5fc1c9c0772a61658b8352;hb=0233168ce7ebfc8b33de78bacbbadf165c65e82b;hp=01e7132d20506d0d2110525b64483e55147a4db6;hpb=cf0cb43263b7ce63c54a0f07f706ab83a14df591;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 01e7132d20..b9ce9e0574 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -152,6 +152,7 @@ class UserMailer { * @param $body String: email's text. * @param $replyto MailAddress: optional reply-to email (default: null). * @param $contentType String: optional custom Content-Type (default: text/plain; charset=UTF-8) + * @throws MWException * @return Status object */ public static function send( $to, $from, $subject, $body, $replyto = null, $contentType = 'text/plain; charset=UTF-8' ) { @@ -194,7 +195,7 @@ class UserMailer { # NOTE: To: is for presentation, the actual recipient is specified # by the mailer using the Rcpt-To: header. # - # Subject: + # Subject: # PHP mail() second argument to pass the subject, passing a Subject # as an additional header will result in a duplicate header. # @@ -228,7 +229,7 @@ class UserMailer { if ( is_array( $wgSMTP ) ) { # # PEAR MAILER - # + # if ( function_exists( 'stream_resolve_include_path' ) ) { $found = stream_resolve_include_path( 'Mail.php' ); @@ -260,7 +261,7 @@ class UserMailer { } # Split jobs since SMTP servers tends to limit the maximum - # number of possible recipients. + # number of possible recipients. $chunks = array_chunk( $to, $wgEnotifMaxRecips ); foreach ( $chunks as $chunk ) { $status = self::sendWithPear( $mail_object, $chunk, $headers, $body ); @@ -272,8 +273,8 @@ class UserMailer { } wfRestoreWarnings(); return Status::newGood(); - } else { - # + } else { + # # PHP mail() # @@ -446,19 +447,23 @@ class EmailNotification { $watchers[] = intval( $row->wl_user ); } if ( $watchers ) { - // Update wl_notificationtimestamp for all watching users except - // the editor - $dbw->begin( __METHOD__ ); - $dbw->update( 'watchlist', - array( /* SET */ - 'wl_notificationtimestamp' => $dbw->timestamp( $timestamp ) - ), array( /* WHERE */ - 'wl_user' => $watchers, - 'wl_namespace' => $title->getNamespace(), - 'wl_title' => $title->getDBkey(), - ), __METHOD__ + // Update wl_notificationtimestamp for all watching users except the editor + $fname = __METHOD__; + $dbw->onTransactionIdle( + function() use ( $dbw, $timestamp, $watchers, $title, $fname ) { + $dbw->begin( $fname ); + $dbw->update( 'watchlist', + array( /* SET */ + 'wl_notificationtimestamp' => $dbw->timestamp( $timestamp ) + ), array( /* WHERE */ + 'wl_user' => $watchers, + 'wl_namespace' => $title->getNamespace(), + 'wl_title' => $title->getDBkey(), + ), $fname + ); + $dbw->commit( $fname ); + } ); - $dbw->commit( __METHOD__ ); } }