X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUpload.php;h=e7c2e42a77da8756de421d2253fc978469f7c49b;hp=5a1b8fbf6d3f000eb3dc8ee8c246ede9a22f745c;hb=7b4eafda0d986180d20f37f2489b70e8eca00df4;hpb=9fc202b69496353a1142a692be5aaf158e9ea30c diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 5a1b8fbf6d..e7c2e42a77 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -43,7 +43,7 @@ class SpecialUpload extends SpecialPage { return true; } - /** Misc variables **/ + /** Misc variables */ /** @var WebRequest|FauxRequest The request this form is supposed to handle */ public $mRequest; @@ -56,21 +56,21 @@ class SpecialUpload extends SpecialPage { public $mLocalFile; public $mUploadClicked; - /** User input variables from the "description" section **/ + /** User input variables from the "description" section */ /** @var string The requested target file name */ public $mDesiredDestName; public $mComment; public $mLicense; - /** User input variables from the root section **/ + /** User input variables from the root section */ public $mIgnoreWarning; public $mWatchthis; public $mCopyrightStatus; public $mCopyrightSource; - /** Hidden variables **/ + /** Hidden variables */ public $mDestWarningAck; @@ -84,7 +84,7 @@ class SpecialUpload extends SpecialPage { /** @var bool Subclasses can use this to determine whether a file was uploaded */ public $mUploadSuccessful = false; - /** Text injection points for hooks not using HTMLForm **/ + /** Text injection points for hooks not using HTMLForm */ public $uploadFormTextTop; public $uploadFormTextAfterSummary; @@ -191,11 +191,9 @@ class SpecialUpload extends SpecialPage { $this->loadRequest(); # Unsave the temporary file in case this was a cancelled upload - if ( $this->mCancelUpload ) { - if ( !$this->unsaveUploadedFile() ) { - # Something went wrong, so unsaveUploadedFile showed a warning - return; - } + if ( $this->mCancelUpload && !$this->unsaveUploadedFile() ) { + # Something went wrong, so unsaveUploadedFile showed a warning + return; } # Process upload or show a form @@ -313,16 +311,18 @@ class SpecialUpload extends SpecialPage { protected function showViewDeletedLinks() { $title = Title::makeTitleSafe( NS_FILE, $this->mDesiredDestName ); $user = $this->getUser(); + $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); // Show a subtitle link to deleted revisions (to sysops et al only) if ( $title instanceof Title ) { $count = $title->isDeleted(); - if ( $count > 0 && $user->isAllowed( 'deletedhistory' ) ) { + if ( $count > 0 && $permissionManager->userHasRight( $user, 'deletedhistory' ) ) { $restorelink = $this->getLinkRenderer()->makeKnownLink( SpecialPage::getTitleFor( 'Undelete', $title->getPrefixedText() ), $this->msg( 'restorelink' )->numParams( $count )->text() ); - $link = $this->msg( $user->isAllowed( 'delete' ) ? 'thisisdeleted' : 'viewdeleted' ) - ->rawParams( $restorelink )->parseAsBlock(); + $link = $this->msg( + $permissionManager->userHasRight( $user, 'delete' ) ? 'thisisdeleted' : 'viewdeleted' + )->rawParams( $restorelink )->parseAsBlock(); $this->getOutput()->addHTML( Html::rawElement( 'div', @@ -671,7 +671,8 @@ class SpecialUpload extends SpecialPage { return true; } - $local = wfLocalFile( $this->mDesiredDestName ); + $local = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo() + ->newFile( $this->mDesiredDestName ); if ( $local && $local->exists() ) { // We're uploading a new version of an existing file. // No creation, so don't watch it if we're not already. @@ -691,7 +692,7 @@ class SpecialUpload extends SpecialPage { */ protected function processVerificationError( $details ) { switch ( $details['status'] ) { - /** Statuses that only require name changing **/ + /** Statuses that only require name changing */ case UploadBase::MIN_LENGTH_PARTNAME: $this->showRecoverableUploadError( $this->msg( 'minlength1' )->escaped() ); break; @@ -709,7 +710,7 @@ class SpecialUpload extends SpecialPage { $this->showRecoverableUploadError( $this->msg( 'windows-nonascii-filename' )->parse() ); break; - /** Statuses that require reuploading **/ + /** Statuses that require reuploading */ case UploadBase::EMPTY_FILE: $this->showUploadError( $this->msg( 'emptyfile' )->escaped() ); break; @@ -782,7 +783,7 @@ class SpecialUpload extends SpecialPage { } } - /*** Functions for formatting warnings ***/ + /** Functions for formatting warnings */ /** * Formats a result of UploadBase::getExistsWarning as HTML