Index: trunk/phase3/includes/api/ApiParse.php |
— | — | @@ -89,15 +89,36 @@ |
90 | 90 | $this->dieUsage( "You don't have permission to view deleted revisions", 'permissiondenied' ); |
91 | 91 | } |
92 | 92 | |
93 | | - $text = $rev->getText( Revision::FOR_THIS_USER ); |
94 | 93 | $titleObj = $rev->getTitle(); |
| 94 | + |
95 | 95 | $wgTitle = $titleObj; |
96 | 96 | |
97 | | - if ( $this->section !== false ) { |
98 | | - $text = $this->getSectionText( $text, 'r' . $rev ); |
| 97 | + //If for some reason the "oldid" is actually the current revision, it may be cached |
| 98 | + if ( $titleObj->getLatestRevID() === $oldid ) { |
| 99 | + $p_result = false; |
| 100 | + $pcache = ParserCache::singleton(); |
| 101 | + if ( $wgEnableParserCache ) { |
| 102 | + $p_result = $pcache->get( $titleObj, $popts ); |
| 103 | + } |
| 104 | + if ( !$p_result ) { |
| 105 | + $text = $rev->getText( Revision::FOR_THIS_USER ); |
| 106 | + $p_result = $wgParser->parse( $text, $titleObj, $popts ); |
| 107 | + |
| 108 | + if ( $wgEnableParserCache ) { |
| 109 | + $pcache->save( $p_result, $titleObj, $popts ); |
| 110 | + } |
| 111 | + } |
| 112 | + } else { |
| 113 | + $text = $rev->getText( Revision::FOR_THIS_USER ); |
| 114 | + |
| 115 | + $wgTitle = $titleObj; |
| 116 | + |
| 117 | + if ( $this->section !== false ) { |
| 118 | + $text = $this->getSectionText( $text, 'r' . $rev ); |
| 119 | + } |
| 120 | + |
| 121 | + $p_result = $wgParser->parse( $text, $titleObj, $popts ); |
99 | 122 | } |
100 | | - |
101 | | - $p_result = $wgParser->parse( $text, $titleObj, $popts ); |
102 | 123 | } else { |
103 | 124 | if ( !is_null ( $pageid ) ) { |
104 | 125 | $titleObj = Title::newFromID( $pageid ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -444,6 +444,8 @@ |
445 | 445 | * Added iiprop=parsedcomment to prop=imageinfo, similar to prop=revisions |
446 | 446 | * Added rvparse to parse revisions. For performance reasons if this option is |
447 | 447 | used, rvlimit is enforced to 1. |
| 448 | +* If a action=parse request provides an oldid that is actually the current revision |
| 449 | + id, try the parser cache, and save it to it if necessary |
448 | 450 | |
449 | 451 | === Languages updated in 1.17 === |
450 | 452 | |