X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fparser%2FPreprocessor_DOM.php;h=7cb91da58816eba29fce706ada1ff78187a5fabb;hb=da953994c843ba2782949d66c006631944ee5aaf;hp=d0c57ab5b5572fde9d5b2bdd7a7e8e27d1bc3d38;hpb=fac1ec45f1201c913f4dc1dc7a2a31d21f77993c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index d0c57ab5b5..7cb91da588 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -169,6 +169,10 @@ class Preprocessor_DOM implements Preprocessor { $this->parser->mGeneratedPPNodeCount += substr_count( $xml, '<' ); $max = $this->parser->mOptions->getMaxGeneratedPPNodeCount(); if ( $this->parser->mGeneratedPPNodeCount > $max ) { + if ( $cacheable ) { + wfProfileOut( __METHOD__ . '-cacheable' ); + } + wfProfileOut( __METHOD__ ); throw new MWException( __METHOD__ . ': generated node count limit exceeded' ); } @@ -183,6 +187,11 @@ class Preprocessor_DOM implements Preprocessor { // 1 << 19 == XML_PARSE_HUGE, needed so newer versions of libxml2 don't barf when the XML is >256 levels deep $result = $dom->loadXML( $xml, 1 << 19 ); if ( !$result ) { + wfProfileOut( __METHOD__ . '-loadXML' ); + if ( $cacheable ) { + wfProfileOut( __METHOD__ . '-cacheable' ); + } + wfProfileOut( __METHOD__ ); throw new MWException( __METHOD__ . ' generated invalid XML' ); } } @@ -397,7 +406,7 @@ class Preprocessor_DOM implements Preprocessor { if ( $stack->top ) { $part = $stack->top->getCurrentPart(); - if ( !(isset( $part->commentEnd ) && $part->commentEnd == $wsStart - 1 )) { + if ( !( isset( $part->commentEnd ) && $part->commentEnd == $wsStart - 1 ) ) { $part->visualEnd = $wsStart; } // Else comments abutting, no change in visual end @@ -746,7 +755,7 @@ class PPDStack { $class = $this->elementClass; $this->stack[] = new $class( $data ); } - $this->top = $this->stack[ count( $this->stack ) - 1 ]; + $this->top = $this->stack[count( $this->stack ) - 1]; $this->accum =& $this->top->getAccum(); } @@ -757,7 +766,7 @@ class PPDStack { $temp = array_pop( $this->stack ); if ( count( $this->stack ) ) { - $this->top = $this->stack[ count( $this->stack ) - 1 ]; + $this->top = $this->stack[count( $this->stack ) - 1]; $this->accum =& $this->top->getAccum(); } else { $this->top = self::$false; @@ -1014,11 +1023,13 @@ class PPFrame_DOM implements PPFrame { while ( count( $iteratorStack ) > 1 ) { $level = count( $outStack ) - 1; - $iteratorNode =& $iteratorStack[ $level ]; + $iteratorNode =& $iteratorStack[$level]; $out =& $outStack[$level]; $index =& $indexStack[$level]; - if ( $iteratorNode instanceof PPNode_DOM ) $iteratorNode = $iteratorNode->node; + if ( $iteratorNode instanceof PPNode_DOM ) { + $iteratorNode = $iteratorNode->node; + } if ( is_array( $iteratorNode ) ) { if ( $index >= count( $iteratorNode ) ) { @@ -1148,9 +1159,7 @@ class PPFrame_DOM implements PPFrame { # Insert a heading marker only for children of # This is to stop extractSections from going over multiple tree levels - if ( $contextNode->parentNode->nodeName == 'root' - && $this->parser->ot['html'] ) - { + if ( $contextNode->parentNode->nodeName == 'root' && $this->parser->ot['html'] ) { # Insert heading index marker $headingIndex = $contextNode->getAttribute( 'i' ); $titleText = $this->title->getPrefixedDBkey();