X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiUpload.php;h=9d30729c6f8a881338af2a13a85ff3d2cf8dcb0e;hb=c0f872ddf7ac1ebe791933a1423c629eee9ee521;hp=f2733bdeeff462949f367adb29cae82eaae4c25d;hpb=bbd9c84e10add1a694f4fba3b1917c59f1310fd5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index f2733bdeef..9d30729c6f 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -81,7 +81,7 @@ class ApiUpload extends ApiBase { // Check if the uploaded file is sane if ( $this->mParams['chunk'] ) { - $maxSize = $this->mUpload->getMaxUploadSize( ); + $maxSize = $this->mUpload->getMaxUploadSize(); if( $this->mParams['filesize'] > $maxSize ) { $this->dieUsage( 'The file you submitted was too large', 'file-too-large' ); } @@ -143,7 +143,7 @@ class ApiUpload extends ApiBase { * @return array */ private function getStashResult( $warnings ) { - $result = array (); + $result = array(); // Some uploads can request they be stashed, so as not to publish them immediately. // In this case, a failure to stash ought to be fatal try { @@ -222,10 +222,9 @@ class ApiUpload extends ApiBase { $ok = JobQueueGroup::singleton()->push( new AssembleUploadChunksJob( Title::makeTitle( NS_FILE, $this->mParams['filekey'] ), array( - 'filename' => $this->mParams['filename'], - 'filekey' => $this->mParams['filekey'], - 'session' => $this->getRequest()->exportUserSession(), - 'userid' => $this->getUser()->getId() + 'filename' => $this->mParams['filename'], + 'filekey' => $this->mParams['filekey'], + 'session' => $this->getContext()->exportSession() ) ) ); if ( $ok ) { @@ -441,13 +440,13 @@ class ApiUpload extends ApiBase { /** * Performs file verification, dies on error. */ - protected function verifyUpload( ) { - $verification = $this->mUpload->verifyUpload( ); + protected function verifyUpload() { + $verification = $this->mUpload->verifyUpload(); if ( $verification['status'] === UploadBase::OK ) { return; - } else { - return $this->checkVerification( $verification ); } + + $this->checkVerification( $verification ); } /** @@ -456,7 +455,7 @@ class ApiUpload extends ApiBase { protected function checkVerification( array $verification ) { global $wgFileExtensions; - // TODO: Move them to ApiBase's message map + // @todo Move them to ApiBase's message map switch( $verification['status'] ) { // Recoverable errors case UploadBase::MIN_LENGTH_PARTNAME: @@ -589,13 +588,12 @@ class ApiUpload extends ApiBase { $ok = JobQueueGroup::singleton()->push( new PublishStashedFileJob( Title::makeTitle( NS_FILE, $this->mParams['filename'] ), array( - 'filename' => $this->mParams['filename'], - 'filekey' => $this->mParams['filekey'], - 'comment' => $this->mParams['comment'], - 'text' => $this->mParams['text'], - 'watch' => $watch, - 'session' => $this->getRequest()->exportUserSession(), - 'userid' => $this->getUser()->getId() + 'filename' => $this->mParams['filename'], + 'filekey' => $this->mParams['filekey'], + 'comment' => $this->mParams['comment'], + 'text' => $this->mParams['text'], + 'watch' => $watch, + 'session' => $this->getContext()->exportSession() ) ) ); if ( $ok ) {