-
-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix support for "aws/aws-sdk-php:^3.0" #1814
Conversation
c504bbd
to
9681212
Compare
d122539
to
92993fc
Compare
e859354
to
f6ac489
Compare
e8b5b6c
to
4419521
Compare
src/CDN/CloudFront.php
Outdated
/** | ||
* @todo: Make mandatory argument 5 and 6 when support for aws/aws-sdk-php < 3.0 is dropped. | ||
*/ | ||
public function __construct(string $path, string $key, string $secret, string $distributionId, ?string $region = null, ?string $version = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please line break this
src/CDN/CloudFront.php
Outdated
// @todo: Remove the following check and the `else` block when support for aws/aws-sdk-php < 3.0 is dropped. | ||
if (class_exists(Sdk::class)) { | ||
// AWS v3.x. | ||
$arguments['InvalidationBatch'] = $invalidationBatch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technicly it is the same, but better see diffrence between both versions.
$arguments['InvalidationBatch'] = $invalidationBatch; | |
$arguments += ['InvalidationBatch' => $invalidationBatch]; |
src/CDN/CloudFront.php
Outdated
// @todo: Remove the following check and the `else` block when support for aws/aws-sdk-php < 3.0 is dropped. | ||
if (class_exists(Sdk::class)) { | ||
// AWS v3.x. | ||
$config['credentials'] = [ | ||
'key' => $this->region, | ||
'secret' => $this->version, | ||
]; | ||
|
||
$this->client = new CloudFrontClient($config); | ||
} else { | ||
// AWS v2.x. | ||
$config['key'] = $this->region; | ||
$config['secret'] = $this->version; | ||
|
||
$this->client = CloudFrontClient::factory($config); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// @todo: Remove the following check and the `else` block when support for aws/aws-sdk-php < 3.0 is dropped. | |
if (class_exists(Sdk::class)) { | |
// AWS v3.x. | |
$config['credentials'] = [ | |
'key' => $this->region, | |
'secret' => $this->version, | |
]; | |
$this->client = new CloudFrontClient($config); | |
} else { | |
// AWS v2.x. | |
$config['key'] = $this->region; | |
$config['secret'] = $this->version; | |
$this->client = CloudFrontClient::factory($config); | |
} | |
$keysConfig = [ | |
'key' => $this->region, | |
'secret' => $this->version, | |
]; | |
// @todo: Remove the following check and the `else` block when support for aws/aws-sdk-php < 3.0 is dropped. | |
if (class_exists(Sdk::class)) { | |
// AWS v3.x. | |
$this->client = new CloudFrontClient($config+['credentials' => $keysConfig]); | |
} else { | |
// AWS v2.x. | |
$this->client = CloudFrontClient::factory($config+$keysConfig); | |
} |
Thank you @phansys |
Subject
Fix support for "aws/aws-sdk-php:^3.0".
I am targeting this branch, because these changes respect BC.
Related to #1018.
Changelog
To do
sonata_media.filesystem.s3.sdk_version
configuration node, since there is no way to install "aws/aws-sdk-php" 2.x and 3.x at the same time (this probably was added to switch between version 1.x and 2.x, since 1.x was provided by a different package).CloudFrontClient::createInvalidation()
when using aws/aws-sdk-php:^3.0.