Merge "Make pre-commit DB callbacks more atomic with multi-DB updates"
[lhc/web/wiklou.git] / includes / changetags / ChangeTags.php
index af2f66b..a2945af 100644 (file)
@@ -114,7 +114,7 @@ class ChangeTags {
        /**
         * Add tags to a change given its rc_id, rev_id and/or log_id
         *
-        * @param string|array $tags Tags to add to the change
+        * @param string|string[] $tags Tags to add to the change
         * @param int|null $rc_id The rc_id of the change to add the tags to
         * @param int|null $rev_id The rev_id of the change to add the tags to
         * @param int|null $log_id The log_id of the change to add the tags to
@@ -1055,8 +1055,8 @@ class ChangeTags {
                $tagUsage = self::tagUsageStatistics();
 
                if ( !is_null( $user ) ) {
-                       if ( !$user->isAllowed( 'managechangetags' ) ) {
-                               return Status::newFatal( 'tags-manage-no-permission' );
+                       if ( !$user->isAllowed( 'deletechangetags' ) ) {
+                               return Status::newFatal( 'tags-delete-no-permission' );
                        } elseif ( $user->isBlocked() ) {
                                return Status::newFatal( 'tags-manage-blocked' );
                        }
@@ -1134,7 +1134,7 @@ class ChangeTags {
        public static function listExtensionActivatedTags() {
                return ObjectCache::getMainWANInstance()->getWithSetCallback(
                        wfMemcKey( 'active-tags' ),
-                       300,
+                       WANObjectCache::TTL_MINUTE * 5,
                        function ( $oldValue, &$ttl, array &$setOpts ) {
                                $setOpts += Database::getCacheSetOptions( wfGetDB( DB_SLAVE ) );
 
@@ -1145,8 +1145,8 @@ class ChangeTags {
                        },
                        [
                                'checkKeys' => [ wfMemcKey( 'active-tags' ) ],
-                               'lockTSE' => 300,
-                               'pcTTL' => 30
+                               'lockTSE' => WANObjectCache::TTL_MINUTE * 5,
+                               'pcTTL' => WANObjectCache::TTL_PROC_LONG
                        ]
                );
        }
@@ -1179,7 +1179,7 @@ class ChangeTags {
 
                return ObjectCache::getMainWANInstance()->getWithSetCallback(
                        wfMemcKey( 'valid-tags-db' ),
-                       300,
+                       WANObjectCache::TTL_MINUTE * 5,
                        function ( $oldValue, &$ttl, array &$setOpts ) use ( $fname ) {
                                $dbr = wfGetDB( DB_SLAVE );
 
@@ -1191,8 +1191,8 @@ class ChangeTags {
                        },
                        [
                                'checkKeys' => [ wfMemcKey( 'valid-tags-db' ) ],
-                               'lockTSE' => 300,
-                               'pcTTL' => 30
+                               'lockTSE' => WANObjectCache::TTL_MINUTE * 5,
+                               'pcTTL' => WANObjectCache::TTL_PROC_LONG
                        ]
                );
        }
@@ -1209,7 +1209,7 @@ class ChangeTags {
        public static function listExtensionDefinedTags() {
                return ObjectCache::getMainWANInstance()->getWithSetCallback(
                        wfMemcKey( 'valid-tags-hook' ),
-                       300,
+                       WANObjectCache::TTL_MINUTE * 5,
                        function ( $oldValue, &$ttl, array &$setOpts ) {
                                $setOpts += Database::getCacheSetOptions( wfGetDB( DB_SLAVE ) );
 
@@ -1219,8 +1219,8 @@ class ChangeTags {
                        },
                        [
                                'checkKeys' => [ wfMemcKey( 'valid-tags-hook' ) ],
-                               'lockTSE' => 300,
-                               'pcTTL' => 30
+                               'lockTSE' => WANObjectCache::TTL_MINUTE * 5,
+                               'pcTTL' => WANObjectCache::TTL_PROC_LONG
                        ]
                );
        }
@@ -1264,7 +1264,7 @@ class ChangeTags {
                $fname = __METHOD__;
                return ObjectCache::getMainWANInstance()->getWithSetCallback(
                        wfMemcKey( 'change-tag-statistics' ),
-                       300,
+                       WANObjectCache::TTL_MINUTE * 5,
                        function ( $oldValue, &$ttl, array &$setOpts ) use ( $fname ) {
                                $dbr = wfGetDB( DB_SLAVE, 'vslow' );
 
@@ -1287,8 +1287,8 @@ class ChangeTags {
                        },
                        [
                                'checkKeys' => [ wfMemcKey( 'change-tag-statistics' ) ],
-                               'lockTSE' => 300,
-                               'pcTTL' => 30
+                               'lockTSE' => WANObjectCache::TTL_MINUTE * 5,
+                               'pcTTL' => WANObjectCache::TTL_PROC_LONG
                        ]
                );
        }