Merge "Use $wgExpensiveParserFunctionLimit over ParserOptions"
[lhc/web/wiklou.git] / includes / parser / Parser.php
index e766549..ba7ff60 100644 (file)
@@ -463,9 +463,12 @@ class Parser {
                                array_values( $tidyregs ),
                                $text );
                }
-               global $wgExpensiveParserFunctionLimit;
-               if ( $this->mExpensiveFunctionCount > $wgExpensiveParserFunctionLimit ) {
-                       $this->limitationWarn( 'expensive-parserfunction', $this->mExpensiveFunctionCount, $wgExpensiveParserFunctionLimit );
+
+               if ( $this->mExpensiveFunctionCount > $this->mOptions->getExpensiveParserFunctionLimit() ) {
+                       $this->limitationWarn( 'expensive-parserfunction',
+                               $this->mExpensiveFunctionCount,
+                               $this->mOptions->getExpensiveParserFunctionLimit()
+                       );
                }
 
                wfRunHooks( 'ParserAfterTidy', array( &$this, &$text ) );
@@ -473,7 +476,7 @@ class Parser {
                # Information on include size limits, for the benefit of users who try to skirt them
                if ( $this->mOptions->getEnableLimitReport() ) {
                        $max = $this->mOptions->getMaxIncludeSize();
-                       $PFreport = "Expensive parser function count: {$this->mExpensiveFunctionCount}/$wgExpensiveParserFunctionLimit\n";
+                       $PFreport = "Expensive parser function count: {$this->mExpensiveFunctionCount}/{$this->mOptions->getExpensiveParserFunctionLimit()}\n";
                        $limitReport =
                                "NewPP limit report\n" .
                                "Preprocessor node count: {$this->mPPNodeCount}/{$this->mOptions->getMaxPPNodeCount()}\n" .
@@ -3833,12 +3836,8 @@ class Parser {
         * @return Boolean: false if the limit has been exceeded
         */
        function incrementExpensiveFunctionCount() {
-               global $wgExpensiveParserFunctionLimit;
                $this->mExpensiveFunctionCount++;
-               if ( $this->mExpensiveFunctionCount <= $wgExpensiveParserFunctionLimit ) {
-                       return true;
-               }
-               return false;
+               return $this->mExpensiveFunctionCount <= $this->mOptions->getExpensiveParserFunctionLimit();
        }
 
        /**