Starting a topic on the S3 storage plugin to document the upgrades that appear to be required. I'll use the topic itself to post relevant background and then post questions I have at the moment as...Read More
Starting a topic on the S3 storage plugin to document the upgrades that appear to be required. I'll use the topic itself to post relevant background and then post questions I have at the moment as comments on the topic.
Here is an AWS source document I've found describing recent changes:
Previous method was referred to as Signature Version 2, the new method is referred to as Signature Version 4.
The original s3lib.php file includes a link in the header comments that is no longer functional. In researching an updated version of the file, I've found two sources on GitHub:
According to an article I found on Medium, the fork maintained by Rack Lin is preferable:
So I'm using the Rack Lin fork as the starting point for the updates. Copying down the library file ('S3.php') I found a few extra spaces which once deleted helps focus strictly on what's changed by running a diff against Anahita's 's3lib.php' file.
What's new - variables:
What's new - functions:
What changed - functions:
- __construct() now includes $region
- putBucket() now calls getRegion()
- inputFile() now includes sha256sum encoding
- putObject() now includes sha256sum encoding
- __getCloudFrontDistributionConfigXML() now checks that $trustedSigners is not empty
- getResponse() now checks $signVer for 'v2' versus 'v4'
- getResponse() now includes the $progressFunction
Anahita's PlgStorageS3 class:
A little intro on Anahita's PlgStorageS3 class, then the questions to follow...
So Anahita's PlgStorageS3 class appears to need revisions in order to account for the signature version and region. It seems these should be parameters that can be assigned in the Plugin's settings through additions to the s3.json file, with the signature version as a drop-down selector, and the region a text field with the default value of 'us-east-1'.
The "core" functions in PlgStorageS3 (_read, _write, _exists, and _delete) appear they should be compatible with the Rack Lin replacement for the s3lib.php file.
Protected variables would need to be added for $_region and $_signature, and it appears the __construct function would need to be amended to account for both.Read Less