Skip to content

Commit

Permalink
Add better logging and ensure temp files are unlinked
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesname committed Nov 1, 2016
1 parent 0724a70 commit 386d610
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libraries/Omeka/Storage/Adapter/AmazonS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -90,14 +93,16 @@ public function store($source, $dest)
*/
public function move($source, $dest)
{
$this->_s3->copy(
$result = $this->_s3->copy(
$this->_getBucket(),
$source,
$this->_getBucket(),
$dest,
$this->_getAcl()
);
$this->delete($source);
$objectName = $result->get('ObjectURL');
_log("Omeka_Storage_Adapter_AmazonS3: Moved '$source' to: $objectName");
}

/**
Expand All @@ -111,6 +116,7 @@ public function delete($path)
'Bucket' => $this->_getBucket(),
'Key' => $path
]);
_log("Omeka_Storage_Adapter_AmazonS3: Deleted: $path");
}

/**
Expand Down

0 comments on commit 386d610

Please sign in to comment.