Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -483,18 +483,21 @@ |
484 | 484 | */ |
485 | 485 | public static function expandText( Title $title, $text, $id ) { |
486 | 486 | global $wgParser; |
487 | | - $options = self::makeParserOptions(); // default options |
488 | 487 | # Notify Parser if includes should be stabilized |
489 | 488 | $resetManager = false; |
490 | 489 | $incManager = FRInclusionManager::singleton(); |
491 | | - if ( self::inclusionSetting() != FR_INCLUDES_CURRENT ) { |
| 490 | + if ( $id && self::inclusionSetting() != FR_INCLUDES_CURRENT ) { |
492 | 491 | # Use FRInclusionManager to do the template/file version query |
493 | 492 | # up front unless the versions are already specified there... |
494 | | - if ( $id && !$incManager->parserOutputIsStabilized( $id ) ) { |
495 | | - $incManager->stabilizeParserOutput( $title, $id ); |
496 | | - $resetManager = true; // need to reset when done |
| 493 | + if ( !$incManager->parserOutputIsStabilized() ) { |
| 494 | + $frev = FlaggedRevision::newFromTitle( $title, $id ); |
| 495 | + if ( $frev ) { |
| 496 | + $incManager->stabilizeParserOutput( $title, $frev ); |
| 497 | + $resetManager = true; // need to reset when done |
| 498 | + } |
497 | 499 | } |
498 | 500 | } |
| 501 | + $options = self::makeParserOptions(); // default options |
499 | 502 | $outputText = $wgParser->preprocess( $text, $title, $options, $id ); |
500 | 503 | $out = $wgParser->mOutput; |
501 | 504 | # Stable parse done! |
— | — | @@ -514,19 +517,22 @@ |
515 | 518 | */ |
516 | 519 | public static function parseStableText( Title $title, $text, $id ) { |
517 | 520 | global $wgParser; |
518 | | - $options = self::makeParserOptions(); // default options |
519 | 521 | # Notify Parser if includes should be stabilized |
520 | 522 | $resetManager = false; |
521 | 523 | $incManager = FRInclusionManager::singleton(); |
522 | | - if ( self::inclusionSetting() != FR_INCLUDES_CURRENT ) { |
| 524 | + if ( $id && self::inclusionSetting() != FR_INCLUDES_CURRENT ) { |
523 | 525 | # Use FRInclusionManager to do the template/file version query |
524 | 526 | # up front unless the versions are already specified there... |
525 | | - if ( $id && !$incManager->parserOutputIsStabilized( $id ) ) { |
526 | | - $incManager->stabilizeParserOutput( $title, $id ); |
527 | | - $resetManager = true; // need to reset when done |
| 527 | + if ( !$incManager->parserOutputIsStabilized() ) { |
| 528 | + $frev = FlaggedRevision::newFromTitle( $title, $id ); |
| 529 | + if ( $frev ) { |
| 530 | + $incManager->stabilizeParserOutput( $title, $frev ); |
| 531 | + $resetManager = true; // need to reset when done |
| 532 | + } |
528 | 533 | } |
529 | 534 | } |
530 | 535 | # Parse the new body, wikitext -> html |
| 536 | + $options = self::makeParserOptions(); // default options |
531 | 537 | $parserOut = $wgParser->parse( $text, $title, $options, true, true, $id ); |
532 | 538 | # Stable parse done! |
533 | 539 | if ( $resetManager ) { |
Index: trunk/extensions/FlaggedRevs/FRInclusionManager.php |
— | — | @@ -66,21 +66,18 @@ |
67 | 67 | * (c) Load their stable version counterparts (avoids DB hits) |
68 | 68 | * Note: Used when calling FlaggedRevs::parseStableText(). |
69 | 69 | * @param Title $title |
70 | | - * @param int $revId |
| 70 | + * @param FlaggedRevision $frev |
71 | 71 | * @return void |
72 | 72 | */ |
73 | | - public function stabilizeParserOutput( Title $title, $revId ) { |
| 73 | + public function stabilizeParserOutput( Title $title, FlaggedRevision $frev ) { |
74 | 74 | $tRevVersions = $fRevVersions = array(); // review time versions |
75 | 75 | $tStbVersions = $fStbVersions = array(); // stable versions |
76 | | - $frev = FlaggedRevision::newFromTitle( $title, $revId ); |
77 | | - if ( $frev ) { |
78 | | - $tRevVersions = $frev->getTemplateVersions(); |
79 | | - $fRevVersions = $frev->getFileVersions(); |
80 | | - # We can preload *most* of the stable version IDs the parser will need... |
81 | | - if ( FlaggedRevs::inclusionSetting() == FR_INCLUDES_STABLE ) { |
82 | | - $tStbVersions = $frev->getStableTemplateVersions(); |
83 | | - $fStbVersions = $frev->getStableFileVersions(); |
84 | | - } |
| 76 | + $tRevVersions = $frev->getTemplateVersions(); |
| 77 | + $fRevVersions = $frev->getFileVersions(); |
| 78 | + # We can preload *most* of the stable version IDs the parser will need... |
| 79 | + if ( FlaggedRevs::inclusionSetting() == FR_INCLUDES_STABLE ) { |
| 80 | + $tStbVersions = $frev->getStableTemplateVersions(); |
| 81 | + $fStbVersions = $frev->getStableFileVersions(); |
85 | 82 | } |
86 | 83 | $this->setReviewedVersions( $tRevVersions, $fRevVersions ); |
87 | 84 | $this->setStableVersionCache( $tStbVersions, $fStbVersions ); |