Merge "Rename getCopyWarn() to getCopyrightWarning() and make it public and static"
[lhc/web/wiklou.git] / includes / WikiPage.php
index 0ba517a..76a9828 100644 (file)
@@ -1445,7 +1445,7 @@ class WikiPage extends Page {
         *  Compatibility note: this function previously returned a boolean value indicating success/failure
         */
        public function doEdit( $text, $summary, $flags = 0, $baseRevId = false, $user = null ) {
-               global $wgUser, $wgDBtransactions, $wgUseAutomaticEditSummaries;
+               global $wgUser, $wgUseAutomaticEditSummaries;
 
                # Low-level sanity check
                if ( $this->mTitle->getText() === '' ) {
@@ -1513,11 +1513,6 @@ class WikiPage extends Page {
                                return $status;
                        }
 
-                       # Make sure the revision is either completely inserted or not inserted at all
-                       if ( !$wgDBtransactions ) {
-                               $userAbort = ignore_user_abort( true );
-                       }
-
                        $revision = new Revision( array(
                                'page'       => $this->getId(),
                                'comment'    => $summary,
@@ -1528,6 +1523,9 @@ class WikiPage extends Page {
                                'user_text'  => $user->getName(),
                                'timestamp'  => $now
                        ) );
+                       # Bug 37225: use accessor to get the text as Revision may trim it.
+                       # After trimming, the text may be a duplicate of the current text.
+                       $text = $revision->getText(); // sanity; EditPage should trim already
 
                        $changed = ( strcmp( $text, $oldtext ) != 0 );
 
@@ -1548,11 +1546,6 @@ class WikiPage extends Page {
                                        /* Belated edit conflict! Run away!! */
                                        $status->fatal( 'edit-conflict' );
 
-                                       # Delete the invalid revision if the DB is not transactional
-                                       if ( !$wgDBtransactions ) {
-                                               $dbw->delete( 'revision', array( 'rev_id' => $revisionId ), __METHOD__ );
-                                       }
-
                                        $revisionId = 0;
                                        $dbw->rollback( __METHOD__ );
                                } else {
@@ -1583,10 +1576,6 @@ class WikiPage extends Page {
                                $revision->setId( $this->getLatest() );
                        }
 
-                       if ( !$wgDBtransactions ) {
-                               ignore_user_abort( $userAbort );
-                       }
-
                        // Now that ignore_user_abort is restored, we can respond to fatal errors
                        if ( !$status->isOK() ) {
                                wfProfileOut( __METHOD__ );
@@ -1634,6 +1623,9 @@ class WikiPage extends Page {
                        ) );
                        $revisionId = $revision->insertOn( $dbw );
 
+                       # Bug 37225: use accessor to get the text as Revision may trim it
+                       $text = $revision->getText(); // sanity; EditPage should trim already
+
                        # Update the page record with revision data
                        $this->updateRevisionOn( $dbw, $revision, 0 );
 
@@ -2967,7 +2959,7 @@ class WikiPage extends Page {
        public function quickEdit( $text, $comment = '', $minor = 0 ) {
                wfDeprecated( __METHOD__, '1.18' );
                global $wgUser;
-               return $this->doQuickEdit( $text, $wgUser, $comment, $minor );
+               $this->doQuickEdit( $text, $wgUser, $comment, $minor );
        }
 
        /**