r57638 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57637‎ | r57638 | r57639 >
Date:12:52, 11 October 2009
Author:happy-melon
Status:ok
Tags:
Comment:
(bug 21095) allow tracking categories added to the parser to be disabled by setting the system message to "-".
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -2726,14 +2726,10 @@
27272727 * exceeded, provide the values (optional)
27282728 */
27292729 function limitationWarn( $limitationType, $current=null, $max=null) {
2730 - $msgName = $limitationType . '-warning';
27312730 //does no harm if $current and $max are present but are unnecessary for the message
2732 - $warning = wfMsgExt( $msgName, array( 'parsemag', 'escape' ), $current, $max );
 2731+ $warning = wfMsgExt( "$limitationType-warning", array( 'parsemag', 'escape' ), $current, $max );
27332732 $this->mOutput->addWarning( $warning );
2734 - $cat = Title::makeTitleSafe( NS_CATEGORY, wfMsgForContent( $limitationType . '-category' ) );
2735 - if ( $cat ) {
2736 - $this->mOutput->addCategory( $cat->getDBkey(), $this->getDefaultSort() );
2737 - }
 2733+ $this->addTrackingCategory( "$limitationType-category" );
27382734 }
27392735
27402736 /**
@@ -3426,7 +3422,12 @@
34273423 * @return Bool whether the addition was successful
34283424 */
34293425 protected function addTrackingCategory( $msg ){
3430 - $containerCategory = Title::makeTitleSafe( NS_CATEGORY, wfMsgForContent( $msg ) );
 3426+ $cat = wfMsgForContent( $msg );
 3427+
 3428+ # Allow tracking categories to be disabled by setting them to "-"
 3429+ if( $cat === '-' ) return false;
 3430+
 3431+ $containerCategory = Title::makeTitleSafe( NS_CATEGORY, $cat );
34313432 if ( $containerCategory ) {
34323433 $this->mOutput->addCategory( $containerCategory->getDBkey(), $this->getDefaultSort() );
34333434 return true;
Index: trunk/phase3/RELEASE-NOTES
@@ -245,6 +245,9 @@
246246 * (bug 13750) First letter capitalization can now be a per-namespace setting
247247 * (bug 21073) "User does not exist" message no longer displayed on sub-sub-pages
248248 of existing users
 249+* (bug 21095) Tracking categories produced by the parser (expensive parser function
 250+ limit exceeded, __NOINDEX__ tracking, etc) can now be disabled by setting the
 251+ system message ([[MediaWiki:expensive-parserfunction-category]] etc) to "-".
249252
250253 === Bug fixes in 1.16 ===
251254

Status & tagging log