X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fpage%2FWikiPage.php;h=f45036c1db40fea62d78a0cb63c70735b859bbdf;hb=728321e11325d983297c8ea413d97f970c04790b;hp=ca7d74703f586df6736fa978c1a61fbf7a402864;hpb=a2c8c2969420a0f150c03f76e3a0bf9028fcda43;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index ca7d74703f..f45036c1db 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -26,7 +26,6 @@ use MediaWiki\MediaWikiServices; use Wikimedia\Assert\Assert; use Wikimedia\Rdbms\FakeResultWrapper; use Wikimedia\Rdbms\IDatabase; -use Wikimedia\Rdbms\DBError; use Wikimedia\Rdbms\DBUnexpectedError; /** @@ -1147,14 +1146,16 @@ class WikiPage implements Page, IDBAccessObject { return; } - Hooks::run( 'PageViewUpdates', [ $this, $user ] ); - // Update newtalk / watchlist notification status - try { - $user->clearNotification( $this->mTitle, $oldid ); - } catch ( DBError $e ) { - // Avoid outage if the master is not reachable - MWExceptionHandler::logException( $e ); - } + // Update newtalk / watchlist notification status; + // Avoid outage if the master is not reachable by using a deferred updated + DeferredUpdates::addCallableUpdate( + function () use ( $user, $oldid ) { + Hooks::run( 'PageViewUpdates', [ $this, $user ] ); + + $user->clearNotification( $this->mTitle, $oldid ); + }, + DeferredUpdates::PRESEND + ); } /** @@ -1780,7 +1781,7 @@ class WikiPage implements Page, IDBAccessObject { // Update recentchanges if ( !( $flags & EDIT_SUPPRESS_RC ) ) { // Mark as patrolled if the user can do so - $patrolled = $wgUseRCPatrol && !count( + $autopatrolled = $wgUseRCPatrol && !count( $this->mTitle->getUserPermissionsErrors( 'autopatrol', $user ) ); // Add RC row to the DB RecentChange::notifyEdit( @@ -1796,7 +1797,8 @@ class WikiPage implements Page, IDBAccessObject { $oldContent ? $oldContent->getSize() : 0, $newsize, $revisionId, - $patrolled, + $autopatrolled ? RecentChange::PRC_AUTOPATROLLED : + RecentChange::PRC_UNPATROLLED, $tags ); }