r94033 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94032‎ | r94033 | r94034 >
Date:20:39, 6 August 2011
Author:ialex
Status:ok
Tags:
Comment:
Made code more readable by moving the check about user being last editor when an edit conflicts occurs near related checks; also removed some variables that were used only once
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -1028,16 +1028,13 @@
10291029 $this->isConflict = false;
10301030 wfDebug( __METHOD__ .": conflict suppressed; new section\n" );
10311031 }
 1032+ } elseif ( $this->section == '' && $this->userWasLastToEdit( $wgUser->getId(), $this->edittime ) ) {
 1033+ # Suppress edit conflict with self, except for section edits where merging is required.
 1034+ wfDebug( __METHOD__ . ": Suppressing edit conflict, same user.\n" );
 1035+ $this->isConflict = false;
10321036 }
10331037 }
1034 - $userid = $wgUser->getId();
10351038
1036 - # Suppress edit conflict with self, except for section edits where merging is required.
1037 - if ( $this->isConflict && $this->section == '' && $this->userWasLastToEdit( $userid, $this->edittime ) ) {
1038 - wfDebug( __METHOD__ . ": Suppressing edit conflict, same user.\n" );
1039 - $this->isConflict = false;
1040 - }
1041 -
10421039 if ( $this->isConflict ) {
10431040 wfDebug( __METHOD__ . ": conflict! getting section '$this->section' for time '$this->edittime' (article time '" .
10441041 $this->mArticle->getTimestamp() . "')\n" );
@@ -1068,8 +1065,6 @@
10691066 return self::AS_CONFLICT_DETECTED;
10701067 }
10711068
1072 - $oldtext = $this->mArticle->getContent();
1073 -
10741069 // Run post-section-merge edit filter
10751070 if ( !wfRunHooks( 'EditFilterMerged', array( $this, $text, &$this->hookError, $this->summary ) ) ) {
10761071 # Error messages etc. could be handled within the hook...
@@ -1082,7 +1077,8 @@
10831078 }
10841079
10851080 # Handle the user preference to force summaries here, but not for null edits
1086 - if ( $this->section != 'new' && !$this->allowBlankSummary && 0 != strcmp( $oldtext, $text )
 1081+ if ( $this->section != 'new' && !$this->allowBlankSummary
 1082+ && 0 != strcmp( $this->mArticle->getContent(), $text )
10871083 && !Title::newFromRedirect( $text ) ) # check if it's not a redirect
10881084 {
10891085 if ( md5( $this->summary ) == $this->autoSumm ) {

Status & tagging log