r70518 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70517‎ | r70518 | r70519 >
Date:19:01, 5 August 2010
Author:platonides
Status:ok (Comments)
Tags:
Comment:
Use ParserOptions accessors.
Only one direct usage remains, in ParserCache::getKey, which will be rewritten.
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/includes/parser/ParserOptions.php (modified) (history)
  • /trunk/phase3/includes/parser/Preprocessor_DOM.php (modified) (history)
  • /trunk/phase3/includes/parser/Preprocessor_Hash.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Preprocessor_Hash.php
@@ -882,11 +882,11 @@
883883 return $root;
884884 }
885885
886 - if ( ++$this->parser->mPPNodeCount > $this->parser->mOptions->mMaxPPNodeCount )
 886+ if ( ++$this->parser->mPPNodeCount > $this->parser->mOptions->getMaxPPNodeCount() )
887887 {
888888 return '<span class="error">Node-count limit exceeded</span>';
889889 }
890 - if ( $expansionDepth > $this->parser->mOptions->mMaxPPExpandDepth ) {
 890+ if ( $expansionDepth > $this->parser->mOptions->getMaxPPExpandDepth() ) {
891891 return '<span class="error">Expansion depth limit exceeded</span>';
892892 }
893893 ++$expansionDepth;
Index: trunk/phase3/includes/parser/Parser.php
@@ -369,7 +369,7 @@
370370
371371 $text = Sanitizer::normalizeCharReferences( $text );
372372
373 - if ( ( $wgUseTidy && $this->mOptions->mTidy ) || $wgAlwaysUseTidy ) {
 373+ if ( ( $wgUseTidy && $this->mOptions->getTidy() ) || $wgAlwaysUseTidy ) {
374374 $text = MWTidy::tidy( $text );
375375 } else {
376376 # attempt to sanitize at least some nesting problems
@@ -411,7 +411,7 @@
412412 $PFreport = "Expensive parser function count: {$this->mExpensiveFunctionCount}/$wgExpensiveParserFunctionLimit\n";
413413 $limitReport =
414414 "NewPP limit report\n" .
415 - "Preprocessor node count: {$this->mPPNodeCount}/{$this->mOptions->mMaxPPNodeCount}\n" .
 415+ "Preprocessor node count: {$this->mPPNodeCount}/{$this->mOptions->getMaxPPNodeCount()}\n" .
416416 "Post-expand include size: {$this->mIncludeSizes['post-expand']}/$max bytes\n" .
417417 "Template argument size: {$this->mIncludeSizes['arg']}/$max bytes\n".
418418 $PFreport;
Index: trunk/phase3/includes/parser/Preprocessor_DOM.php
@@ -901,12 +901,12 @@
902902 return $root;
903903 }
904904
905 - if ( ++$this->parser->mPPNodeCount > $this->parser->mOptions->mMaxPPNodeCount )
 905+ if ( ++$this->parser->mPPNodeCount > $this->parser->mOptions->getMaxPPNodeCount() )
906906 {
907907 return '<span class="error">Node-count limit exceeded</span>';
908908 }
909909
910 - if ( $expansionDepth > $this->parser->mOptions->mMaxPPExpandDepth ) {
 910+ if ( $expansionDepth > $this->parser->mOptions->getMaxPPExpandDepth() ) {
911911 return '<span class="error">Expansion depth limit exceeded</span>';
912912 }
913913 wfProfileIn( __METHOD__ );
Index: trunk/phase3/includes/parser/ParserOptions.php
@@ -50,6 +50,7 @@
5151 function getTargetLanguage() { return $this->mTargetLanguage; }
5252 function getMaxIncludeSize() { return $this->mMaxIncludeSize; }
5353 function getMaxPPNodeCount() { return $this->mMaxPPNodeCount; }
 54+ function getMaxPPExpandDepth() { return $this->mMaxPPExpandDepth; }
5455 function getMaxTemplateDepth() { return $this->mMaxTemplateDepth; }
5556 function getRemoveComments() { return $this->mRemoveComments; }
5657 function getTemplateCallback() { return $this->mTemplateCallback; }

Comments

#Comment by Hashar (talk | contribs)   10:15, 21 November 2010

Maybe we should get a generic accessor such as getOption( 'TargetLanguage' );

Status & tagging log