Index: trunk/phase3/includes/diff/DifferenceEngine.php |
— | — | @@ -497,15 +497,8 @@ |
498 | 498 | <h2 class='diff-currentversion-title'>{$revHeader}</h2>\n" ); |
499 | 499 | # Page content may be handled by a hooked call instead... |
500 | 500 | if ( wfRunHooks( 'ArticleContentOnDiff', array( $this, $out ) ) ) { |
501 | | - # Use the current version parser cache if applicable |
502 | | - $pCache = true; |
503 | | - if ( !$this->mNewRev->isCurrent() ) { |
504 | | - $oldEditSectionSetting = $out->parserOptions()->setEditSection( false ); |
505 | | - $pCache = false; |
506 | | - } |
507 | | - |
508 | 501 | $this->loadNewText(); |
509 | | - $out->setRevisionId( $this->mNewRev->getId() ); |
| 502 | + $out->setRevisionId( $this->mNewid ); |
510 | 503 | $out->setArticleFlag( true ); |
511 | 504 | |
512 | 505 | if ( $this->mNewPage->isCssJsSubpage() || $this->mNewPage->isCssOrJsPage() ) { |
— | — | @@ -520,21 +513,32 @@ |
521 | 514 | $out->addHTML( htmlspecialchars( $this->mNewtext ) ); |
522 | 515 | $out->addHTML( "\n</pre>\n" ); |
523 | 516 | } |
524 | | - } elseif ( $pCache ) { |
525 | | - $wikipage = WikiPage::factory( $this->mNewPage ); |
526 | | - $pOutput = ParserCache::singleton()->get( $wikipage, $out->parserOptions() ); |
527 | | - if( $pOutput ) { |
528 | | - $out->addParserOutput( $pOutput ); |
| 517 | + } elseif ( !wfRunHooks( 'ArticleViewCustom', array( $this->mNewtext, $this->mNewPage, $out ) ) ) { |
| 518 | + // Handled by extension |
| 519 | + } else { |
| 520 | + # Use the current version parser cache if applicable |
| 521 | + $wikiPage = WikiPage::factory( $this->mNewPage ); |
| 522 | + $useParserCache = $wikiPage->isParserCacheUsed( $this->getUser(), $this->mNewid ); |
| 523 | + |
| 524 | + $parserOptions = ParserOptions::newFromContext( $this->getContext() ); |
| 525 | + $parserOptions->enableLimitReport(); |
| 526 | + $parserOptions->setTidy( true ); |
| 527 | + |
| 528 | + if ( !$this->mNewRev->isCurrent() ) { |
| 529 | + $parserOptions->setEditSection( false ); |
| 530 | + } |
| 531 | + |
| 532 | + $parserOutput = false; |
| 533 | + if ( $useParserCache ) { |
| 534 | + $parserOutput = ParserCache::singleton()->get( $wikiPage, $out->parserOptions() ); |
| 535 | + } |
| 536 | + |
| 537 | + if( $parserOutput ) { |
| 538 | + $out->addParserOutput( $parserOutput ); |
529 | 539 | } else { |
530 | 540 | $out->addWikiTextTidy( $this->mNewtext ); |
531 | 541 | } |
532 | | - } else { |
533 | | - $out->addWikiTextTidy( $this->mNewtext ); |
534 | 542 | } |
535 | | - |
536 | | - if ( !$this->mNewRev->isCurrent() ) { |
537 | | - $out->parserOptions()->setEditSection( $oldEditSectionSetting ); |
538 | | - } |
539 | 543 | } |
540 | 544 | # Add redundant patrol link on bottom... |
541 | 545 | $out->addHTML( $this->markPatrolledLink() ); |