r38279 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38278‎ | r38279 | r38280 >
Date:09:41, 31 July 2008
Author:tstarling
Status:old
Tags:
Comment:
$wgCleanSignatures to disable Parser::cleanSig(). Requested by Wikia.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/includes/parser/ParserOptions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -3839,6 +3839,11 @@
38403840 $this->setOutputType = self::OT_PREPROCESS;
38413841 }
38423842
 3843+ # Option to disable this feature
 3844+ if ( !$this->mOptions->getCleanSignatures() ) {
 3845+ return $text;
 3846+ }
 3847+
38433848 # FIXME: regex doesn't respect extension tags or nowiki
38443849 # => Move this logic to braceSubstitution()
38453850 $substWord = MagicWord::get( 'subst' );
Index: trunk/phase3/includes/parser/ParserOptions.php
@@ -49,6 +49,7 @@
5050 function getRemoveComments() { return $this->mRemoveComments; }
5151 function getTemplateCallback() { return $this->mTemplateCallback; }
5252 function getEnableLimitReport() { return $this->mEnableLimitReport; }
 53+ function getCleanSignatures() { return $this->mCleanSignatures; }
5354
5455 function getSkin() {
5556 if ( !isset( $this->mSkin ) ) {
@@ -91,6 +92,7 @@
9293 function setTemplateCallback( $x ) { return wfSetVar( $this->mTemplateCallback, $x ); }
9394 function enableLimitReport( $x = true ) { return wfSetVar( $this->mEnableLimitReport, $x ); }
9495 function setTimestamp( $x ) { return wfSetVar( $this->mTimestamp, $x ); }
 96+ function setCleanSignatures( $x ) { return wfSetVar( $this->mCleanSignatures, $x ); }
9597
9698 function __construct( $user = null ) {
9799 $this->initialiseFromUser( $user );
@@ -108,7 +110,7 @@
109111 function initialiseFromUser( $userInput ) {
110112 global $wgUseTeX, $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages;
111113 global $wgAllowExternalImagesFrom, $wgAllowSpecialInclusion, $wgMaxArticleSize;
112 - global $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth;
 114+ global $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth, $wgCleanSignatures;
113115 $fname = 'ParserOptions::initialiseFromUser';
114116 wfProfileIn( $fname );
115117 if ( !$userInput ) {
@@ -144,6 +146,7 @@
145147 $this->mRemoveComments = true;
146148 $this->mTemplateCallback = array( 'Parser', 'statelessFetchTemplate' );
147149 $this->mEnableLimitReport = false;
 150+ $this->mCleanSignatures = $wgCleanSignatures;
148151 wfProfileOut( $fname );
149152 }
150153 }
Index: trunk/phase3/includes/DefaultSettings.php
@@ -940,6 +940,11 @@
941941 $wgMaxTemplateDepth = 40;
942942 $wgMaxPPExpandDepth = 40;
943943
 944+/**
 945+ * If true, removes (substitutes) templates in "~~~~" signatures.
 946+ */
 947+$wgCleanSignatures = true;
 948+
944949 $wgExtraSubtitle = '';
945950 $wgSiteSupportPage = ''; # A page where you users can receive donations
946951
Index: trunk/phase3/RELEASE-NOTES
@@ -36,6 +36,8 @@
3737 'EditSectionLinkForOther' hook has been removed, but 'EditSectionLink' is
3838 run in all cases instead, so extensions using the old hooks should still work
3939 if they ran roughly the same code for both hooks (as is almost certain).
 40+* Signature (~~~~) "cleaning", i.e. template removal, can be disabled with
 41+ $wgCleanSignatures=false
4042
4143 === Bug fixes in 1.14 ===
4244

Status & tagging log