Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -518,12 +518,7 @@ |
519 | 519 | $flaggedOutput = FlaggedRevs::getPageCache( $article ); |
520 | 520 | if( $flaggedOutput==false ) { |
521 | 521 | global $wgUseStableTemplates; |
522 | | - if( $wgUseStableTemplates ) { |
523 | | - $rev = Revision::newFromId( $frev->getRevId() ); |
524 | | - $text = $rev->getText(); |
525 | | - } else { |
526 | | - $text = $frev->getExpandedText(); |
527 | | - } |
| 522 | + $text = $frev->getTextForParse(); |
528 | 523 | $flaggedOutput = FlaggedRevs::parseStableText( $article, $text, $frev->getRevId() ); |
529 | 524 | # Update the stable version cache |
530 | 525 | FlaggedRevs::updatePageCache( $article, $flaggedOutput ); |
— | — | @@ -1388,12 +1383,7 @@ |
1389 | 1384 | # Try stable version cache. This should be updated before this is called. |
1390 | 1385 | $parserOut = self::getPageCache( $article ); |
1391 | 1386 | if( $parserOut==false ) { |
1392 | | - if( $wgUseStableTemplates ) { |
1393 | | - $rev = Revision::newFromId( $sv->getRevId() ); |
1394 | | - $text = $rev->getText(); |
1395 | | - } else { |
1396 | | - $text = $sv->getExpandedText(); |
1397 | | - } |
| 1387 | + $text = $sv->getTextForParse(); |
1398 | 1388 | # Parse the text |
1399 | 1389 | $parserOut = self::parseStableText( $article, $text, $sv->getRevId() ); |
1400 | 1390 | } |
Index: trunk/extensions/FlaggedRevs/FlaggedRevision.php |
— | — | @@ -123,6 +123,21 @@ |
124 | 124 | $this->loadText(); // load if not loaded |
125 | 125 | return $this->mText; |
126 | 126 | } |
| 127 | + |
| 128 | + /** |
| 129 | + * @returns mixed (string/false) expanded text or revision text. |
| 130 | + * Depends on whether $wgUseStableTemplates is on or not. |
| 131 | + */ |
| 132 | + public function getTextForParse() { |
| 133 | + global $wgUseStableTemplates; |
| 134 | + if( $wgUseStableTemplates ) { |
| 135 | + $rev = Revision::newFromId( $this->getRevId() ); |
| 136 | + $text = $rev->getText(); |
| 137 | + } else { |
| 138 | + $text = $this->getExpandedText(); |
| 139 | + } |
| 140 | + return $text; |
| 141 | + } |
127 | 142 | |
128 | 143 | /** |
129 | 144 | * @returns Integer the user ID of the reviewer |