diff options
author | jenkins-bot <jenkins-bot@gerrit.wikimedia.org> | 2020-05-19 00:25:30 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@wikimedia.org> | 2020-05-19 00:25:30 +0000 |
commit | 02401af46e246058c1618e828d547bfe4e8b8b6b (patch) | |
tree | 68d2330f711a0b8dfcd60b0a8d37341e36b5f639 | |
parent | 88d01fb42b1046753a3837b9fd0e57e039bad2c4 (diff) | |
parent | d06b27c7a1681a3d40da26e30357f1c1831436df (diff) | |
download | mediawikicore-02401af46e246058c1618e828d547bfe4e8b8b6b.tar.gz mediawikicore-02401af46e246058c1618e828d547bfe4e8b8b6b.zip |
Merge "Use same WatchedItemStore object everywhere in SpecialWatchlist"
-rw-r--r-- | includes/specials/SpecialWatchlist.php | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index c4b4d9f9e507..60d0d3f4b33f 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -39,7 +39,8 @@ class SpecialWatchlist extends ChangesListSpecialPage { /** @var float|int */ private $maxDays; - /** WatchedItemStore */ + + /** @var WatchedItemStore */ private $watchStore; public function __construct( $page = 'Watchlist', $restriction = 'viewmywatchlist' ) { @@ -480,7 +481,6 @@ class SpecialWatchlist extends ChangesListSpecialPage { $dbr = $this->getDB(); $user = $this->getUser(); $output = $this->getOutput(); - $services = MediaWikiServices::getInstance(); # Show a message about replica DB lag, if applicable $lag = $dbr->getSessionLagStatus()['lag']; @@ -520,12 +520,6 @@ class SpecialWatchlist extends ChangesListSpecialPage { } $dbr->dataSeek( $rows, 0 ); - if ( $this->getConfig()->get( 'RCShowWatchingUsers' ) - && $user->getOption( 'shownumberswatching' ) - ) { - $watchedItemStore = $services->getWatchedItemStore(); - } - $s = $list->beginRecentChangesList(); if ( $this->isStructuredFilterUiEnabled() ) { @@ -555,9 +549,11 @@ class SpecialWatchlist extends ChangesListSpecialPage { $unseen = false; } - if ( isset( $watchedItemStore ) ) { + if ( $this->getConfig()->get( 'RCShowWatchingUsers' ) + && $user->getOption( 'shownumberswatching' ) + ) { $rcTitleValue = new TitleValue( (int)$obj->rc_namespace, $obj->rc_title ); - $rc->numberofWatchingusers = $watchedItemStore->countWatchers( $rcTitleValue ); + $rc->numberofWatchingusers = $this->watchStore->countWatchers( $rcTitleValue ); } else { $rc->numberofWatchingusers = 0; } @@ -866,8 +862,7 @@ class SpecialWatchlist extends ChangesListSpecialPage { * @return int */ protected function countItems() { - $store = MediaWikiServices::getInstance()->getWatchedItemStore(); - $count = $store->countWatchedItems( $this->getUser() ); + $count = $this->watchStore->countWatchedItems( $this->getUser() ); return floor( $count / 2 ); } |