diff options
4 files changed, 11 insertions, 2 deletions
diff --git a/apps/files_external/lib/Lib/Backend/AmazonS3.php b/apps/files_external/lib/Lib/Backend/AmazonS3.php index 26da263f094..831064b632d 100644 --- a/apps/files_external/lib/Lib/Backend/AmazonS3.php +++ b/apps/files_external/lib/Lib/Backend/AmazonS3.php @@ -47,6 +47,8 @@ class AmazonS3 extends Backend { ->setFlag(DefinitionParameter::FLAG_OPTIONAL), (new DefinitionParameter('region', $l->t('Region'))) ->setFlag(DefinitionParameter::FLAG_OPTIONAL), + (new DefinitionParameter('storageClass', $l->t('Storage Class'))) + ->setFlag(DefinitionParameter::FLAG_OPTIONAL), (new DefinitionParameter('use_ssl', $l->t('Enable SSL'))) ->setType(DefinitionParameter::VALUE_BOOLEAN), (new DefinitionParameter('use_path_style', $l->t('Enable Path Style'))) diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index ffa25dba999..6845d1f69c2 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -583,7 +583,8 @@ class AmazonS3 extends \OC\Files\Storage\Common { $this->getConnection()->copyObject([ 'Bucket' => $this->bucket, 'Key' => $this->cleanKey($target), - 'CopySource' => S3Client::encodeKey($this->bucket . '/' . $source) + 'CopySource' => S3Client::encodeKey($this->bucket . '/' . $source), + 'StorageClass' => $this->storageClass, ]); $this->testTimeout(); } catch (S3Exception $e) { diff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php index bdda1f8bee8..09fdffe01bd 100644 --- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php +++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php @@ -62,6 +62,9 @@ trait S3ConnectionTrait { /** @var string */ protected $proxy; + /** @var string */ + protected $storageClass; + /** @var int */ protected $uploadPartSize; @@ -81,6 +84,7 @@ trait S3ConnectionTrait { $this->bucket = $params['bucket']; $this->proxy = $params['proxy'] ?? false; $this->timeout = $params['timeout'] ?? 15; + $this->storageClass = !empty($params['storageClass']) ? $params['storageClass'] : 'STANDARD'; $this->uploadPartSize = $params['uploadPartSize'] ?? 524288000; $this->putSizeLimit = $params['putSizeLimit'] ?? 104857600; $params['region'] = empty($params['region']) ? 'eu-west-1' : $params['region']; diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index e6a2cf21cd0..33b9f6f7fed 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -105,6 +105,7 @@ trait S3ObjectTrait { 'Body' => $stream, 'ACL' => 'private', 'ContentType' => $mimetype, + 'StorageClass' => $this->storageClass, ]); } @@ -123,7 +124,8 @@ trait S3ObjectTrait { 'key' => $urn, 'part_size' => $this->uploadPartSize, 'params' => [ - 'ContentType' => $mimetype + 'ContentType' => $mimetype, + 'StorageClass' => $this->storageClass, ], ]); |