MediaWiki r38279 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r38278‎ | r38279 (on ViewVC)‎ | r38280 >
Date:09:41, 31 July 2008
Author:tstarling
Status:old
Tags:
Comment:
$wgCleanSignatures to disable Parser::cleanSig(). Requested by Wikia.
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
===================================================================
--- trunk/phase3/includes/parser/Parser.php	(revision 38278)
+++ trunk/phase3/includes/parser/Parser.php	(revision 38279)
@@ -3839,6 +3839,11 @@
 			$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: trunk/phase3/includes/parser/ParserOptions.php
===================================================================
--- trunk/phase3/includes/parser/ParserOptions.php	(revision 38278)
+++ trunk/phase3/includes/parser/ParserOptions.php	(revision 38279)
@@ -49,6 +49,7 @@
 	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 @@
 	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 @@
 	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 @@
 		$this->mRemoveComments = true;
 		$this->mTemplateCallback = array( 'Parser', 'statelessFetchTemplate' );
 		$this->mEnableLimitReport = false;
+		$this->mCleanSignatures = $wgCleanSignatures;
 		wfProfileOut( $fname );
 	}
 }
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 38278)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 38279)
@@ -940,6 +940,11 @@
 $wgMaxTemplateDepth = 40;
 $wgMaxPPExpandDepth = 40;
 
+/**
+ * If true, removes (substitutes) templates in "~~~~" signatures.
+ */
+$wgCleanSignatures = true;
+
 $wgExtraSubtitle	= '';
 $wgSiteSupportPage	= ''; # A page where you users can receive donations
 
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 38278)
+++ trunk/phase3/RELEASE-NOTES	(revision 38279)
@@ -36,6 +36,8 @@
   '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 ===
 

Status & tagging log

  • 15:29, 12 September 2011 Meno25 (Talk | contribs) changed the status of r38279 [removed: ok added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox