diff --git a/application/libraries/Omeka/Storage/Adapter/ZendS3.php b/application/libraries/Omeka/Storage/Adapter/ZendS3.php index 19f726b1b..aadc30fb5 100644 --- a/application/libraries/Omeka/Storage/Adapter/ZendS3.php +++ b/application/libraries/Omeka/Storage/Adapter/ZendS3.php @@ -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 @@ -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. * @@ -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() @@ -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) {