From: Brad Jorsch Date: Tue, 18 Sep 2018 16:01:32 +0000 (-0400) Subject: WatchedItemStore::countVisitingWatchersMultiple() shouldn't query all titles when... X-Git-Tag: 1.34.0-rc.0~4071 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=f5469d36602cb2a95396830b14e9a631d698f3a6 WatchedItemStore::countVisitingWatchersMultiple() shouldn't query all titles when asked for none If a caller gives an empty array for $targetsWithVisitThresholds, per the documentation it should be expecting an empty array in return, not a count of watchers for every title in the database. Bug: T204729 Change-Id: I0f25fae301450d077bb30597281aaef0fba209d4 --- diff --git a/includes/watcheditem/WatchedItemStore.php b/includes/watcheditem/WatchedItemStore.php index 6e907deef8..6b0c2aab11 100644 --- a/includes/watcheditem/WatchedItemStore.php +++ b/includes/watcheditem/WatchedItemStore.php @@ -407,6 +407,11 @@ class WatchedItemStore implements WatchedItemStoreInterface, StatsdAwareInterfac array $targetsWithVisitThresholds, $minimumWatchers = null ) { + if ( $targetsWithVisitThresholds === [] ) { + // No titles requested => no results returned + return []; + } + $dbr = $this->getConnectionRef( DB_REPLICA ); $conds = $this->getVisitingWatchersCondition( $dbr, $targetsWithVisitThresholds );