Show Highest expansion depth in limit report
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 4 May 2012 20:44:14 +0000 (22:44 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Fri, 4 May 2012 20:44:14 +0000 (22:44 +0200)
With 1.20wmf2 we get a tracking category with all the problem pages,
seeing the limit for a page is a helpful information than

Change-Id: I1916e5fa6de06b923a01cf1f0ca9362287a9fd70

includes/parser/Parser.php
includes/parser/Preprocessor_DOM.php
includes/parser/Preprocessor_Hash.php
includes/parser/Preprocessor_HipHop.hphp

index d5868a7..6d6270a 100644 (file)
@@ -161,7 +161,7 @@ class Parser {
        var $mLinkHolders;
 
        var $mLinkID;
-       var $mIncludeSizes, $mPPNodeCount, $mDefaultSort;
+       var $mIncludeSizes, $mPPNodeCount, $mHighestExpansionDepth, $mDefaultSort;
        var $mTplExpandCache; # empty-frame expansion cache
        var $mTplRedirCache, $mTplDomCache, $mHeadings, $mDoubleUnderscores;
        var $mExpensiveFunctionCount; # number of expensive parser function calls
@@ -304,6 +304,7 @@ class Parser {
                        'arg' => 0,
                );
                $this->mPPNodeCount = 0;
+               $this->mHighestExpansionDepth = 0;
                $this->mDefaultSort = false;
                $this->mHeadings = array();
                $this->mDoubleUnderscores = array();
@@ -478,6 +479,7 @@ class Parser {
                                "Preprocessor node count: {$this->mPPNodeCount}/{$this->mOptions->getMaxPPNodeCount()}\n" .
                                "Post-expand include size: {$this->mIncludeSizes['post-expand']}/$max bytes\n" .
                                "Template argument size: {$this->mIncludeSizes['arg']}/$max bytes\n".
+                               "Highest expansion depth: {$this->mHighestExpansionDepth}/{$this->mOptions->getMaxPPExpandDepth()}\n".
                                $PFreport;
                        wfRunHooks( 'ParserLimitReport', array( $this, &$limitReport ) );
                        $text .= "\n<!-- \n$limitReport-->\n";
index 74a7164..602d88f 100644 (file)
@@ -989,6 +989,9 @@ class PPFrame_DOM implements PPFrame {
                }
                wfProfileIn( __METHOD__ );
                ++$expansionDepth;
+               if ( $expansionDepth > $this->parser->mHighestExpansionDepth ) {
+                       $this->parser->mHighestExpansionDepth = $expansionDepth;
+               }
 
                if ( $root instanceof PPNode_DOM ) {
                        $root = $root->node;
index 587e8ac..dc2d63a 100644 (file)
@@ -944,6 +944,9 @@ class PPFrame_Hash implements PPFrame {
                        return '<span class="error">Expansion depth limit exceeded</span>';
                }
                ++$expansionDepth;
+               if ( $expansionDepth > $this->parser->mHighestExpansionDepth ) {
+                       $this->parser->mHighestExpansionDepth = $expansionDepth;
+               }
 
                $outStack = array( '', '' );
                $iteratorStack = array( false, $root );
index 39c3319..b30b096 100644 (file)
@@ -1102,6 +1102,9 @@ class PPFrame_HipHop implements PPFrame {
                        return '<span class="error">Expansion depth limit exceeded</span>';
                }
                ++$expansionDepth;
+               if ( $expansionDepth > $this->parser->mHighestExpansionDepth ) {
+                       $this->parser->mHighestExpansionDepth = $expansionDepth;
+               }
 
                $outStack = array( '', '' );
                $iteratorStack = array( false, $root );