From 1dcd516ed615677aa69338504644c33a5d7605dd Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Wed, 14 Apr 2010 13:53:20 +0000 Subject: [PATCH] (bug 23176) Fixed regression: "upload new version" link should not trigger a file-exists warning Also fixed a mislabeled form field. --- includes/specials/SpecialUpload.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index cf3c1f9971..d5946f303e 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -313,11 +313,13 @@ class SpecialUpload extends SpecialPage { * warnings and the should continue processing like there was no warning */ protected function showUploadWarning( $warnings ) { - # If there are no warnings, or warnings we can ignore, return early - if ( - !$warnings || ( count( $warnings ) == 1 && - isset( $warnings['exists']) && $this->mDestWarningAck ) - ) + # If there are no warnings, or warnings we can ignore, return early. + # mDestWarningAck is set when some javascript has shown the warning + # to the user. mForReUpload is set when the user clicks the "upload a + # new version" link. + if ( !$warnings || ( count( $warnings ) == 1 && + isset( $warnings['exists'] ) && + ( $this->mDestWarningAck || $this->mForReUpload ) ) ) { return false; } @@ -936,7 +938,7 @@ class UploadForm extends HTMLForm { protected function getOptionsSection() { global $wgUser; - if( $wgUser->isLoggedIn() ) { + if ( $wgUser->isLoggedIn() ) { $descriptor = array( 'Watchthis' => array( 'type' => 'check', @@ -947,7 +949,7 @@ class UploadForm extends HTMLForm { ) ); } - if( !$this->mHideIgnoreWarning ) { + if ( !$this->mHideIgnoreWarning ) { $descriptor['IgnoreWarning'] = array( 'type' => 'check', 'id' => 'wpIgnoreWarning', @@ -956,11 +958,19 @@ class UploadForm extends HTMLForm { ); } - $descriptor['wpDestFileWarningAck'] = array( + $descriptor['DestFileWarningAck'] = array( 'type' => 'hidden', 'id' => 'wpDestFileWarningAck', 'default' => $this->mDestWarningAck ? '1' : '', ); + + if ( $this->mForReUpload ) { + $descriptor['ForReUpload'] = array( + 'type' => 'hidden', + 'id' => 'wpForReUpload', + 'default' => '1', + ); + } return $descriptor; } -- 2.20.1