From f2b6f389da2abb8811df712a98a069225c7be34e Mon Sep 17 00:00:00 2001 From: Platonides Date: Tue, 23 Apr 2013 13:15:52 +0200 Subject: [PATCH] Simplify the nested ifs of Preprocessor_DOM::preprocessToObj() Change-Id: Ibb91068678aca1729f00f1ba7844017771334e94 --- includes/parser/Preprocessor_DOM.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 4ea7dd4029..809e7f7000 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -148,21 +148,19 @@ class Preprocessor_DOM implements Preprocessor { wfDebugLog( "Preprocessor", "Loaded preprocessor XML from memcached (key $cacheKey)" ); } } - } - if ( $xml === false ) { - if ( $cacheable ) { + 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 { - $xml = $this->preprocessToXml( $text, $flags ); } - + } else { + $xml = $this->preprocessToXml( $text, $flags ); } + // Fail if the number of elements exceeds acceptable limits // Do not attempt to generate the DOM $this->parser->mGeneratedPPNodeCount += substr_count( $xml, '<' ); -- 2.20.1