From: Brion Vibber Date: Thu, 21 Jul 2005 15:10:22 +0000 (+0000) Subject: * (bug 275) Section duplication fix X-Git-Tag: 1.5.0beta4~83 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=2962b7f6ed53e3793c912428f3468fdf6719c16f;p=lhc%2Fweb%2Fwiklou.git * (bug 275) Section duplication fix Clear the section and prepare merged-section full text for the edit form before save, so that late conflicts don't create a bogus form. Problems were: - duplication of entire page into the section on final save - conflict form showed bogus diff DF's analysis of the bug: http://bugzilla.wikimedia.org/show_bug.cgi?id=275#c11 --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 93cbf8e5c3..7c1903af73 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -586,6 +586,8 @@ of MediaWiki:Newpagetext) to &action=edit, if page is new. * Fix spelling of $wgForwardSearchUrl in DefaultSettings.php * Specify USE INDEX on Allpages chunk queries, sometimes gets lost due to bogus optimization +* (bug 275) Section duplication fix + === Caveats === diff --git a/includes/EditPage.php b/includes/EditPage.php index c1ffe7554a..9d5911fde9 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -458,21 +458,28 @@ class EditPage { } } + // Save errors may fall down to the edit form, but we've now + // merged the section into full text. Clear the section field + // so that later submission of conflict forms won't try to + // replace that into a duplicated mess. + $this->textbox1 = $text; + $this->section = ''; + if (wfRunHooks('ArticleSave', array(&$this->mArticle, &$wgUser, &$text, &$this->summary, &$this->minoredit, &$this->watchthis, &$sectionanchor))) { # update the article here - if($this->mArticle->updateArticle( $text, $this->summary, $this->minoredit, + if( false && $this->mArticle->updateArticle( $text, $this->summary, $this->minoredit, $this->watchthis, '', $sectionanchor )) { wfRunHooks('ArticleSaveComplete', array(&$this->mArticle, &$wgUser, $text, $this->summary, $this->minoredit, $this->watchthis, $sectionanchor)); return; + } else { + $isConflict = true; } - else - $isConflict = true; } } }