From 3d825909fbc29677f6198c4a96f4f69958fcc46b Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 11 Dec 2005 12:07:18 +0000 Subject: [PATCH] * (bug 1600) Trigger edit conflict on duplicate section=new submissions --- RELEASE-NOTES | 1 + includes/EditPage.php | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3ee232a576..baf14d0f02 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -309,6 +309,7 @@ fully support the editing toolbar, but was found to be too confusing. * Use content-lang for sitenotice * (bug 4233) Update LanguageJa.php * Fix regression: old version missing from edit links in Nostalgia skin +* (bug 1600) Trigger edit conflict on duplicate section=new submissions === Caveats === diff --git a/includes/EditPage.php b/includes/EditPage.php index 553c540d39..c44f6aa7e6 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -546,11 +546,22 @@ class EditPage { $this->mArticle->clear(); # Force reload of dates, etc. $this->mArticle->forUpdate( true ); # Lock the article - - if( ( $this->section != 'new' ) && - ($this->mArticle->getTimestamp() != $this->edittime ) ) - { + + if( $this->mArticle->getTimestamp() != $this->edittime ) { $this->isConflict = true; + if( $this->section = 'new' ) { + if( $this->mArticle->getUserText() == $wgUser->getName() && + $this->mArticle->getComment() == $this->summary ) { + // Probably a duplicate submission of a new comment. + // This can happen when squid resends a request after + // a timeout but the first one actually went through. + wfDebug( "EditPage::editForm duplicate new section submission; trigger edit conflict!\n" ); + } else { + // New comment; suppress conflict. + $this->isConflict = false; + wfDebug( "EditPage::editForm conflict suppressed; new section\n" ); + } + } } $userid = $wgUser->getID(); -- 2.20.1