use Wikimedia\Assert\Assert;
use Wikimedia\Rdbms\FakeResultWrapper;
use Wikimedia\Rdbms\IDatabase;
-use Wikimedia\Rdbms\DBError;
use Wikimedia\Rdbms\DBUnexpectedError;
/**
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
+ );
}
/**
// 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(
$oldContent ? $oldContent->getSize() : 0,
$newsize,
$revisionId,
- $patrolled,
+ $autopatrolled ? RecentChange::PRC_AUTOPATROLLED :
+ RecentChange::PRC_UNPATROLLED,
$tags
);
}
$target->getId(),
$guser,
null,
- $tags,
- $current->getId()
+ $tags
);
// Set patrolling and bot flag on the edits, which gets rollbacked.