From db33c6e5a26eeb3c2cca6288e222199f630a83a7 Mon Sep 17 00:00:00 2001 From: Fexiven <48439988+Fexiven@users.noreply.github.com> Date: Thu, 30 Nov 2023 22:01:38 +0100 Subject: [PATCH] modify PublicCDNAdapter for Flysystem v3 (#65) Co-authored-by: Fexiven --- README.md | 8 +++++--- _config/assets.yml | 2 ++ src/Adapter/PublicCDNAdapter.php | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index bd7ff48..cdb7971 100644 --- a/README.md +++ b/README.md @@ -82,9 +82,11 @@ SilverStripe\Core\Injector\Injector: class: SilverStripe\S3\Adapter\PublicCDNAdapter constructor: s3Client: '%$Aws\S3\S3Client' - bucket: "`AWS_BUCKET_NAME`" - prefix: "`AWS_PUBLIC_BUCKET_PREFIX`" - cdnPrefix: "`AWS_PUBLIC_CDN_PREFIX`" + bucket: '`AWS_BUCKET_NAME`' + prefix: '`AWS_PUBLIC_BUCKET_PREFIX`' + visibility: null + mimeTypeDetector: null + cdnPrefix: '`AWS_PUBLIC_CDN_PREFIX`' options: [] cdnAssetsDir: "cms-assets" # example of a custom assets folder name, which will produce https://cdn.example.com/cms-assets/Uploads/file.jpg ``` diff --git a/_config/assets.yml b/_config/assets.yml index 025b3c1..ac3aed4 100644 --- a/_config/assets.yml +++ b/_config/assets.yml @@ -97,4 +97,6 @@ SilverStripe\Core\Injector\Injector: s3Client: '%$Aws\S3\S3Client' bucket: '`AWS_BUCKET_NAME`' prefix: '`AWS_PUBLIC_BUCKET_PREFIX`' + visibility: null + mimeTypeDetector: null cdnPrefix: '`AWS_PUBLIC_CDN_PREFIX`' diff --git a/src/Adapter/PublicCDNAdapter.php b/src/Adapter/PublicCDNAdapter.php index 45ad8f3..b367b6a 100644 --- a/src/Adapter/PublicCDNAdapter.php +++ b/src/Adapter/PublicCDNAdapter.php @@ -18,11 +18,11 @@ class PublicCDNAdapter extends PublicAdapter implements SilverstripePublicAdapte protected $cdnAssetsDir; - public function __construct(S3Client $client, $bucket, $prefix = '', $cdnPrefix = '', array $options = [], $cdnAssetsDir = '') + public function __construct(S3Client $client, $bucket, $prefix = '', VisibilityConverter $visibility = null, MimeTypeDetector $mimeTypeDetector = null, $cdnPrefix = '', array $options = [], $cdnAssetsDir = '') { $this->cdnPrefix = $cdnPrefix; $this->cdnAssetsDir = $cdnAssetsDir ? $cdnAssetsDir : ASSETS_DIR; - parent::__construct($client, $bucket, $prefix, $options); + parent::__construct($client, $bucket, $prefix, $visibility, $mimeTypeDetector, $options); } /**