Merge "Fix HTMLForm noData logic in trySubmit"
[lhc/web/wiklou.git] / includes / SiteStats.php
index 580f7cc..215378b 100644 (file)
@@ -36,9 +36,6 @@ class SiteStats {
        /** @var int[] */
        private static $pageCount = [];
 
-       /** @var int[] */
-       private static $groupMemberCounts = [];
-
        static function recache() {
                self::load( true );
        }
@@ -205,8 +202,11 @@ class SiteStats {
         */
        static function jobs() {
                if ( !isset( self::$jobs ) ) {
-                       $dbr = wfGetDB( DB_SLAVE );
-                       self::$jobs = array_sum( JobQueueGroup::singleton()->getQueueSizes() );
+                       try{
+                               self::$jobs = array_sum( JobQueueGroup::singleton()->getQueueSizes() );
+                       } 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
@@ -289,8 +289,10 @@ class SiteStatsInit {
        public function __construct( $database = false ) {
                if ( $database instanceof IDatabase ) {
                        $this->db = $database;
+               } elseif ( $database ) {
+                       $this->db = wfGetDB( DB_MASTER );
                } else {
-                       $this->db = wfGetDB( $database ? DB_MASTER : DB_SLAVE );
+                       $this->db = wfGetDB( DB_SLAVE, 'vslow' );
                }
        }