r83406 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83405‎ | r83406 | r83407 >
Date:21:16, 6 March 2011
Author:ialex
Status:ok
Tags:
Comment:
Only call ParserOptions::getNumberHeadings() when needed for the benefit of cache sharing when this is not used.
Also fixed a bug in ParserOutput when no option is used; otherwise getUsedOptions() will return false and throw warnings in ParserOptions::optionsHash().
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/includes/parser/ParserOutput.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -3685,8 +3685,6 @@
36863686 function formatHeadings( $text, $origText, $isMain=true ) {
36873687 global $wgMaxTocLevel, $wgContLang, $wgHtml5, $wgExperimentalHtmlIds;
36883688
3689 - $doNumberHeadings = $this->mOptions->getNumberHeadings();
3690 -
36913689 # Inhibit editsection links if requested in the page
36923690 if ( isset( $this->mDoubleUnderscores['noeditsection'] ) ) {
36933691 $showEditLink = 0;
@@ -3904,7 +3902,7 @@
39053903 }
39063904
39073905 # Don't number the heading if it is the only one (looks silly)
3908 - if ( $doNumberHeadings && count( $matches[3] ) > 1) {
 3906+ if ( count( $matches[3] ) > 1 && $this->mOptions->getNumberHeadings() ) {
39093907 # the two are different if the line contains a link
39103908 $headline = $numbering . ' ' . $headline;
39113909 }
Index: trunk/phase3/includes/parser/ParserOutput.php
@@ -123,7 +123,7 @@
124124 $mProperties = array(), # Name/value pairs to be cached in the DB
125125 $mTOCHTML = ''; # HTML of the TOC
126126 private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change.
127 - private $mAccessedOptions = null; # List of ParserOptions (stored in the keys)
 127+ private $mAccessedOptions = array(); # List of ParserOptions (stored in the keys)
128128
129129 const EDITSECTION_REGEX = '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#';
130130

Status & tagging log