$wgCleanSignatures to disable Parser::cleanSig(). Requested by Wikia.
authorTim Starling <tstarling@users.mediawiki.org>
Thu, 31 Jul 2008 09:41:28 +0000 (09:41 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Thu, 31 Jul 2008 09:41:28 +0000 (09:41 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
includes/parser/Parser.php
includes/parser/ParserOptions.php

index 4e7a41b..139bfce 100644 (file)
@@ -36,6 +36,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   'EditSectionLinkForOther' hook has been removed, but 'EditSectionLink' is
   run in all cases instead, so extensions using the old hooks should still work
   if they ran roughly the same code for both hooks (as is almost certain).
+* Signature (~~~~) "cleaning", i.e. template removal, can be disabled with 
+  $wgCleanSignatures=false
 
 === Bug fixes in 1.14 ===
 
index 2cc0672..bbc2061 100644 (file)
@@ -940,6 +940,11 @@ $wgMaxPPNodeCount = 1000000;  # A complexity limit on template expansion
 $wgMaxTemplateDepth = 40;
 $wgMaxPPExpandDepth = 40;
 
+/**
+ * If true, removes (substitutes) templates in "~~~~" signatures.
+ */
+$wgCleanSignatures = true;
+
 $wgExtraSubtitle       = '';
 $wgSiteSupportPage     = ''; # A page where you users can receive donations
 
index c074717..6102259 100644 (file)
@@ -3839,6 +3839,11 @@ class Parser
                        $this->setOutputType = self::OT_PREPROCESS;
                }
 
+               # Option to disable this feature
+               if ( !$this->mOptions->getCleanSignatures() ) {
+                       return $text;
+               }
+
                # FIXME: regex doesn't respect extension tags or nowiki
                #  => Move this logic to braceSubstitution()
                $substWord = MagicWord::get( 'subst' );
index 330ec44..eb5eac6 100644 (file)
@@ -49,6 +49,7 @@ class ParserOptions
        function getRemoveComments()                { return $this->mRemoveComments; }
        function getTemplateCallback()              { return $this->mTemplateCallback; }
        function getEnableLimitReport()             { return $this->mEnableLimitReport; }
+       function getCleanSignatures()               { return $this->mCleanSignatures; }
 
        function getSkin() {
                if ( !isset( $this->mSkin ) ) {
@@ -91,6 +92,7 @@ class ParserOptions
        function setTemplateCallback( $x )          { return wfSetVar( $this->mTemplateCallback, $x ); }
        function enableLimitReport( $x = true )     { return wfSetVar( $this->mEnableLimitReport, $x ); }
        function setTimestamp( $x )                 { return wfSetVar( $this->mTimestamp, $x ); }
+       function setCleanSignatures( $x )           { return wfSetVar( $this->mCleanSignatures, $x ); }
 
        function __construct( $user = null ) {
                $this->initialiseFromUser( $user );
@@ -108,7 +110,7 @@ class ParserOptions
        function initialiseFromUser( $userInput ) {
                global $wgUseTeX, $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages;
                global $wgAllowExternalImagesFrom, $wgAllowSpecialInclusion, $wgMaxArticleSize;
-               global $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth;
+               global $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth, $wgCleanSignatures;
                $fname = 'ParserOptions::initialiseFromUser';
                wfProfileIn( $fname );
                if ( !$userInput ) {
@@ -144,6 +146,7 @@ class ParserOptions
                $this->mRemoveComments = true;
                $this->mTemplateCallback = array( 'Parser', 'statelessFetchTemplate' );
                $this->mEnableLimitReport = false;
+               $this->mCleanSignatures = $wgCleanSignatures;
                wfProfileOut( $fname );
        }
 }