From: Tim Starling Date: Thu, 31 Jul 2008 09:41:28 +0000 (+0000) Subject: $wgCleanSignatures to disable Parser::cleanSig(). Requested by Wikia. X-Git-Tag: 1.31.0-rc.0~46253 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=64378ddf3bf3a33eb7ffd8c8917b041f981b6a12;p=lhc%2Fweb%2Fwiklou.git $wgCleanSignatures to disable Parser::cleanSig(). Requested by Wikia. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4e7a41bde9..139bfcea91 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 2cc0672eae..bbc2061236 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index c074717b0f..6102259592 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -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' ); diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index 330ec446cb..eb5eac6801 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -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 ); } }