SpecialPage::execute never returns anything
Also remove the return value from the functions called here.
The special page is using exceptions instead of a bool to indicate
failure and success
Change-Id: Ia271fe06b8ce888a8448099020f7aedf23af30db
*
* @param string|null $subPage Subpage, e.g. in
* https://example.com/wiki/Special:UploadStash/foo.jpg, the "foo.jpg" part
*
* @param string|null $subPage Subpage, e.g. in
* https://example.com/wiki/Special:UploadStash/foo.jpg, the "foo.jpg" part
*/
public function execute( $subPage ) {
$this->useTransactionalTimeLimit();
*/
public function execute( $subPage ) {
$this->useTransactionalTimeLimit();
$this->checkPermissions();
if ( $subPage === null || $subPage === '' ) {
$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
*
* @param string $key The key of a particular requested file
* @throws HttpError
*/
public function showUpload( $key ) {
// prevent callers from doing standard HTML output -- we'll take it from here
*/
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' ) {
try {
$params = $this->parseKey( $key );
if ( $params['type'] === 'thumb' ) {
- return $this->outputThumbFromStash( $params['file'], $params['params'] );
+ $this->outputThumbFromStash( $params['file'], $params['params'] );
- return $this->outputLocalFile( $params['file'] );
+ $this->outputLocalFile( $params['file'] );
} catch ( UploadStashFileNotFoundException $e ) {
$code = 404;
$message = $e->getMessage();
} 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
* @param array $params Scaling parameters ( e.g. [ width => '50' ] );
* @param int $flags Scaling flags ( see File:: constants )
* @throws MWException|UploadStashFileNotFoundException
*/
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
*/
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
* @param array $params Scaling parameters ( e.g. [ width => '50' ] );
* @param int $flags Scaling flags ( see File:: constants )
* @throws MWException
*/
private function outputRemoteScaledThumb( $file, $params, $flags ) {
// This option probably looks something like
*/
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
* @param File $file File object with a local path (e.g. UnregisteredLocalFile,
* LocalFile. Oddly these don't share an ancestor!)
* @throws SpecialUploadStashTooLargeException
*/
private function outputLocalFile( File $file ) {
if ( $file->getSize() > self::MAX_SERVE_BYTES ) {
*/
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' ]
[ 'Content-Transfer-Encoding: binary',
'Expires: Sun, 17-Jan-2038 19:14:07 GMT' ]
* @param string $content
* @param string $contentType MIME type
* @throws SpecialUploadStashTooLargeException
* @param string $content
* @param string $contentType MIME type
* @throws SpecialUploadStashTooLargeException
*/
private function outputContents( $content, $contentType ) {
$size = strlen( $content );
*/
private function outputContents( $content, $contentType ) {
$size = strlen( $content );
wfResetOutputBuffers();
self::outputFileHeaders( $contentType, $size );
print $content;
wfResetOutputBuffers();
self::outputFileHeaders( $contentType, $size );
print $content;
/**
* 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
/**
* 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
*/
private function showUploads() {
// sets the title, etc.
*/
private function showUploads() {
// sets the title, etc.