r78212 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78211‎ | r78212 | r78213 >
Date:22:47, 10 December 2010
Author:pdhanda
Status:resolved (Comments)
Tags:
Comment:
If we only want to show the diff this should make it faster. Sort of related to to bug 25757
Modified paths:
  • /trunk/phase3/includes/diff/DifferenceEngine.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/diff/DifferenceEngine.php
@@ -427,6 +427,10 @@
428428 wfProfileIn( __METHOD__ );
429429
430430 $wgOut->addHTML( "<hr /><h2>{$this->mPagetitle}</h2>\n" );
 431+ if ( !wfRunHooks( 'ArticleContentOnDiff', array( $this, $wgOut ) ) ) {
 432+ return;
 433+ }
 434+
431435 # Add deleted rev tag if needed
432436 if ( !$this->mNewRev->userCan( Revision::DELETED_TEXT ) ) {
433437 $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-permission' );
@@ -456,19 +460,17 @@
457461 $wgOut->addHTML( htmlspecialchars( $this->mNewtext ) );
458462 $wgOut->addHTML( "\n</pre>\n" );
459463 }
460 - } elseif ( wfRunHooks( 'ArticleContentOnDiff', array( $this, $wgOut ) ) ) {
461 - if ( $pCache ) {
462 - $article = new Article( $this->mTitle, 0 );
463 - $pOutput = ParserCache::singleton()->get( $article, $wgOut->parserOptions() );
464 - if ( $pOutput ) {
465 - $wgOut->addParserOutput( $pOutput );
466 - } else {
467 - $article->doViewParse();
468 - }
 464+ } elseif ( $pCache ) {
 465+ $article = new Article( $this->mTitle, 0 );
 466+ $pOutput = ParserCache::singleton()->get( $article, $wgOut->parserOptions() );
 467+ if( $pOutput ) {
 468+ $wgOut->addParserOutput( $pOutput );
469469 } else {
470 - $wgOut->addWikiTextTidy( $this->mNewtext );
471 - }
472 - }
 470+ $article->doViewParse();
 471+ }
 472+ } else {
 473+ $wgOut->addWikiTextTidy( $this->mNewtext );
 474+ }
473475
474476 if ( is_object( $this->mNewRev ) && !$this->mNewRev->isCurrent() ) {
475477 $wgOut->parserOptions()->setEditSection( $oldEditSectionSetting );

Follow-up revisions

RevisionCommit summaryAuthorDate
r78213After r78212, it is safer to get the revision id from the DifferenceEngine ob...pdhanda23:00, 10 December 2010
r78215Merged r78212 from trunkpdhanda23:37, 10 December 2010

Comments

#Comment by Aaron Schulz (talk | contribs)   04:51, 11 December 2010

Avoiding $this->loadNewText() looks like a good idea here.

This started before this commit, but the "redundant patrol link" code path is never hit. I'm looking at this now.

#Comment by Aaron Schulz (talk | contribs)   05:10, 11 December 2010

The rev-deleted messages (added via wrapWikiMsg()) are also omitted by FlaggedRevs.

#Comment by Aaron Schulz (talk | contribs)   05:19, 11 December 2010

There is still the top revdelete message, so many the content one was redundant anyway. I'll probably remove it from core then.

#Comment by Aaron Schulz (talk | contribs)   05:33, 11 December 2010

Above dealt with in r78219.

Status & tagging log