Merge "Use ImportStringSource for simple import sources"
[lhc/web/wiklou.git] / includes / changetags / ChangeTags.php
index e1b9b27..bbb5c8c 100644 (file)
@@ -1090,17 +1090,20 @@ class ChangeTags {
        public static function listExtensionActivatedTags() {
                return ObjectCache::getMainWANInstance()->getWithSetCallback(
                        wfMemcKey( 'active-tags' ),
+                       300,
                        function ( $oldValue, &$ttl, array &$setOpts ) {
-                               $setOpts += DatabaseBase::getCacheSetOptions( wfGetDB( DB_SLAVE ) );
+                               $setOpts += Database::getCacheSetOptions( wfGetDB( DB_SLAVE ) );
 
                                // Ask extensions which tags they consider active
                                $extensionActive = array();
                                Hooks::run( 'ChangeTagsListActive', array( &$extensionActive ) );
                                return $extensionActive;
                        },
-                       300,
-                       array( wfMemcKey( 'active-tags' ) ),
-                       array( 'lockTSE' => INF )
+                       array(
+                               'checkKeys' => array( wfMemcKey( 'active-tags' ) ),
+                               'lockTSE' => 300,
+                               'pcTTL' => 30
+                       )
                );
        }
 
@@ -1132,18 +1135,21 @@ class ChangeTags {
 
                return ObjectCache::getMainWANInstance()->getWithSetCallback(
                        wfMemcKey( 'valid-tags-db' ),
+                       300,
                        function ( $oldValue, &$ttl, array &$setOpts ) use ( $fname ) {
                                $dbr = wfGetDB( DB_SLAVE );
 
-                               $setOpts += DatabaseBase::getCacheSetOptions( $dbr );
+                               $setOpts += Database::getCacheSetOptions( $dbr );
 
                                $tags = $dbr->selectFieldValues( 'valid_tag', 'vt_tag', array(), $fname );
 
                                return array_filter( array_unique( $tags ) );
                        },
-                       300,
-                       array( wfMemcKey( 'valid-tags-db' ) ),
-                       array( 'lockTSE' => INF )
+                       array(
+                               'checkKeys' => array( wfMemcKey( 'valid-tags-db' ) ),
+                               'lockTSE' => 300,
+                               'pcTTL' => 30
+                       )
                );
        }
 
@@ -1159,16 +1165,19 @@ class ChangeTags {
        public static function listExtensionDefinedTags() {
                return ObjectCache::getMainWANInstance()->getWithSetCallback(
                        wfMemcKey( 'valid-tags-hook' ),
+                       300,
                        function ( $oldValue, &$ttl, array &$setOpts ) {
-                               $setOpts += DatabaseBase::getCacheSetOptions( wfGetDB( DB_SLAVE ) );
+                               $setOpts += Database::getCacheSetOptions( wfGetDB( DB_SLAVE ) );
 
                                $tags = array();
                                Hooks::run( 'ListDefinedTags', array( &$tags ) );
                                return array_filter( array_unique( $tags ) );
                        },
-                       300,
-                       array( wfMemcKey( 'valid-tags-hook' ) ),
-                       array( 'lockTSE' => INF )
+                       array(
+                               'checkKeys' => array( wfMemcKey( 'valid-tags-hook' ) ),
+                               'lockTSE' => 300,
+                               'pcTTL' => 30
+                       )
                );
        }
 
@@ -1208,20 +1217,14 @@ class ChangeTags {
         * @return array Array of string => int
         */
        public static function tagUsageStatistics() {
-               static $cachedStats = null;
-
-               // Process cache to avoid I/O and repeated regens during holdoff
-               if ( $cachedStats !== null ) {
-                       return $cachedStats;
-               }
-
                $fname = __METHOD__;
-               $cachedStats = ObjectCache::getMainWANInstance()->getWithSetCallback(
+               return ObjectCache::getMainWANInstance()->getWithSetCallback(
                        wfMemcKey( 'change-tag-statistics' ),
+                       300,
                        function ( $oldValue, &$ttl, array &$setOpts ) use ( $fname ) {
                                $dbr = wfGetDB( DB_SLAVE, 'vslow' );
 
-                               $setOpts += DatabaseBase::getCacheSetOptions( $dbr );
+                               $setOpts += Database::getCacheSetOptions( $dbr );
 
                                $res = $dbr->select(
                                        'change_tag',
@@ -1238,12 +1241,12 @@ class ChangeTags {
 
                                return $out;
                        },
-                       300,
-                       array( wfMemcKey( 'change-tag-statistics' ) ),
-                       array( 'lockTSE' => INF )
+                       array(
+                               'checkKeys' => array( wfMemcKey( 'change-tag-statistics' ) ),
+                               'lockTSE' => 300,
+                               'pcTTL' => 30
+                       )
                );
-
-               return $cachedStats;
        }
 
        /**