r84761 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84760‎ | r84761 | r84762 >
Date:20:37, 25 March 2011
Author:neilk
Status:ok
Tags:
Comment:
change the name of UploadBase::verifyPermissions() to verifyTitlePermissions() for clarity. A wrapper function is left for extensions that rely on the old method
Modified paths:
  • /trunk/phase3/includes/api/ApiUpload.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUpload.php (modified) (history)
  • /trunk/phase3/includes/upload/UploadBase.php (modified) (history)
  • /trunk/phase3/includes/upload/UploadFromUrl.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/upload/UploadFromUrl.php
@@ -171,11 +171,11 @@
172172 * Wrapper around the parent function in order to defer checking protection
173173 * until we are sure that the file can actually be uploaded
174174 */
175 - public function verifyPermissions( $user ) {
 175+ public function verifyTitlePermissions( $user ) {
176176 if ( $this->mAsync ) {
177177 return true;
178178 }
179 - return parent::verifyPermissions( $user );
 179+ return parent::verifyTitlePermissions( $user );
180180 }
181181
182182 /**
Index: trunk/phase3/includes/upload/UploadBase.php
@@ -27,7 +27,7 @@
2828 const EMPTY_FILE = 3;
2929 const MIN_LENGTH_PARTNAME = 4;
3030 const ILLEGAL_FILENAME = 5;
31 - const OVERWRITE_EXISTING_FILE = 7; # Not used anymore; handled by verifyPermissions()
 31+ const OVERWRITE_EXISTING_FILE = 7; # Not used anymore; handled by verifyTitlePermissions()
3232 const FILETYPE_MISSING = 8;
3333 const FILETYPE_BADTYPE = 9;
3434 const VERIFICATION_ERROR = 10;
@@ -439,6 +439,17 @@
440440 }
441441
442442 /**
 443+ * Alias for verifyTitlePermissions. The function was originally 'verifyPermissions'
 444+ * but that suggests it's checking the user, when it's really checking the title + user combination.
 445+ * @param $user User object to verify the permissions against
 446+ * @return mixed An array as returned by getUserPermissionsErrors or true
 447+ * in case the user has proper permissions.
 448+ */
 449+ public function verifyPermissions( $user ) {
 450+ return $this->verifyTitlePermissions( $user );
 451+ }
 452+
 453+ /**
443454 * Check whether the user can edit, upload and create the image. This
444455 * checks only against the current title; if it returns errors, it may
445456 * very well be that another title will not give errors. Therefore
@@ -449,7 +460,7 @@
450461 * @return mixed An array as returned by getUserPermissionsErrors or true
451462 * in case the user has proper permissions.
452463 */
453 - public function verifyPermissions( $user ) {
 464+ public function verifyTitlePermissions( $user ) {
454465 /**
455466 * If the image is protected, non-sysop users won't be able
456467 * to modify it by uploading a new revision.
Index: trunk/phase3/includes/api/ApiUpload.php
@@ -83,7 +83,7 @@
8484 $this->verifyUpload();
8585
8686 // Check permission to upload this file
87 - $permErrors = $this->mUpload->verifyPermissions( $wgUser );
 87+ $permErrors = $this->mUpload->verifyTitlePermissions( $wgUser );
8888 if ( $permErrors !== true ) {
8989 // TODO: stash the upload and allow choosing a new name
9090 $this->dieUsageMsg( array( 'badaccess-groups' ) );
Index: trunk/phase3/includes/specials/SpecialUpload.php
@@ -452,7 +452,7 @@
453453 }
454454
455455 // Verify permissions for this title
456 - $permErrors = $this->mUpload->verifyPermissions( $wgUser );
 456+ $permErrors = $this->mUpload->verifyTitlePermissions( $wgUser );
457457 if( $permErrors !== true ) {
458458 $code = array_shift( $permErrors[0] );
459459 $this->showRecoverableUploadError( wfMsgExt( $code,

Sign-offs

UserFlagDate
Bryaninspected20:39, 25 March 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r850001.17wmf1: MFT changes for UploadWizard deployment: r78426, r81393, r81401, r8...catrope08:20, 30 March 2011

Status & tagging log