Simplify the nested ifs of Preprocessor_DOM::preprocessToObj()
authorPlatonides <platonides@gmail.com>
Tue, 23 Apr 2013 11:15:52 +0000 (13:15 +0200)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 23 Apr 2013 13:05:09 +0000 (13:05 +0000)
Change-Id: Ibb91068678aca1729f00f1ba7844017771334e94

includes/parser/Preprocessor_DOM.php

index 4ea7dd4..809e7f7 100644 (file)
@@ -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, '<' );