Merge "registration: Support $wgMediaHandlers in ExtensionProcessor"
[lhc/web/wiklou.git] / includes / changetags / ChangeTags.php
index cf33484..a0c3cf2 100644 (file)
@@ -518,7 +518,6 @@ class ChangeTags {
                if ( $rev_id ) {
                        $rev = Revision::newFromId( $rev_id );
                        if ( $rev ) {
-                               $title = $rev->getTitle();
                                $logEntry->setTarget( $rev->getTitle() );
                        }
                } elseif ( $log_id ) {
@@ -707,6 +706,7 @@ class ChangeTags {
         * @param User $user Who to attribute the action to
         * @param int $tagCount For deletion only, how many usages the tag had before
         * it was deleted.
+        * @return int ID of the inserted log entry
         * @since 1.25
         */
        protected static function logTagManagementAction( $action, $tag, $reason,
@@ -1220,4 +1220,22 @@ class ChangeTags {
                $wgMemc->set( $key, $out, 300 );
                return $out;
        }
+
+       /**
+        * Indicate whether change tag editing UI is relevant
+        *
+        * Returns true if the user has the necessary right and there are any
+        * editable tags defined.
+        *
+        * This intentionally doesn't check "any addable || any deletable", because
+        * it seems like it would be more confusing than useful if the checkboxes
+        * suddenly showed up because some abuse filter stopped defining a tag and
+        * then suddenly disappeared when someone deleted all uses of that tag.
+        *
+        * @param User $user
+        * @return bool
+        */
+       public static function showTagEditingUI( User $user ) {
+               return $user->isAllowed( 'changetags' ) && (bool)self::listExplicitlyDefinedTags();
+       }
 }