From 9a932c4bc8e3659515813b7b569e753f0f45d4b0 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 27 Oct 2011 01:19:34 +0000 Subject: [PATCH] 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. --- includes/parser/Parser.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index e8595636ca..c92e59f549 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -3049,7 +3049,8 @@ class Parser { # @todo FIXME: If piece['parts'] is null then the call to getLength() below won't work b/c this $args isn't an object $args = ( null == $piece['parts'] ) ? array() : $piece['parts']; wfProfileOut( __METHOD__.'-setup' ); - wfProfileIn( __METHOD__."-title-$originalTitle" ); + + $titleProfileIn = null; // profile templates # SUBST wfProfileIn( __METHOD__.'-modifiers' ); @@ -3212,6 +3213,8 @@ class Parser { # Load from database if ( !$found && $title ) { + $titleProfileIn = __METHOD__ . "-title-" . $title->getDBKey(); + wfProfileIn( $titleProfileIn ); // template in wfProfileIn( __METHOD__ . '-loadtpl' ); if ( !$title->isExternal() ) { if ( $title->getNamespace() == NS_SPECIAL @@ -3289,7 +3292,9 @@ class Parser { # Recover the source wikitext and return it if ( !$found ) { $text = $frame->virtualBracketedImplode( '{{', '|', '}}', $titleWithSpaces, $args ); - wfProfileOut( __METHOD__."-title-$originalTitle" ); + if ( $titleProfileIn ) { + wfProfileOut( $titleProfileIn ); // template out + } wfProfileOut( __METHOD__ ); return array( 'object' => $text ); } @@ -3319,6 +3324,10 @@ class Parser { $isLocalObj = false; } + if ( $titleProfileIn ) { + wfProfileOut( $titleProfileIn ); // template out + } + # Replace raw HTML by a placeholder # Add a blank line preceding, to prevent it from mucking up # immediately preceding headings @@ -3358,7 +3367,6 @@ class Parser { $ret = array( 'text' => $text ); } - wfProfileOut( __METHOD__."-title-$originalTitle" ); wfProfileOut( __METHOD__ ); return $ret; } -- 2.20.1