X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FEditPage.php;h=2bddc3ee737ec5d6b6a94c3d1f6ecc373beaddc9;hb=b7f078c75e75c57aa06c4f61f0427bd5ffcf219a;hp=81f35f9ea2ec744ace290f1e7bda223d58d33031;hpb=040f150fd0722a122aea68cb3f40dbfe6e271ee7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/EditPage.php b/includes/EditPage.php index 81f35f9ea2..2bddc3ee73 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2041,7 +2041,7 @@ class EditPage { } /** - * @param Title $title + * @param User $user * @param string $oldModel * @param string $newModel * @param string $reason @@ -2059,26 +2059,26 @@ class EditPage { $log->publish( $logid ); } - /** * Register the change of watch status */ protected function updateWatchlist() { global $wgUser; - if ( $wgUser->isLoggedIn() - && $this->watchthis != $wgUser->isWatched( $this->mTitle, WatchedItem::IGNORE_USER_RIGHTS ) - ) { - $fname = __METHOD__; - $title = $this->mTitle; - $watch = $this->watchthis; - - // Do this in its own transaction to reduce contention... - $dbw = wfGetDB( DB_MASTER ); - $dbw->onTransactionIdle( function () use ( $dbw, $title, $watch, $wgUser, $fname ) { - WatchAction::doWatchOrUnwatch( $watch, $title, $wgUser ); - } ); + if ( !$wgUser->isLoggedIn() ) { + return; } + + $user = $wgUser; + $title = $this->mTitle; + $watch = $this->watchthis; + // Do this in its own transaction to reduce contention... + DeferredUpdates::addCallableUpdate( function () use ( $user, $title, $watch ) { + if ( $watch == $user->isWatched( $title, WatchedItem::IGNORE_USER_RIGHTS ) ) { + return; // nothing to change + } + WatchAction::doWatchOrUnwatch( $watch, $title, $user ); + } ); } /**