(bug 23176) Fixed regression: "upload new version" link should not trigger a file...
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Wed, 14 Apr 2010 13:53:20 +0000 (13:53 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Wed, 14 Apr 2010 13:53:20 +0000 (13:53 +0000)
Also fixed a mislabeled form field.

includes/specials/SpecialUpload.php

index cf3c1f9..d5946f3 100644 (file)
@@ -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;
        }