r113803 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113802‎ | r113803 | r113804 >
Date:09:52, 14 March 2012
Author:ialex
Status:reverted (Comments)
Tags:
Comment:
Don't create new Revision and Title object if we can use the ones that we already have
Modified paths:
  • /trunk/phase3/includes/diff/DifferenceEngine.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/diff/DifferenceEngine.php
@@ -1003,17 +1003,23 @@
10041004 $this->loadRevisionIds();
10051005
10061006 // Load the new revision object
1007 - $this->mNewRev = $this->mNewid
1008 - ? Revision::newFromId( $this->mNewid )
1009 - : Revision::newFromTitle( $this->getTitle() );
 1007+ if ( $this->mNewid && ( !$this->canUseWikiPage()
 1008+ || $this->mNewid !== $this->getWikiPage()->getLatest() ) )
 1009+ {
 1010+ $this->mNewRev = Revision::newFromId( $this->mNewid );
 1011+ } else {
 1012+ $this->mNewRev = $this->getWikiPage()->getRevision();
 1013+ $this->mNewPage = $this->getTitle();
 1014+ }
10101015
10111016 if ( !$this->mNewRev instanceof Revision ) {
10121017 return false;
10131018 }
1014 -
 1019+ if ( !$this->mNewPage instanceof Title ) {
 1020+ $this->mNewPage = $this->mNewRev->getTitle();
 1021+ }
10151022 // Update the new revision ID in case it was 0 (makes life easier doing UI stuff)
10161023 $this->mNewid = $this->mNewRev->getId();
1017 - $this->mNewPage = $this->mNewRev->getTitle();
10181024
10191025 // Load the old revision object
10201026 $this->mOldRev = false;

Follow-up revisions

RevisionCommit summaryAuthorDate
r113825Reverted r113803: makes already messy class messier (a bit to much)aaron17:55, 14 March 2012

Comments

#Comment by IAlex (talk | contribs)   20:05, 14 March 2012

I'm sorry but I don't see what is messy here.

Status & tagging log