From 386d6109c445f999df86e47e0b5746b88340c225 Mon Sep 17 00:00:00 2001 From: Mike Bryant Date: Tue, 1 Nov 2016 12:46:40 +0000 Subject: [PATCH] Add better logging and ensure temp files are unlinked --- libraries/Omeka/Storage/Adapter/AmazonS3.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libraries/Omeka/Storage/Adapter/AmazonS3.php b/libraries/Omeka/Storage/Adapter/AmazonS3.php index 6e5b1a3..2229b7e 100644 --- a/libraries/Omeka/Storage/Adapter/AmazonS3.php +++ b/libraries/Omeka/Storage/Adapter/AmazonS3.php @@ -73,13 +73,16 @@ public function canStore() */ public function store($source, $dest) { - $this->_s3->putObject([ + $result = $this->_s3->putObject([ 'ACL' => $this->_getAcl(), 'Bucket' => $this->_getBucket(), 'Expiration' => $this->_getExpiration(), 'SourceFile' => $source, 'Key' => $dest ]); + $objectName = $result->get('ObjectURL'); + _log("Omeka_Storage_Adapter_AmazonS3: Stored '$source' as: $objectName"); + unlink($source); } /** @@ -90,7 +93,7 @@ public function store($source, $dest) */ public function move($source, $dest) { - $this->_s3->copy( + $result = $this->_s3->copy( $this->_getBucket(), $source, $this->_getBucket(), @@ -98,6 +101,8 @@ public function move($source, $dest) $this->_getAcl() ); $this->delete($source); + $objectName = $result->get('ObjectURL'); + _log("Omeka_Storage_Adapter_AmazonS3: Moved '$source' to: $objectName"); } /** @@ -111,6 +116,7 @@ public function delete($path) 'Bucket' => $this->_getBucket(), 'Key' => $path ]); + _log("Omeka_Storage_Adapter_AmazonS3: Deleted: $path"); } /**