Index: trunk/phase3/includes/api/ApiParse.php |
— | — | @@ -110,9 +110,10 @@ |
111 | 111 | $this->text = $this->getSectionText( $this->text, 'r' . $rev->getId() ); |
112 | 112 | } |
113 | 113 | |
| 114 | + // Do we want to save old revision parses to the parser cache? |
114 | 115 | $p_result = $wgParser->parse( $this->text, $titleObj, $popts ); |
115 | 116 | } |
116 | | - } else { // Not $oldid |
| 117 | + } else { // Not $oldid, but $pageid or $page |
117 | 118 | if ( $params['redirects'] ) { |
118 | 119 | $reqParams = array( |
119 | 120 | 'action' => 'query', |
— | — | @@ -159,6 +160,7 @@ |
160 | 161 | $oldid = $articleObj->getRevIdFetched(); |
161 | 162 | } |
162 | 163 | |
| 164 | + // Potentially cached |
163 | 165 | $p_result = $this->getParsedSectionOrText( $articleObj, $titleObj, $popts, $pageid, |
164 | 166 | isset( $prop['wikitext'] ) ) ; |
165 | 167 | } |
— | — | @@ -189,6 +191,7 @@ |
190 | 192 | $result->addValue( null, $this->getModuleName(), $result_array ); |
191 | 193 | return; |
192 | 194 | } |
| 195 | + // Not cached (save or load) |
193 | 196 | $p_result = $wgParser->parse( $params['pst'] ? $this->pstText : $this->text, $titleObj, $popts ); |
194 | 197 | } |
195 | 198 | |
— | — | @@ -321,9 +324,11 @@ |
322 | 325 | $this->text = $this->getSectionText( $articleObj->getRawText(), !is_null ( $pageId ) |
323 | 326 | ? 'page id ' . $pageId : $titleObj->getText() ); |
324 | 327 | |
| 328 | + // Not cached (save or load) |
325 | 329 | return $wgParser->parse( $this->text, $titleObj, $popts ); |
326 | 330 | } else { |
327 | 331 | // Try the parser cache first |
| 332 | + // getParserOutput will save to Parser cache if able |
328 | 333 | $pout = $articleObj->getParserOutput(); |
329 | 334 | if ( $getWikitext ) { |
330 | 335 | $rev = Revision::newFromTitle( $titleObj ); |
— | — | @@ -337,6 +342,7 @@ |
338 | 343 | |
339 | 344 | private function getSectionText( $text, $what ) { |
340 | 345 | global $wgParser; |
| 346 | + // Not cached (save or load) |
341 | 347 | $text = $wgParser->getSection( $text, $this->section, false ); |
342 | 348 | if ( $text === false ) { |
343 | 349 | $this->dieUsage( "There is no section {$this->section} in " . $what, 'nosuchsection' ); |