r76444 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76443‎ | r76444 | r76445 >
Date:15:03, 10 November 2010
Author:demon
Status:ok
Tags:
Comment:
MFT r75332, r75481: Adding hook for changing content on diff pages
Modified paths:
  • /branches/wmf/1.16wmf4 (modified) (history)
  • /branches/wmf/1.16wmf4/docs/hooks.txt (modified) (history)
  • /branches/wmf/1.16wmf4/includes/diff/DifferenceInterface.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/docs/hooks.txt
@@ -356,6 +356,10 @@
357357 $output: the OutputPage object ($wgOut)
358358 &$reason: the reason (string) the article is being deleted
359359
 360+'ArticleContentOnDiff': before showing the article below a diff
 361+ $diffEngine: the DifferenceEngine
 362+ $output: the OutputPage object ($wgOut)
 363+
360364 'ArticleDelete': before an article is deleted
361365 $article: the article (object) being deleted
362366 $user: the user (object) deleting the article
Index: branches/wmf/1.16wmf4/includes/diff/DifferenceInterface.php
@@ -443,21 +443,24 @@
444444 $wgOut->addHTML( htmlspecialchars( $this->mNewtext ) );
445445 $wgOut->addHTML( "\n</pre>\n" );
446446 }
447 - } elseif( $pCache ) {
448 - $article = new Article( $this->mTitle, 0 );
449 - $pOutput = ParserCache::singleton()->get( $article, $wgUser );
450 - if( $pOutput ) {
451 - $wgOut->addParserOutput( $pOutput );
 447+ } elseif( wfRunHooks( 'ArticleContentOnDiff', array( $this, $wgOut ) ) ) {
 448+ if ( $pCache ) {
 449+ $article = new Article( $this->mTitle, 0 );
 450+ $pOutput = ParserCache::singleton()->get( $article, $wgOut->parserOptions() );
 451+ if( $pOutput ) {
 452+ $wgOut->addParserOutput( $pOutput );
 453+ } else {
 454+ $article->doViewParse();
 455+ }
452456 } else {
453 - $article->doViewParse();
 457+ $wgOut->addWikiTextTidy( $this->mNewtext );
454458 }
455 - } else {
456 - $wgOut->addWikiTextTidy( $this->mNewtext );
457459 }
458 -
 460+
459461 if( is_object( $this->mNewRev ) && !$this->mNewRev->isCurrent() ) {
460462 $wgOut->parserOptions()->setEditSection( $oldEditSectionSetting );
461463 }
 464+
462465 # Add redundant patrol link on bottom...
463466 if( $this->mRcidMarkPatrolled && $this->mTitle->quickUserCan('patrol') ) {
464467 $sk = $wgUser->getSkin();
Property changes on: branches/wmf/1.16wmf4/includes/diff/DifferenceInterface.php
___________________________________________________________________
Modified: svn:mergeinfo
465468 Merged /trunk/phase3/includes/diff/DifferenceInterface.php:r75332,75481,75838
Property changes on: branches/wmf/1.16wmf4
___________________________________________________________________
Modified: svn:mergeinfo
466469 Merged /trunk/phase3:r75332,75481

Follow-up revisions

RevisionCommit summaryAuthorDate
r76459Push r76444 merge to my testing branchdemon18:30, 10 November 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75332bug25289 Hook that optionally adds custom content instead of article content ...pdhanda18:57, 24 October 2010
r75481Address my own CR in r75332.platonides22:34, 26 October 2010

Status & tagging log