From 726760153c557cfd2aea8bbeb3256f2c726d4847 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Sun, 21 Jun 2009 14:29:32 +0000 Subject: [PATCH] API: Make usage of the parser cache in action=parse actually work; was broken since its introduction --- includes/api/ApiParse.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index d998070cf8..22f1367d2d 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -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); } } -- 2.20.1