r100928 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100927‎ | r100928 | r100929 >
Date:01:19, 27 October 2011
Author:aaron
Status:ok
Tags:
Comment:
Fixed braceSubstitution() to only profile templates rather than all kinds of possibly long strings of text to parse. It was dumping the whole text as the name of the profiling entry.
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -3049,8 +3049,9 @@
30503050 # @todo FIXME: If piece['parts'] is null then the call to getLength() below won't work b/c this $args isn't an object
30513051 $args = ( null == $piece['parts'] ) ? array() : $piece['parts'];
30523052 wfProfileOut( __METHOD__.'-setup' );
3053 - wfProfileIn( __METHOD__."-title-$originalTitle" );
30543053
 3054+ $titleProfileIn = null; // profile templates
 3055+
30553056 # SUBST
30563057 wfProfileIn( __METHOD__.'-modifiers' );
30573058 if ( !$found ) {
@@ -3212,6 +3213,8 @@
32133214
32143215 # Load from database
32153216 if ( !$found && $title ) {
 3217+ $titleProfileIn = __METHOD__ . "-title-" . $title->getDBKey();
 3218+ wfProfileIn( $titleProfileIn ); // template in
32163219 wfProfileIn( __METHOD__ . '-loadtpl' );
32173220 if ( !$title->isExternal() ) {
32183221 if ( $title->getNamespace() == NS_SPECIAL
@@ -3289,7 +3292,9 @@
32903293 # Recover the source wikitext and return it
32913294 if ( !$found ) {
32923295 $text = $frame->virtualBracketedImplode( '{{', '|', '}}', $titleWithSpaces, $args );
3293 - wfProfileOut( __METHOD__."-title-$originalTitle" );
 3296+ if ( $titleProfileIn ) {
 3297+ wfProfileOut( $titleProfileIn ); // template out
 3298+ }
32943299 wfProfileOut( __METHOD__ );
32953300 return array( 'object' => $text );
32963301 }
@@ -3319,6 +3324,10 @@
33203325 $isLocalObj = false;
33213326 }
33223327
 3328+ if ( $titleProfileIn ) {
 3329+ wfProfileOut( $titleProfileIn ); // template out
 3330+ }
 3331+
33233332 # Replace raw HTML by a placeholder
33243333 # Add a blank line preceding, to prevent it from mucking up
33253334 # immediately preceding headings
@@ -3358,7 +3367,6 @@
33593368 $ret = array( 'text' => $text );
33603369 }
33613370
3362 - wfProfileOut( __METHOD__."-title-$originalTitle" );
33633371 wfProfileOut( __METHOD__ );
33643372 return $ret;
33653373 }

Status & tagging log