From 73085da1b1af9f0d2f9664b2f793755c6e1144c3 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 6 Aug 2011 20:39:15 +0000 Subject: [PATCH] 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 --- includes/EditPage.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 9563701a3e..a14871e21d 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1028,15 +1028,12 @@ class EditPage { $this->isConflict = false; wfDebug( __METHOD__ .": conflict suppressed; new section\n" ); } + } elseif ( $this->section == '' && $this->userWasLastToEdit( $wgUser->getId(), $this->edittime ) ) { + # Suppress edit conflict with self, except for section edits where merging is required. + wfDebug( __METHOD__ . ": Suppressing edit conflict, same user.\n" ); + $this->isConflict = false; } } - $userid = $wgUser->getId(); - - # Suppress edit conflict with self, except for section edits where merging is required. - if ( $this->isConflict && $this->section == '' && $this->userWasLastToEdit( $userid, $this->edittime ) ) { - wfDebug( __METHOD__ . ": Suppressing edit conflict, same user.\n" ); - $this->isConflict = false; - } if ( $this->isConflict ) { wfDebug( __METHOD__ . ": conflict! getting section '$this->section' for time '$this->edittime' (article time '" . @@ -1068,8 +1065,6 @@ class EditPage { return self::AS_CONFLICT_DETECTED; } - $oldtext = $this->mArticle->getContent(); - // Run post-section-merge edit filter if ( !wfRunHooks( 'EditFilterMerged', array( $this, $text, &$this->hookError, $this->summary ) ) ) { # Error messages etc. could be handled within the hook... @@ -1082,7 +1077,8 @@ class EditPage { } # Handle the user preference to force summaries here, but not for null edits - if ( $this->section != 'new' && !$this->allowBlankSummary && 0 != strcmp( $oldtext, $text ) + if ( $this->section != 'new' && !$this->allowBlankSummary + && 0 != strcmp( $this->mArticle->getContent(), $text ) && !Title::newFromRedirect( $text ) ) # check if it's not a redirect { if ( md5( $this->summary ) == $this->autoSumm ) { -- 2.20.1