$xml .= "</list>";
- wfProfileIn( __METHOD__ . '-loadXML' );
$dom = new DOMDocument();
wfSuppressWarnings();
$result = $dom->loadXML( $xml );
// don't barf when the XML is >256 levels deep
$result = $dom->loadXML( $xml, 1 << 19 );
}
- wfProfileOut( __METHOD__ . '-loadXML' );
if ( !$result ) {
throw new MWException( 'Parameters passed to ' . __METHOD__ . ' result in invalid XML' );
$cacheable = ( $wgPreprocessorCacheThreshold !== false
&& strlen( $text ) > $wgPreprocessorCacheThreshold );
if ( $cacheable ) {
- wfProfileIn( __METHOD__ . '-cacheable' );
$cacheKey = wfMemcKey( 'preprocess-xml', md5( $text ), $flags );
$cacheValue = $wgMemc->get( $cacheKey );
}
}
if ( $xml === false ) {
- wfProfileIn( __METHOD__ . '-cache-miss' );
$xml = $this->preprocessToXml( $text, $flags );
$cacheValue = sprintf( "%08d", self::CACHE_VERSION ) . $xml;
$wgMemc->set( $cacheKey, $cacheValue, 86400 );
- wfProfileOut( __METHOD__ . '-cache-miss' );
wfDebugLog( "Preprocessor", "Saved preprocessor XML to memcached (key $cacheKey)" );
}
} else {
$max = $this->parser->mOptions->getMaxGeneratedPPNodeCount();
if ( $this->parser->mGeneratedPPNodeCount > $max ) {
if ( $cacheable ) {
- wfProfileOut( __METHOD__ . '-cacheable' );
}
throw new MWException( __METHOD__ . ': generated node count limit exceeded' );
}
- wfProfileIn( __METHOD__ . '-loadXML' );
$dom = new DOMDocument;
wfSuppressWarnings();
$result = $dom->loadXML( $xml );
if ( $result ) {
$obj = new PPNode_DOM( $dom->documentElement );
}
- wfProfileOut( __METHOD__ . '-loadXML' );
if ( $cacheable ) {
- wfProfileOut( __METHOD__ . '-cacheable' );
}