From: Alexandre Emsenhuber Date: Sun, 6 Mar 2011 21:16:22 +0000 (+0000) Subject: Only call ParserOptions::getNumberHeadings() when needed for the benefit of cache... X-Git-Tag: 1.31.0-rc.0~31590 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=9e0c678ddf1dde08ff6b3e8dba1fd47055bde8b7;p=lhc%2Fweb%2Fwiklou.git 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(). --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 5d1535ddf6..fa84d28df1 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -3685,8 +3685,6 @@ class Parser { function formatHeadings( $text, $origText, $isMain=true ) { global $wgMaxTocLevel, $wgContLang, $wgHtml5, $wgExperimentalHtmlIds; - $doNumberHeadings = $this->mOptions->getNumberHeadings(); - # Inhibit editsection links if requested in the page if ( isset( $this->mDoubleUnderscores['noeditsection'] ) ) { $showEditLink = 0; @@ -3904,7 +3902,7 @@ class Parser { } # Don't number the heading if it is the only one (looks silly) - if ( $doNumberHeadings && count( $matches[3] ) > 1) { + if ( count( $matches[3] ) > 1 && $this->mOptions->getNumberHeadings() ) { # the two are different if the line contains a link $headline = $numbering . ' ' . $headline; } diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index d847fc7732..401b309c7c 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -123,7 +123,7 @@ class ParserOutput extends CacheTime { $mProperties = array(), # Name/value pairs to be cached in the DB $mTOCHTML = ''; # HTML of the TOC private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change. - private $mAccessedOptions = null; # List of ParserOptions (stored in the keys) + private $mAccessedOptions = array(); # List of ParserOptions (stored in the keys) const EDITSECTION_REGEX = '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)())#';