API: Make usage of the parser cache in action=parse actually work; was broken since...
authorRoan Kattouw <catrope@users.mediawiki.org>
Sun, 21 Jun 2009 14:29:32 +0000 (14:29 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sun, 21 Jun 2009 14:29:32 +0000 (14:29 +0000)
includes/api/ApiParse.php

index d998070..22f1367 100644 (file)
@@ -51,7 +51,7 @@ class ApiParse extends ApiBase {
 
                // The parser needs $wgTitle to be set, apparently the
                // $title parameter in Parser::parse isn't enough *sigh*
-               global $wgParser, $wgUser, $wgTitle;
+               global $wgParser, $wgUser, $wgTitle, $wgEnableParserCache;
                $popts = new ParserOptions();
                $popts->setTidy(true);
                $popts->enableLimitReport();
@@ -98,13 +98,15 @@ class ApiParse extends ApiBase {
                                if(isset($prop['revid']))
                                        $oldid = $articleObj->getRevIdFetched();
                                // Try the parser cache first
+                               $p_result = false;
                                $pcache = ParserCache::singleton();
-                               $p_result = $pcache->get($articleObj, $wgUser);
+                               if($wgEnableParserCache)
+                                       $p_result = $pcache->get($articleObj, $wgUser);
                                if(!$p_result)
                                {
                                        $p_result = $wgParser->parse($articleObj->getContent(), $titleObj, $popts);
-                                       global $wgUseParserCache;
-                                       if($wgUseParserCache)
+                                       
+                                       if($wgEnableParserCache)
                                                $pcache->save($p_result, $articleObj, $popts);
                                }
                        }