From 91825ea180abd1b338ef19320f62cb4dacc5b5a0 Mon Sep 17 00:00:00 2001 From: addshore Date: Fri, 29 Jan 2016 20:10:26 +0100 Subject: [PATCH] Remove WatchedItem::IMMEDIATE and DEFERRED It looks like this used to actually be used since Ie60e20162fd833e64d81763a6aa1dc3faf2162f3 but since the global wgActivityUpdatesUseJobQueue seems to have been removed from the code. Thus this stuff is doing nothing and things are always DEFERRED. Change-Id: I08cb6051f52e0f0402542d8326f03f115bb00943 --- includes/WatchedItem.php | 49 ++++++++++++---------------------------- includes/user/User.php | 2 +- 2 files changed, 15 insertions(+), 36 deletions(-) diff --git a/includes/WatchedItem.php b/includes/WatchedItem.php index 0ef2373783..e2d626f356 100644 --- a/includes/WatchedItem.php +++ b/includes/WatchedItem.php @@ -59,17 +59,6 @@ class WatchedItem { */ const CHECK_USER_RIGHTS = 1; - /** - * Do DB master updates right now - * @since 1.26 - */ - const IMMEDIATE = 0; - /** - * Do DB master updates via the job queue - * @since 1.26 - */ - const DEFERRED = 1; - /** * Create a WatchedItem object with the given user and title * @since 1.22 $checkRights parameter added @@ -219,10 +208,9 @@ class WatchedItem { * @param bool $force Whether to force the write query to be executed even if the * page is not watched or the notification timestamp is already NULL. * @param int $oldid The revision id being viewed. If not given or 0, latest revision is assumed. - * @mode int $mode WatchedItem::DEFERRED/IMMEDIATE */ public function resetNotificationTimestamp( - $force = '', $oldid = 0, $mode = self::IMMEDIATE + $force = '', $oldid = 0 ) { // Only loggedin user can have a watchlist if ( wfReadOnly() || $this->mUser->isAnon() || !$this->isAllowed( 'editmywatchlist' ) ) { @@ -273,28 +261,19 @@ class WatchedItem { } // If the page is watched by the user (or may be watched), update the timestamp - if ( $mode === self::DEFERRED ) { - $job = new ActivityUpdateJob( - $title, - array( - 'type' => 'updateWatchlistNotification', - 'userid' => $this->getUserId(), - 'notifTime' => $notificationTimestamp, - 'curTime' => time() - ) - ); - // Try to run this post-send - DeferredUpdates::addCallableUpdate( function() use ( $job ) { - $job->run(); - } ); - } else { - $dbw = wfGetDB( DB_MASTER ); - $dbw->update( 'watchlist', - array( 'wl_notificationtimestamp' => $dbw->timestampOrNull( $notificationTimestamp ) ), - $this->dbCond(), - __METHOD__ - ); - } + $job = new ActivityUpdateJob( + $title, + array( + 'type' => 'updateWatchlistNotification', + 'userid' => $this->getUserId(), + 'notifTime' => $notificationTimestamp, + 'curTime' => time() + ) + ); + // Try to run this post-send + DeferredUpdates::addCallableUpdate( function() use ( $job ) { + $job->run(); + } ); $this->timestamp = null; } diff --git a/includes/user/User.php b/includes/user/User.php index 7c2924240c..b1f79cef97 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -3441,7 +3441,7 @@ class User implements IDBAccessObject { } $this->getWatchedItem( $title )->resetNotificationTimestamp( - $force, $oldid, WatchedItem::DEFERRED + $force, $oldid ); } -- 2.20.1