if ( $type !== 'file' && $type !== 'thumb' ) {
throw new UploadStashBadPathException(
- wfMessage( 'uploadstash-bad-path-unknown-type', $type )
+ $this->msg( 'uploadstash-bad-path-unknown-type', $type )
);
}
$fileName = strtok( '/' );
$srcNamePos = strrpos( $thumbPart, $fileName );
if ( $srcNamePos === false || $srcNamePos < 1 ) {
throw new UploadStashBadPathException(
- wfMessage( 'uploadstash-bad-path-unrecognized-thumb-name' )
+ $this->msg( 'uploadstash-bad-path-unrecognized-thumb-name' )
);
}
$paramString = substr( $thumbPart, 0, $srcNamePos - 1 );
return [ 'file' => $file, 'type' => $type, 'params' => $params ];
} else {
throw new UploadStashBadPathException(
- wfMessage( 'uploadstash-bad-path-no-handler', $file->getMimeType(), $file->getPath() )
+ $this->msg( 'uploadstash-bad-path-no-handler', $file->getMimeType(), $file->getPath() )
);
}
}
*
* @param File $file
* @param array $params
- *
- * @return bool Success
*/
private function outputThumbFromStash( $file, $params ) {
$flags = 0;
$thumbnailImage = $file->transform( $params, $flags );
if ( !$thumbnailImage ) {
throw new UploadStashFileNotFoundException(
- wfMessage( 'uploadstash-file-not-found-no-thumb' )
+ $this->msg( 'uploadstash-file-not-found-no-thumb' )
);
}
// we should have just generated it locally
if ( !$thumbnailImage->getStoragePath() ) {
throw new UploadStashFileNotFoundException(
- wfMessage( 'uploadstash-file-not-found-no-local-path' )
+ $this->msg( 'uploadstash-file-not-found-no-local-path' )
);
}
$this->stash->repo, $thumbnailImage->getStoragePath(), false );
if ( !$thumbFile ) {
throw new UploadStashFileNotFoundException(
- wfMessage( 'uploadstash-file-not-found-no-object' )
+ $this->msg( 'uploadstash-file-not-found-no-object' )
);
}
if ( !$status->isOK() ) {
$errors = $status->getErrorsArray();
throw new UploadStashFileNotFoundException(
- wfMessage(
+ $this->msg(
'uploadstash-file-not-found-no-remote-thumb',
print_r( $errors, 1 ),
$scalerThumbUrl
$contentType = $req->getResponseHeader( "content-type" );
if ( !$contentType ) {
throw new UploadStashFileNotFoundException(
- wfMessage( 'uploadstash-file-not-found-missing-content-type' )
+ $this->msg( 'uploadstash-file-not-found-missing-content-type' )
);
}
private function outputLocalFile( File $file ) {
if ( $file->getSize() > self::MAX_SERVE_BYTES ) {
throw new SpecialUploadStashTooLargeException(
- wfMessage( 'uploadstash-file-too-large', self::MAX_SERVE_BYTES )
+ $this->msg( 'uploadstash-file-too-large', self::MAX_SERVE_BYTES )
);
}
$size = strlen( $content );
if ( $size > self::MAX_SERVE_BYTES ) {
throw new SpecialUploadStashTooLargeException(
- wfMessage( 'uploadstash-file-too-large', self::MAX_SERVE_BYTES )
+ $this->msg( 'uploadstash-file-too-large', self::MAX_SERVE_BYTES )
);
}
// Cancel output buffering and gzipping if set
return true;
}
}
-
-/**
- * @ingroup SpecialPage
- * @ingroup Upload
- */
-class SpecialUploadStashTooLargeException extends UploadStashException {
-}