Add Blob to accepted types for uploads
[lhc/web/wiklou.git] / includes / SiteStats.php
index 76e7f7e..33bab65 100644 (file)
@@ -180,23 +180,24 @@ class SiteStats {
         * @return int
         */
        static function numberingroup( $group ) {
-               if ( !isset( self::$groupMemberCounts[$group] ) ) {
-                       global $wgMemc;
-                       $key = wfMemcKey( 'SiteStats', 'groupcounts', $group );
-                       $hit = $wgMemc->get( $key );
-                       if ( !$hit ) {
+               $cache = ObjectCache::getMainWANInstance();
+               return $cache->getWithSetCallback(
+                       wfMemcKey( 'SiteStats', 'groupcounts', $group ),
+                       $cache::TTL_HOUR,
+                       function ( $oldValue, &$ttl, array &$setOpts ) use ( $group ) {
                                $dbr = wfGetDB( DB_SLAVE );
-                               $hit = $dbr->selectField(
+
+                               $setOpts += Database::getCacheSetOptions( $dbr );
+
+                               return $dbr->selectField(
                                        'user_groups',
                                        'COUNT(*)',
                                        array( 'ug_group' => $group ),
                                        __METHOD__
                                );
-                               $wgMemc->set( $key, $hit, 3600 );
-                       }
-                       self::$groupMemberCounts[$group] = $hit;
-               }
-               return self::$groupMemberCounts[$group];
+                       },
+                       array( 'pcTTL' => 10 )
+               );
        }
 
        /**