diff --git a/libraries/Omeka/Storage/Adapter/AmazonS3.php b/libraries/Omeka/Storage/Adapter/AmazonS3.php index 2229b7e..fc9698a 100644 --- a/libraries/Omeka/Storage/Adapter/AmazonS3.php +++ b/libraries/Omeka/Storage/Adapter/AmazonS3.php @@ -76,7 +76,6 @@ public function store($source, $dest) $result = $this->_s3->putObject([ 'ACL' => $this->_getAcl(), 'Bucket' => $this->_getBucket(), - 'Expiration' => $this->_getExpiration(), 'SourceFile' => $source, 'Key' => $dest ]); @@ -127,6 +126,17 @@ public function delete($path) */ public function getUri($path) { + if ($expiration = $this->_getExpiration()) { + $cmd = $this->_s3->getCommand('GetObject', [ + 'Bucket' => $this->_getBucket(), + 'Key' => $path + ]); + $request = $this->_s3->createPresignedRequest($cmd, "+$expiration minutes"); + $uri = (string)$request->getUri(); + debug("Omeka_Storage_Adapter_AmazonS3: generating URI to expire in $expiration minutes: $uri"); + return $uri; + } + return $this->_s3->getObjectUrl($this->_getBucket(), $path); } diff --git a/plugin.ini b/plugin.ini index 14a49d0..e101334 100644 --- a/plugin.ini +++ b/plugin.ini @@ -1,9 +1,9 @@ [info] -name="AmazonS3StorageAdapter" +name="Amazon S3 Storage Adapter" author="EHRI" description="Storage adapter for Amazon S3 based on the official AWS SDK." -link="https://github.com/EHRI/omeka-storage-adapter-amazon-s3" +link="https://github.com/EHRI/omeka-amazon-s3-storage-adapter" license="European Union Public Licence (EUPL) v1.1" omeka_minimum_version="2.0" omeka_target_version="2.4" -version="0.1" +version="0.2"