* (bug 28034) uploading file to local wiki when file exists on shared repository...
authorSam Reed <reedy@users.mediawiki.org>
Mon, 14 Mar 2011 23:33:45 +0000 (23:33 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Mon, 14 Mar 2011 23:33:45 +0000 (23:33 +0000)
Applying patch with one minor addition

RELEASE-NOTES
includes/specials/SpecialUpload.php
includes/upload/UploadBase.php

index 6540d16..1f396df 100644 (file)
@@ -191,7 +191,9 @@ PHP if you have not done so prior to upgrading MediaWiki.
 * Do not show enotifminoredits preference, if disabled by $wgEnotifMinorEdits.
 * AbortLogin returning "ABORTED" now handled.  Also allows message identifier
   for "ABORTED" reason to be returned and displayed to user.
-
+* (bug 28034) uploading file to local wiki when file exists on shared repository
+  (commons) gives spurious info in the warning message
+  
 === API changes in 1.18 ===
 * (bug 26339) Throw warning when truncating an overlarge API result
 * (bug 14869) Add API module for accessing QueryPage-based special pages
index bb6a020..9a8f0e2 100644 (file)
@@ -455,8 +455,8 @@ class SpecialUpload extends SpecialPage {
                $permErrors = $this->mUpload->verifyPermissions( $wgUser );
                if( $permErrors !== true ) {
                        $code = array_shift( $permErrors[0] );
-                       $this->showRecoverableUploadError( wfMsgExt( $code,
-                                       'parseinline', $permErrors[0] ) );
+                       $this->showRecoverableUploadError( wfMsgExt( $code[0],
+                                       'parseinline', $code[1] ) );
                        return;
                }
 
index ccb67a4..adc1ff2 100644 (file)
@@ -473,7 +473,7 @@ abstract class UploadBase {
 
                $overwriteError = $this->checkOverwrite( $user );
                if ( $overwriteError !== true ) {
-                       return array( array( $overwriteError ) );
+                       return array( $overwriteError );
                }
 
                return true;
@@ -1101,14 +1101,14 @@ abstract class UploadBase {
         *
         * @param $user User
         *
-        * @return mixed true on success, error string on failure
+        * @return mixed true on success, array on failure
         */
        private function checkOverwrite( $user ) {
                // First check whether the local file can be overwritten
                $file = $this->getLocalFile();
                if( $file->exists() ) {
                        if( !self::userCanReUpload( $user, $file ) ) {
-                               return 'fileexists-forbidden';
+                               return array( 'fileexists-forbidden', $file->getName() );
                        } else {
                                return true;
                        }
@@ -1119,7 +1119,7 @@ abstract class UploadBase {
                 */
                $file = wfFindFile( $this->getTitle() );
                if ( $file && !$user->isAllowed( 'reupload-shared' ) ) {
-                       return 'fileexists-shared-forbidden';
+                       return array( 'fileexists-shared-forbidden', $file->getName() );
                }
 
                return true;