mirror of
https://github.com/nextcloud/server.git
synced 2026-04-20 22:00:39 -04:00
Merge pull request #36075 from fmenabe/s3-storage-class
Add support for s3 storage classes
This commit is contained in:
commit
5e090d044d
4 changed files with 11 additions and 2 deletions
|
|
@ -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')))
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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'];
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
],
|
||||
]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue