resourceloader: Improve code coverage
[lhc/web/wiklou.git] / includes / SiteStats.php
index 42b080f..bc6b842 100644 (file)
@@ -20,6 +20,8 @@
  * @file
  */
 
+use Wikimedia\Rdbms\IDatabase;
+
 /**
  * Static accessor class for site_stats and related things
  */
@@ -186,6 +188,7 @@ class SiteStats {
                        wfMemcKey( 'SiteStats', 'groupcounts', $group ),
                        $cache::TTL_HOUR,
                        function ( $oldValue, &$ttl, array &$setOpts ) use ( $group ) {
+                               global $wgDisableUserGroupExpiry;
                                $dbr = wfGetDB( DB_REPLICA );
 
                                $setOpts += Database::getCacheSetOptions( $dbr );
@@ -195,7 +198,9 @@ class SiteStats {
                                        'COUNT(*)',
                                        [
                                                'ug_group' => $group,
-                                               'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() )
+                                               $wgDisableUserGroupExpiry ?
+                                                       '1' :
+                                                       'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() )
                                        ],
                                        __METHOD__
                                );