From 7d79c3ae7b24a33ba8493db31726ba8560f6d90e Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 1 Jan 2011 22:49:47 +0000 Subject: [PATCH] Per Platonides on CR r75334, use $article->getParserOutput() to get latest revision, rather than doing parser cache stuff ourselves Helps reduce code duplication too --- includes/api/ApiParse.php | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 39da1036dc..7029683128 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -95,22 +95,10 @@ class ApiParse extends ApiBase { // If for some reason the "oldid" is actually the current revision, it may be cached if ( $titleObj->getLatestRevID() === intval( $oldid ) ) { - $p_result = false; - $pcache = ParserCache::singleton(); - $articleObj = new Article( $titleObj ); + $wgTitle = $titleObj; - if ( $wgEnableParserCache ) { - $p_result = $pcache->get( $articleObj, $popts ); - } - if ( !$p_result ) { - $text = $rev->getText( Revision::FOR_THIS_USER ); - $p_result = $wgParser->parse( $text, $titleObj, $popts ); - - if ( $wgEnableParserCache ) { - $pcache->save( $p_result, $articleObj, $popts ); - } - } + $p_result = $articleObj->getParserOutput(); } else { $text = $rev->getText( Revision::FOR_THIS_USER ); @@ -166,18 +154,7 @@ class ApiParse extends ApiBase { $p_result = $wgParser->parse( $text, $titleObj, $popts ); } else { // Try the parser cache first - $p_result = false; - $pcache = ParserCache::singleton(); - if ( $wgEnableParserCache ) { - $p_result = $pcache->get( $articleObj, $popts ); - } - if ( !$p_result ) { - $p_result = $wgParser->parse( $articleObj->getContent(), $titleObj, $popts ); - - if ( $wgEnableParserCache ) { - $pcache->save( $p_result, $articleObj, $popts ); - } - } + $p_result = $articleObj->getParserOutput(); } } } else { -- 2.20.1