Merge "Show Highest expansion depth in limit report"
[lhc/web/wiklou.git] / includes / parser / Parser.php
index 6d6270a..e766549 100644 (file)
@@ -726,8 +726,8 @@ class Parser {
        }
 
        /**
-        * Get the target language for the content being parsed. This is usually the 
-        * language that the content is in. 
+        * Get the target language for the content being parsed. This is usually the
+        * language that the content is in.
         */
        function getTargetLanguage() {
                $target = $this->mOptions->getTargetLanguage();
@@ -1273,7 +1273,7 @@ class Parser {
                $text = $this->maybeMakeExternalImage( $url );
                if ( $text === false ) {
                        # Not an image, make a link
-                       $text = Linker::makeExternalLink( $url, 
+                       $text = Linker::makeExternalLink( $url,
                                $this->getConverterLanguage()->markNoConversion($url), true, 'free',
                                $this->getExternalLinkAttribs( $url ) );
                        # Register it in the output object...
@@ -1754,7 +1754,7 @@ class Parser {
                }
 
                if ( $this->getConverterLanguage()->hasVariants() ) {
-                       $selflink = $this->getConverterLanguage()->autoConvertToAllVariants( 
+                       $selflink = $this->getConverterLanguage()->autoConvertToAllVariants(
                                $this->mTitle->getPrefixedText() );
                } else {
                        $selflink = array( $this->mTitle->getPrefixedText() );
@@ -3073,7 +3073,7 @@ class Parser {
         * @private
         */
        function braceSubstitution( $piece, $frame ) {
-               global $wgNonincludableNamespaces, $wgContLang;
+               global $wgContLang;
                wfProfileIn( __METHOD__ );
                wfProfileIn( __METHOD__.'-setup' );
 
@@ -3268,8 +3268,11 @@ class Parser {
 
                # Load from database
                if ( !$found && $title ) {
-                       $titleProfileIn = __METHOD__ . "-title-" . $title->getDBKey();
-                       wfProfileIn( $titleProfileIn ); // template in
+                       if ( !Profiler::instance()->isPersistent() ) {
+                               # Too many unique items can kill profiling DBs/collectors
+                               $titleProfileIn = __METHOD__ . "-title-" . $title->getDBKey();
+                               wfProfileIn( $titleProfileIn ); // template in
+                       }
                        wfProfileIn( __METHOD__ . '-loadtpl' );
                        if ( !$title->isExternal() ) {
                                if ( $title->isSpecialPage()
@@ -3303,7 +3306,7 @@ class Parser {
                                                $isHTML = true;
                                                $this->disableCache();
                                        }
-                               } elseif ( $wgNonincludableNamespaces && in_array( $title->getNamespace(), $wgNonincludableNamespaces ) ) {
+                               } elseif ( MWNamespace::isNonincludableNamespace( $title->getNamespace() ) ) {
                                        $found = false; # access denied
                                        wfDebug( __METHOD__.": template inclusion denied for " . $title->getPrefixedDBkey() );
                                } else {
@@ -4396,8 +4399,7 @@ class Parser {
                ) );
 
                # Context links: [[|name]] and [[name (context)|]]
-               global $wgLegalTitleChars;
-               $tc = "[$wgLegalTitleChars]";
+               $tc = '[' . Title::legalChars() . ']';
                $nc = '[ _0-9A-Za-z\x80-\xff-]'; # Namespaces can use non-ascii!
 
                $p1 = "/\[\[(:?$nc+:|:|)($tc+?)( ?\\($tc+\\))\\|]]/";           # [[ns:page (context)|]]