*
* @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();
$this->checkPermissions();
if ( $subPage === null || $subPage === '' ) {
- return $this->showUploads();
+ $this->showUploads();
+ } else {
+ $this->showUpload( $subPage );
}
-
- return $this->showUpload( $subPage );
}
/**
*
* @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
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();
* @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
);
}
- return $this->outputLocalFile( $thumbFile );
+ $this->outputLocalFile( $thumbFile );
}
/**
* @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
);
}
- return $this->outputContents( $req->getContent(), $contentType );
+ $this->outputContents( $req->getContent(), $contentType );
}
/**
* @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 ) {
);
}
- 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();
+ );
}
/**
* @param string $content
* @param string $contentType MIME type
* @throws SpecialUploadStashTooLargeException
- * @return bool
*/
private function outputContents( $content, $contentType ) {
$size = strlen( $content );
wfResetOutputBuffers();
self::outputFileHeaders( $contentType, $size );
print $content;
-
- return true;
}
/**
/**
* 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.
. $refreshHtml
) );
}
-
- return true;
}
}