r56631 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56630‎ | r56631 | r56632 >
Date:09:01, 19 September 2009
Author:btongminh
Status:ok (Comments)
Tags:
Comment:
Fix overwrite permission checking for users without reupload-shared right.
Modified paths:
  • /trunk/phase3/includes/upload/UploadBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/upload/UploadBase.php
@@ -915,14 +915,18 @@
916916 global $wgUser;
917917 // First check whether the local file can be overwritten
918918 $file = $this->getLocalFile();
919 - if( $file->exists() )
 919+ if( $file->exists() ) {
920920 if( !self::userCanReUpload( $wgUser, $file ) )
921921 return 'fileexists-forbidden';
 922+ else
 923+ return true;
 924+ }
922925
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' ) )
927931 return 'fileexists-shared-forbidden';
928932
929933 return true;

Follow-up revisions

RevisionCommit summaryAuthorDate
r56734Merge r56631, fix for bug 20677....werdna21:01, 21 September 2009

Comments

#Comment by Platonides (talk | contribs)   19:24, 20 September 2009

Note that fileexists-forbidden and fileexists-shared-forbidden messages take a $1 parameter with the file name, which isn't currently provided.

#Comment by Bryan (talk | contribs)   19:49, 20 September 2009

Was fixed in r56639.

#Comment by Platonides (talk | contribs)   20:34, 20 September 2009

Great.

#Comment by Catrope (talk | contribs)   10:18, 21 September 2009

Note that this fixes bug 20677 , where commenters are screaming for this rev to be pushed live.

Status & tagging log