Skip to content

Commit

Permalink
S3: add storageClass option
Browse files Browse the repository at this point in the history
  • Loading branch information
zerocrates committed May 29, 2024
1 parent 6b10b41 commit 50a088b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions application/libraries/Omeka/Storage/Adapter/ZendS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class Omeka_Storage_Adapter_ZendS3 implements Omeka_Storage_Adapter_AdapterInter
const EXPIRATION_OPTION = 'expiration';
const FORCE_SSL = 'forceSSL';
const ACLS_OPTION = 'acls';
const STORAGE_CLASS_OPTION = 'storageClass';

const S3_STORAGE_CLASS_HEADER = 'x-amz-storage-class';

/**
* @var Zend_Service_Amazon_S3
Expand All @@ -45,6 +48,11 @@ class Omeka_Storage_Adapter_ZendS3 implements Omeka_Storage_Adapter_AdapterInter
*/
private $_acls = true;

/**
* @var string
*/
private $_storageClass;

/**
* Set options for the storage adapter.
*
Expand Down Expand Up @@ -83,6 +91,10 @@ public function __construct(array $options = array())
if (isset($this->_options[self::ACLS_OPTION])) {
$this->_acls = (bool) $this->_options[self::ACLS_OPTION];
}

if (isset($this->_options[self::STORAGE_CLASS_OPTION])) {
$this->_storageClass = $this->_options[self::STORAGE_CLASS_OPTION];
}
}

public function setUp()
Expand Down Expand Up @@ -116,6 +128,10 @@ public function store($source, $dest)
}
}

if ($this->_storageClass) {
$meta[self::S3_STORAGE_CLASS_HEADER] = $this->_storageClass;
}

$status = $this->_s3->putFileStream($source, $objectName, $meta);

if (!$status) {
Expand Down

0 comments on commit 50a088b

Please sign in to comment.