Fixed braceSubstitution() to only profile templates rather than all kinds of possibly...
authorAaron Schulz <aaron@users.mediawiki.org>
Thu, 27 Oct 2011 01:19:34 +0000 (01:19 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Thu, 27 Oct 2011 01:19:34 +0000 (01:19 +0000)
includes/parser/Parser.php

index e859563..c92e59f 100644 (file)
@@ -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;
        }