Index: trunk/phase3/includes/upload/UploadBase.php |
— | — | @@ -915,14 +915,18 @@ |
916 | 916 | global $wgUser; |
917 | 917 | // First check whether the local file can be overwritten |
918 | 918 | $file = $this->getLocalFile(); |
919 | | - if( $file->exists() ) |
| 919 | + if( $file->exists() ) { |
920 | 920 | if( !self::userCanReUpload( $wgUser, $file ) ) |
921 | 921 | return 'fileexists-forbidden'; |
| 922 | + else |
| 923 | + return true; |
| 924 | + } |
922 | 925 | |
923 | | - // Check shared conflicts |
924 | | - $file = wfFindFile( $file->getName() ); |
925 | | - if ( $file && ( !$wgUser->isAllowed( 'reupload' ) || |
926 | | - !$wgUser->isAllowed( 'reupload-shared' ) ) ) |
| 926 | + /* Check shared conflicts: if the local file does not exist, but |
| 927 | + * wfFindFile finds a file, it exists in a shared repository. |
| 928 | + */ |
| 929 | + $file = wfFindFile( $this->getTitle() ); |
| 930 | + if ( $file && !$wgUser->isAllowed( 'reupload-shared' ) ) |
927 | 931 | return 'fileexists-shared-forbidden'; |
928 | 932 | |
929 | 933 | return true; |