From 16ec2100de156f4b97a27d2903be6522007034a8 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 26 Jan 2012 16:44:29 +0000 Subject: [PATCH] * Do the page existence check before calling ignore_user_abort() so that we don't return after having modified that value * Change the check to use $oldid since we already have the result of getLatest() --- includes/WikiPage.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 8d5d60646d..57fb7d5d5d 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -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 ); -- 2.20.1