Index: trunk/phase3/includes/upload/UploadFromUrl.php |
— | — | @@ -171,11 +171,11 @@ |
172 | 172 | * Wrapper around the parent function in order to defer checking protection |
173 | 173 | * until we are sure that the file can actually be uploaded |
174 | 174 | */ |
175 | | - public function verifyPermissions( $user ) { |
| 175 | + public function verifyTitlePermissions( $user ) { |
176 | 176 | if ( $this->mAsync ) { |
177 | 177 | return true; |
178 | 178 | } |
179 | | - return parent::verifyPermissions( $user ); |
| 179 | + return parent::verifyTitlePermissions( $user ); |
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
Index: trunk/phase3/includes/upload/UploadBase.php |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | const EMPTY_FILE = 3; |
29 | 29 | const MIN_LENGTH_PARTNAME = 4; |
30 | 30 | 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() |
32 | 32 | const FILETYPE_MISSING = 8; |
33 | 33 | const FILETYPE_BADTYPE = 9; |
34 | 34 | const VERIFICATION_ERROR = 10; |
— | — | @@ -439,6 +439,17 @@ |
440 | 440 | } |
441 | 441 | |
442 | 442 | /** |
| 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 | + /** |
443 | 454 | * Check whether the user can edit, upload and create the image. This |
444 | 455 | * checks only against the current title; if it returns errors, it may |
445 | 456 | * very well be that another title will not give errors. Therefore |
— | — | @@ -449,7 +460,7 @@ |
450 | 461 | * @return mixed An array as returned by getUserPermissionsErrors or true |
451 | 462 | * in case the user has proper permissions. |
452 | 463 | */ |
453 | | - public function verifyPermissions( $user ) { |
| 464 | + public function verifyTitlePermissions( $user ) { |
454 | 465 | /** |
455 | 466 | * If the image is protected, non-sysop users won't be able |
456 | 467 | * to modify it by uploading a new revision. |
Index: trunk/phase3/includes/api/ApiUpload.php |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | $this->verifyUpload(); |
85 | 85 | |
86 | 86 | // Check permission to upload this file |
87 | | - $permErrors = $this->mUpload->verifyPermissions( $wgUser ); |
| 87 | + $permErrors = $this->mUpload->verifyTitlePermissions( $wgUser ); |
88 | 88 | if ( $permErrors !== true ) { |
89 | 89 | // TODO: stash the upload and allow choosing a new name |
90 | 90 | $this->dieUsageMsg( array( 'badaccess-groups' ) ); |
Index: trunk/phase3/includes/specials/SpecialUpload.php |
— | — | @@ -452,7 +452,7 @@ |
453 | 453 | } |
454 | 454 | |
455 | 455 | // Verify permissions for this title |
456 | | - $permErrors = $this->mUpload->verifyPermissions( $wgUser ); |
| 456 | + $permErrors = $this->mUpload->verifyTitlePermissions( $wgUser ); |
457 | 457 | if( $permErrors !== true ) { |
458 | 458 | $code = array_shift( $permErrors[0] ); |
459 | 459 | $this->showRecoverableUploadError( wfMsgExt( $code, |