Merge "SiteStats::jobs fix when there is a single job"
[lhc/web/wiklou.git] / includes / SiteStats.php
index d253805..df3e305 100644 (file)
@@ -189,9 +189,9 @@ class SiteStats {
         * @return int
         */
        static function numberingroup( $group ) {
-               $cache = ObjectCache::getMainWANInstance();
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
                return $cache->getWithSetCallback(
-                       wfMemcKey( 'SiteStats', 'groupcounts', $group ),
+                       $cache->makeKey( 'SiteStats', 'groupcounts', $group ),
                        $cache::TTL_HOUR,
                        function ( $oldValue, &$ttl, array &$setOpts ) use ( $group ) {
                                $dbr = wfGetDB( DB_REPLICA );
@@ -222,13 +222,6 @@ class SiteStats {
                        } catch ( JobQueueError $e ) {
                                self::$jobs = 0;
                        }
-                       /**
-                        * Zero rows still do single row read for row that doesn't exist,
-                        * but people are annoyed by that
-                        */
-                       if ( self::$jobs == 1 ) {
-                               self::$jobs = 0;
-                       }
                }
                return self::$jobs;
        }
@@ -296,7 +289,6 @@ class SiteStatsInit {
        private $mUsers = null, $mFiles = null;
 
        /**
-        * Constructor
         * @param bool|IDatabase $database
         * - boolean: Whether to use the master DB
         * - IDatabase: Database connection to use