From: Aaron Schulz Date: Tue, 25 Sep 2012 03:33:53 +0000 (-0700) Subject: Changed notifyOnPageChange() to use onTransactionIdle(). X-Git-Tag: 1.31.0-rc.0~22185^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=5975deb7f41aa340e895f4ee8330667ef3209010;p=lhc%2Fweb%2Fwiklou.git Changed notifyOnPageChange() to use onTransactionIdle(). Change-Id: I938c771e195cae3731a29bfe55c76c997323cd2e --- diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 01e7132d20..5d5ed8552c 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -194,7 +194,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 +228,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 +260,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 ); @@ -273,7 +273,7 @@ class UserMailer { wfRestoreWarnings(); return Status::newGood(); } else { - # + # # PHP mail() # @@ -446,19 +446,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__ ); } }