Skip to content

Commit

Permalink
Remove vendor dir, add support for PHP 8.0, drop support for PHP 7.1 …
Browse files Browse the repository at this point in the history
…and 7.2
  • Loading branch information
fisharebest committed Mar 11, 2021
1 parent b0e778d commit 4a3d66b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
12 changes: 7 additions & 5 deletions app/Factories/ImageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@
use Intervention\Image\ImageManager;
use League\Flysystem\FilesystemException;
use League\Flysystem\FilesystemOperator;
use League\Flysystem\UnableToReadFile;
use Psr\Http\Message\ResponseInterface;
use RuntimeException;
use Throwable;

use function addcslashes;
use function basename;
use function extension_loaded;
use function get_class;
use function pathinfo;
use function response;
use function strlen;
Expand Down Expand Up @@ -132,11 +134,11 @@ public function thumbnailResponse(
return $this->imageResponse($data, $image->mime(), '');
} catch (NotReadableException $ex) {
return $this->replacementImageResponse('.' . pathinfo($path, PATHINFO_EXTENSION));
} catch (FileNotFoundException $ex) {
} catch (UnableToReadFile $ex) {
return $this->replacementImageResponse((string) StatusCodeInterface::STATUS_NOT_FOUND);
} catch (Throwable $ex) {
return $this->replacementImageResponse((string) StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR)
->withHeader('X-Thumbnail-Exception', $ex->getMessage());
->withHeader('X-Thumbnail-Exception', basename(get_class($ex)) . ': ' . $ex->getMessage());
}
}

Expand Down Expand Up @@ -176,7 +178,7 @@ public function mediaFileResponse(MediaFile $media_file, bool $add_watermark, bo
} catch (NotReadableException $ex) {
return $this->replacementImageResponse(pathinfo($filename, PATHINFO_EXTENSION))
->withHeader('X-Image-Exception', $ex->getMessage());
} catch (FileNotFoundException $ex) {
} catch (UnableToReadFile $ex) {
return $this->replacementImageResponse((string) StatusCodeInterface::STATUS_NOT_FOUND);
} catch (Throwable $ex) {
return $this->replacementImageResponse((string) StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR)
Expand Down Expand Up @@ -244,11 +246,11 @@ public function mediaFileThumbnailResponse(
return $this->imageResponse($data, $mime_type, '');
} catch (NotReadableException $ex) {
return $this->replacementImageResponse('.' . pathinfo($path, PATHINFO_EXTENSION));
} catch (FileNotFoundException $ex) {
} catch (UnableToReadFile $ex) {
return $this->replacementImageResponse((string) StatusCodeInterface::STATUS_NOT_FOUND);
} catch (Throwable $ex) {
return $this->replacementImageResponse((string) StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR)
->withHeader('X-Thumbnail-Exception', $ex->getMessage());
->withHeader('X-Thumbnail-Exception', basename(get_class($ex)) . ': ' . $ex->getMessage());
}
}

Expand Down
3 changes: 1 addition & 2 deletions app/Http/RequestHandlers/EditMediaFileAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
use Fisharebest\Webtrees\Services\MediaFileService;
use Fisharebest\Webtrees\Services\PendingChangesService;
use Fisharebest\Webtrees\Tree;
use League\Flysystem\FileExistsException;
use League\Flysystem\FileNotFoundException;
use League\Flysystem\UnableToReadFile;
use League\Flysystem\FilesystemException;
use League\Flysystem\UnableToMoveFile;
use League\Flysystem\Util;
Expand Down
3 changes: 2 additions & 1 deletion app/Http/RequestHandlers/ManageMediaData.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Query\JoinClause;
use League\Flysystem\FilesystemOperator;
use League\Flysystem\UnableToReadFile;
use League\Flysystem\UnableToRetrieveMetadata;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
Expand Down Expand Up @@ -128,7 +129,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface

$url = route(AdminMediaFileDownload::class, ['path' => $path]);
$img = '<a href="' . e($url) . '" type="' . $mime_type . '" class="gallery">' . $img . '</a>';
} catch (FileNotFoundException $ex) {
} catch (UnableToReadFile $ex) {
$url = route(AdminMediaFileThumbnail::class, ['path' => $path]);
$img = '<img src="' . e($url) . '">';
}
Expand Down
3 changes: 1 addition & 2 deletions app/Services/ServerCheckService.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ class ServerCheckService
private const PHP_SUPPORT_URL = 'https://www.php.net/supported-versions.php';
private const PHP_MINOR_VERSION = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;
private const PHP_SUPPORT_DATES = [
'7.1' => '2019-12-01',
'7.2' => '2020-11-30',
'7.3' => '2021-12-06',
'7.4' => '2022-11-28',
'8.0' => '2023-11-26',
];

// As required by illuminate/database 5.8
Expand Down

0 comments on commit 4a3d66b

Please sign in to comment.