r93965 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93964‎ | r93965 | r93966 >
Date:13:07, 5 August 2011
Author:reedy
Status:ok
Tags:
Comment:
Some annotation for (bug 29907) action=parse only fetches from the parser cache, it does not store to it
Modified paths:
  • /trunk/phase3/includes/api/ApiParse.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiParse.php
@@ -110,9 +110,10 @@
111111 $this->text = $this->getSectionText( $this->text, 'r' . $rev->getId() );
112112 }
113113
 114+ // Do we want to save old revision parses to the parser cache?
114115 $p_result = $wgParser->parse( $this->text, $titleObj, $popts );
115116 }
116 - } else { // Not $oldid
 117+ } else { // Not $oldid, but $pageid or $page
117118 if ( $params['redirects'] ) {
118119 $reqParams = array(
119120 'action' => 'query',
@@ -159,6 +160,7 @@
160161 $oldid = $articleObj->getRevIdFetched();
161162 }
162163
 164+ // Potentially cached
163165 $p_result = $this->getParsedSectionOrText( $articleObj, $titleObj, $popts, $pageid,
164166 isset( $prop['wikitext'] ) ) ;
165167 }
@@ -189,6 +191,7 @@
190192 $result->addValue( null, $this->getModuleName(), $result_array );
191193 return;
192194 }
 195+ // Not cached (save or load)
193196 $p_result = $wgParser->parse( $params['pst'] ? $this->pstText : $this->text, $titleObj, $popts );
194197 }
195198
@@ -321,9 +324,11 @@
322325 $this->text = $this->getSectionText( $articleObj->getRawText(), !is_null ( $pageId )
323326 ? 'page id ' . $pageId : $titleObj->getText() );
324327
 328+ // Not cached (save or load)
325329 return $wgParser->parse( $this->text, $titleObj, $popts );
326330 } else {
327331 // Try the parser cache first
 332+ // getParserOutput will save to Parser cache if able
328333 $pout = $articleObj->getParserOutput();
329334 if ( $getWikitext ) {
330335 $rev = Revision::newFromTitle( $titleObj );
@@ -337,6 +342,7 @@
338343
339344 private function getSectionText( $text, $what ) {
340345 global $wgParser;
 346+ // Not cached (save or load)
341347 $text = $wgParser->getSection( $text, $this->section, false );
342348 if ( $text === false ) {
343349 $this->dieUsage( "There is no section {$this->section} in " . $what, 'nosuchsection' );

Status & tagging log