From: addshore Date: Mon, 14 Mar 2016 16:12:01 +0000 (+0000) Subject: Use WatchedItemStore::countWatchers in SpecialWatchlist X-Git-Tag: 1.31.0-rc.0~7612^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=4d0da3a3c3ad656f64e25e5e2995624bb62b3fab;p=lhc%2Fweb%2Fwiklou.git Use WatchedItemStore::countWatchers in SpecialWatchlist Bug: T129481 Change-Id: I6da41a80bfc658106862238622f95db087c5bea7 --- diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index dffc9d9885..7af1a54f0a 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -362,6 +362,12 @@ class SpecialWatchlist extends ChangesListSpecialPage { $list->initChangesListRows( $rows ); $dbr->dataSeek( $rows, 0 ); + if ( $this->getConfig()->get( 'RCShowWatchingUsers' ) + && $user->getOption( 'shownumberswatching' ) + ) { + $watchedItemStore = WatchedItemStore::getDefaultInstance(); + } + $s = $list->beginRecentChangesList(); $counter = 1; foreach ( $rows as $obj ) { @@ -375,16 +381,9 @@ class SpecialWatchlist extends ChangesListSpecialPage { $updated = false; } - if ( $this->getConfig()->get( 'RCShowWatchingUsers' ) - && $user->getOption( 'shownumberswatching' ) - ) { - $rc->numberofWatchingusers = $dbr->selectField( 'watchlist', - 'COUNT(*)', - [ - 'wl_namespace' => $obj->rc_namespace, - 'wl_title' => $obj->rc_title, - ], - __METHOD__ ); + if ( isset( $watchedItemStore ) ) { + $rcTitleValue = new TitleValue( $obj->rc_namespace, $obj->rc_title ); + $rc->numberofWatchingusers = $watchedItemStore->countWatchers( $rcTitleValue ); } else { $rc->numberofWatchingusers = 0; }