From 301153d47c626515c4b8b41c37a8da0a3a033474 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Mon, 14 Mar 2011 23:33:45 +0000 Subject: [PATCH] * (bug 28034) uploading file to local wiki when file exists on shared repository (commons) gives spurious info in the warning message Applying patch with one minor addition --- RELEASE-NOTES | 4 +++- includes/specials/SpecialUpload.php | 4 ++-- includes/upload/UploadBase.php | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6540d16d52..1f396df1a6 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index bb6a0202ee..9a8f0e2269 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -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; } diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index ccb67a4b7d..adc1ff2b1d 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -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; -- 2.20.1