(bug 21095) allow tracking categories added to the parser to be disabled by setting...
authorHappy-melon <happy-melon@users.mediawiki.org>
Sun, 11 Oct 2009 12:52:08 +0000 (12:52 +0000)
committerHappy-melon <happy-melon@users.mediawiki.org>
Sun, 11 Oct 2009 12:52:08 +0000 (12:52 +0000)
RELEASE-NOTES
includes/parser/Parser.php

index da4ce72..ffa97c5 100644 (file)
@@ -245,6 +245,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 13750) First letter capitalization can now be a per-namespace setting
 * (bug 21073) "User does not exist" message no longer displayed on sub-sub-pages
   of existing users
+* (bug 21095) Tracking categories produced by the parser (expensive parser function
+  limit exceeded, __NOINDEX__ tracking, etc) can now be disabled by setting the 
+  system message ([[MediaWiki:expensive-parserfunction-category]] etc) to "-".
 
 === Bug fixes in 1.16 ===
 
index a076c47..c96ada4 100644 (file)
@@ -2726,14 +2726,10 @@ class Parser
         *       exceeded, provide the values (optional)
         */
        function limitationWarn( $limitationType, $current=null, $max=null) {
-               $msgName = $limitationType . '-warning';
                //does no harm if $current and $max are present but are unnecessary for the message
-               $warning = wfMsgExt( $msgName, array( 'parsemag', 'escape' ), $current, $max ); 
+               $warning = wfMsgExt( "$limitationType-warning", array( 'parsemag', 'escape' ), $current, $max ); 
                $this->mOutput->addWarning( $warning );
-               $cat = Title::makeTitleSafe( NS_CATEGORY, wfMsgForContent( $limitationType . '-category' ) );
-               if ( $cat ) {
-                       $this->mOutput->addCategory( $cat->getDBkey(), $this->getDefaultSort() );
-               }
+               $this->addTrackingCategory( "$limitationType-category" );
        }
 
        /**
@@ -3426,7 +3422,12 @@ class Parser
         * @return Bool whether the addition was successful
         */
        protected function addTrackingCategory( $msg ){
-               $containerCategory = Title::makeTitleSafe( NS_CATEGORY, wfMsgForContent( $msg ) );
+               $cat = wfMsgForContent( $msg );
+               
+               # Allow tracking categories to be disabled by setting them to "-"
+               if( $cat === '-' ) return false;
+               
+               $containerCategory = Title::makeTitleSafe( NS_CATEGORY, $cat );
                if ( $containerCategory ) {
                        $this->mOutput->addCategory( $containerCategory->getDBkey(), $this->getDefaultSort() );
                        return true;