* Do the page existence check before calling ignore_user_abort() so that we don't...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 26 Jan 2012 16:44:29 +0000 (16:44 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 26 Jan 2012 16:44:29 +0000 (16:44 +0000)
* Change the check to use $oldid since we already have the result of getLatest()

includes/WikiPage.php

index 8d5d606..57fb7d5 100644 (file)
@@ -1275,6 +1275,15 @@ class WikiPage extends Page {
                        # Update article, but only if changed.
                        $status->value['new'] = false;
 
+                       if ( !$oldid ) {
+                               # Article gone missing
+                               wfDebug( __METHOD__ . ": EDIT_UPDATE specified but article doesn't exist\n" );
+                               $status->fatal( 'edit-gone-missing' );
+
+                               wfProfileOut( __METHOD__ );
+                               return $status;
+                       }
+
                        # Make sure the revision is either completely inserted or not inserted at all
                        if ( !$wgDBtransactions ) {
                                $userAbort = ignore_user_abort( true );
@@ -1294,15 +1303,6 @@ class WikiPage extends Page {
                        $changed = ( strcmp( $text, $oldtext ) != 0 );
 
                        if ( $changed ) {
-                               if ( !$this->mLatest ) {
-                                       # Article gone missing
-                                       wfDebug( __METHOD__ . ": EDIT_UPDATE specified but article doesn't exist\n" );
-                                       $status->fatal( 'edit-gone-missing' );
-
-                                       wfProfileOut( __METHOD__ );
-                                       return $status;
-                               }
-
                                $dbw->begin();
                                $revisionId = $revision->insertOn( $dbw );