Merge "Use varargs in global functions"
[lhc/web/wiklou.git] / includes / watcheditem / WatchedItemStore.php
index 6e907de..1b92f51 100644 (file)
@@ -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 );
@@ -818,7 +823,7 @@ class WatchedItemStore implements WatchedItemStoreInterface, StatsdAwareInterfac
 
                                        $dbw = $this->getConnectionRef( DB_MASTER );
                                        $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
-                                       $ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
+                                       $ticket = $factory->getEmptyTransactionTicket( $fname );
 
                                        $watchersChunks = array_chunk( $watchers, $wgUpdateRowsPerQuery );
                                        foreach ( $watchersChunks as $watchersChunk ) {
@@ -833,7 +838,7 @@ class WatchedItemStore implements WatchedItemStoreInterface, StatsdAwareInterfac
                                                );
                                                if ( count( $watchersChunks ) > 1 ) {
                                                        $factory->commitAndWaitForReplication(
-                                                               __METHOD__, $ticket, [ 'domain' => $dbw->getDomainID() ]
+                                                               $fname, $ticket, [ 'domain' => $dbw->getDomainID() ]
                                                        );
                                                }
                                        }