(Bug 41352) Proper fix for vanishing content.
authordaniel <daniel.kinzler@wikimedia.de>
Thu, 25 Oct 2012 16:59:56 +0000 (18:59 +0200)
committerdaniel <daniel.kinzler@wikimedia.de>
Thu, 8 Nov 2012 18:09:33 +0000 (19:09 +0100)
This reverts the temporary fix in I4c2055be and instead fixes the
resolution of merge conflicts using Contenthandler::merge3.

Change-Id: I0b1db6d76c0678d0ce795720e513e16e28e907d4

includes/EditPage.php

index 963b4af..21a100f 100644 (file)
@@ -1473,16 +1473,14 @@ class EditPage {
                                $this->isConflict = true;
                                $content = $textbox_content; // do not try to merge here!
                        } elseif ( $this->isConflict ) {
-                               $contentObj = $content;
                                # Attempt merge
-                               if ( $this->mergeChangesInto( $content ) ) {
+                               if ( $this->mergeChangesIntoContent( $content ) ) {
                                        // Successful merge! Maybe we should tell the user the good news?
                                        $this->isConflict = false;
-                                       $content = $this->toEditContent( $content );
                                        wfDebug( __METHOD__ . ": Suppressing edit conflict, successful merge.\n" );
                                } else {
                                        $this->section = '';
-                                       $this->textbox1 = ContentHandler::getContentText( $contentObj );
+                                       $this->textbox1 = ContentHandler::getContentText( $content );
                                        wfDebug( __METHOD__ . ": Keeping edit conflict, failed merge.\n" );
                                }
                        }
@@ -1666,37 +1664,15 @@ class EditPage {
        function mergeChangesInto( &$editText ){
                ContentHandler::deprecated( __METHOD__, "1.21" );
 
-               wfProfileIn( __METHOD__ );
-
-               $db = wfGetDB( DB_MASTER );
-
-               // This is the revision the editor started from
-               $baseRevision = $this->getBaseRevision();
-               if ( is_null( $baseRevision ) ) {
-                       wfProfileOut( __METHOD__ );
-                       return false;
-               }
-               $baseText = $baseRevision->getText();
-
-               // The current state, we want to merge updates into it
-               $currentRevision = Revision::loadFromTitle( $db, $this->mTitle );
-               if ( is_null( $currentRevision ) ) {
-                       wfProfileOut( __METHOD__ );
-                       return false;
-               }
-               $currentText = $currentRevision->getText();
+               $editContent = $this->toEditContent( $editText );
 
-               $result = '';
-               $editText = $this->toEditText( $editText );
+               $ok = $this->mergeChangesIntoContent( $editContent );
 
-               if ( wfMerge( $baseText, $editText, $currentText, $result ) ) {
-                       $editText = $result;
-                       wfProfileOut( __METHOD__ );
+               if ( $ok ) {
+                       $editText = $this->toEditText( $editContent );
                        return true;
-               } else {
-                       wfProfileOut( __METHOD__ );
-                       return false;
                }
+               return false;
        }
 
        /**