X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUploadStash.php;h=dac19a3135054c7f84450c497ae92cd8a3ac1eb3;hb=4051970d03686d0f05516659a35733cd5325eb37;hp=c278babd64fd1040a452769a48c64036f7aa3439;hpb=f22189e49024a9960f832d1e3a48dca3580caa27;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUploadStash.php b/includes/specials/SpecialUploadStash.php index c278babd64..dac19a3135 100644 --- a/includes/specials/SpecialUploadStash.php +++ b/includes/specials/SpecialUploadStash.php @@ -62,7 +62,6 @@ class SpecialUploadStash extends UnlistedSpecialPage { * * @param string|null $subPage Subpage, e.g. in * https://example.com/wiki/Special:UploadStash/foo.jpg, the "foo.jpg" part - * @return bool Success */ public function execute( $subPage ) { $this->useTransactionalTimeLimit(); @@ -71,10 +70,10 @@ class SpecialUploadStash extends UnlistedSpecialPage { $this->checkPermissions(); if ( $subPage === null || $subPage === '' ) { - return $this->showUploads(); + $this->showUploads(); + } else { + $this->showUpload( $subPage ); } - - return $this->showUpload( $subPage ); } /** @@ -83,7 +82,6 @@ class SpecialUploadStash extends UnlistedSpecialPage { * * @param string $key The key of a particular requested file * @throws HttpError - * @return bool */ public function showUpload( $key ) { // prevent callers from doing standard HTML output -- we'll take it from here @@ -92,10 +90,11 @@ class SpecialUploadStash extends UnlistedSpecialPage { try { $params = $this->parseKey( $key ); if ( $params['type'] === 'thumb' ) { - return $this->outputThumbFromStash( $params['file'], $params['params'] ); + $this->outputThumbFromStash( $params['file'], $params['params'] ); } else { - return $this->outputLocalFile( $params['file'] ); + $this->outputLocalFile( $params['file'] ); } + return; } catch ( UploadStashFileNotFoundException $e ) { $code = 404; $message = $e->getMessage(); @@ -187,7 +186,6 @@ class SpecialUploadStash extends UnlistedSpecialPage { * @param array $params Scaling parameters ( e.g. [ width => '50' ] ); * @param int $flags Scaling flags ( see File:: constants ) * @throws MWException|UploadStashFileNotFoundException - * @return bool Success */ private function outputLocallyScaledThumb( $file, $params, $flags ) { // n.b. this is stupid, we insist on re-transforming the file every time we are invoked. We rely @@ -219,7 +217,7 @@ class SpecialUploadStash extends UnlistedSpecialPage { ); } - return $this->outputLocalFile( $thumbFile ); + $this->outputLocalFile( $thumbFile ); } /** @@ -239,7 +237,6 @@ class SpecialUploadStash extends UnlistedSpecialPage { * @param array $params Scaling parameters ( e.g. [ width => '50' ] ); * @param int $flags Scaling flags ( see File:: constants ) * @throws MWException - * @return bool Success */ private function outputRemoteScaledThumb( $file, $params, $flags ) { // This option probably looks something like @@ -303,7 +300,7 @@ class SpecialUploadStash extends UnlistedSpecialPage { ); } - return $this->outputContents( $req->getContent(), $contentType ); + $this->outputContents( $req->getContent(), $contentType ); } /** @@ -313,7 +310,6 @@ class SpecialUploadStash extends UnlistedSpecialPage { * @param File $file File object with a local path (e.g. UnregisteredLocalFile, * LocalFile. Oddly these don't share an ancestor!) * @throws SpecialUploadStashTooLargeException - * @return bool */ private function outputLocalFile( File $file ) { if ( $file->getSize() > self::MAX_SERVE_BYTES ) { @@ -322,10 +318,10 @@ class SpecialUploadStash extends UnlistedSpecialPage { ); } - return $file->getRepo()->streamFileWithStatus( $file->getPath(), + $file->getRepo()->streamFileWithStatus( $file->getPath(), [ 'Content-Transfer-Encoding: binary', 'Expires: Sun, 17-Jan-2038 19:14:07 GMT' ] - )->isOK(); + ); } /** @@ -334,7 +330,6 @@ class SpecialUploadStash extends UnlistedSpecialPage { * @param string $content * @param string $contentType MIME type * @throws SpecialUploadStashTooLargeException - * @return bool */ private function outputContents( $content, $contentType ) { $size = strlen( $content ); @@ -347,8 +342,6 @@ class SpecialUploadStash extends UnlistedSpecialPage { wfResetOutputBuffers(); self::outputFileHeaders( $contentType, $size ); print $content; - - return true; } /** @@ -394,7 +387,6 @@ class SpecialUploadStash extends UnlistedSpecialPage { /** * Default action when we don't have a subpage -- just show links to the uploads we have, * Also show a button to clear stashed files - * @return bool */ private function showUploads() { // sets the title, etc. @@ -459,7 +451,5 @@ class SpecialUploadStash extends UnlistedSpecialPage { . $refreshHtml ) ); } - - return true; } }