r79454 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79453‎ | r79454 | r79455 >
Date:22:49, 1 January 2011
Author:reedy
Status:ok
Tags:
Comment:
Per Platonides on CR r75334, use $article->getParserOutput() to get latest revision, rather than doing parser cache stuff ourselves

Helps reduce code duplication too
Modified paths:
  • /trunk/phase3/includes/api/ApiParse.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiParse.php
@@ -95,22 +95,10 @@
9696
9797 // If for some reason the "oldid" is actually the current revision, it may be cached
9898 if ( $titleObj->getLatestRevID() === intval( $oldid ) ) {
99 - $p_result = false;
100 - $pcache = ParserCache::singleton();
101 -
10299 $articleObj = new Article( $titleObj );
 100+ $wgTitle = $titleObj;
103101
104 - if ( $wgEnableParserCache ) {
105 - $p_result = $pcache->get( $articleObj, $popts );
106 - }
107 - if ( !$p_result ) {
108 - $text = $rev->getText( Revision::FOR_THIS_USER );
109 - $p_result = $wgParser->parse( $text, $titleObj, $popts );
110 -
111 - if ( $wgEnableParserCache ) {
112 - $pcache->save( $p_result, $articleObj, $popts );
113 - }
114 - }
 102+ $p_result = $articleObj->getParserOutput();
115103 } else {
116104 $text = $rev->getText( Revision::FOR_THIS_USER );
117105
@@ -166,18 +154,7 @@
167155 $p_result = $wgParser->parse( $text, $titleObj, $popts );
168156 } else {
169157 // Try the parser cache first
170 - $p_result = false;
171 - $pcache = ParserCache::singleton();
172 - if ( $wgEnableParserCache ) {
173 - $p_result = $pcache->get( $articleObj, $popts );
174 - }
175 - if ( !$p_result ) {
176 - $p_result = $wgParser->parse( $articleObj->getContent(), $titleObj, $popts );
177 -
178 - if ( $wgEnableParserCache ) {
179 - $pcache->save( $p_result, $articleObj, $popts );
180 - }
181 - }
 158+ $p_result = $articleObj->getParserOutput();
182159 }
183160 }
184161 } else {

Follow-up revisions

RevisionCommit summaryAuthorDate
r814071.17: MFT r79454, r79455, r79456, r79536, r79727, r79733, r79773, r79774, r80...catrope19:18, 2 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75334* If a action=parse request provides an oldid that is actually the current re...reedy19:16, 24 October 2010

Status & tagging log