* (bug 275) Section duplication fix
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 21 Jul 2005 15:10:22 +0000 (15:10 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 21 Jul 2005 15:10:22 +0000 (15:10 +0000)
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

RELEASE-NOTES
includes/EditPage.php

index 93cbf8e..7c1903a 100644 (file)
@@ -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 ===
 
index c1ffe75..9d5911f 100644 (file)
@@ -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;
                                }
                        }
                }