Merge "Renamed "slave" internal LB/DB info field to "replica""
[lhc/web/wiklou.git] / includes / SiteStats.php
index 6c536dd..9507864 100644 (file)
@@ -24,7 +24,7 @@
  * Static accessor class for site_stats and related things
  */
 class SiteStats {
-       /** @var bool|ResultWrapper */
+       /** @var bool|stdClass */
        private static $row;
 
        /** @var bool */
@@ -36,6 +36,10 @@ class SiteStats {
        /** @var int[] */
        private static $pageCount = [];
 
+       static function unload() {
+               self::$loaded = false;
+       }
+
        static function recache() {
                self::load( true );
        }
@@ -62,17 +66,17 @@ class SiteStats {
        }
 
        /**
-        * @return bool|ResultWrapper
+        * @return bool|stdClass
         */
        static function loadAndLazyInit() {
                global $wgMiserMode;
 
-               wfDebug( __METHOD__ . ": reading site_stats from slave\n" );
+               wfDebug( __METHOD__ . ": reading site_stats from replica DB\n" );
                $row = self::doLoad( wfGetDB( DB_SLAVE ) );
 
                if ( !self::isSane( $row ) ) {
                        // Might have just been initialized during this request? Underflow?
-                       wfDebug( __METHOD__ . ": site_stats damaged or missing on slave\n" );
+                       wfDebug( __METHOD__ . ": site_stats damaged or missing on replica DB\n" );
                        $row = self::doLoad( wfGetDB( DB_MASTER ) );
                }
 
@@ -96,7 +100,7 @@ class SiteStats {
 
        /**
         * @param IDatabase $db
-        * @return bool|ResultWrapper
+        * @return bool|stdClass
         */
        static function doLoad( $db ) {
                return $db->selectRow( 'site_stats', [
@@ -107,7 +111,7 @@ class SiteStats {
                                'ss_users',
                                'ss_active_users',
                                'ss_images',
-                       ], false, __METHOD__ );
+                       ], [], __METHOD__ );
        }
 
        /**