mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 14:50:17 -04:00
use multipart copy for s3
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
0acad69840
commit
22556a67a8
2 changed files with 13 additions and 8 deletions
|
|
@ -580,10 +580,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
|
|||
|
||||
if ($isFile === true || $this->is_file($source)) {
|
||||
try {
|
||||
$this->getConnection()->copyObject([
|
||||
'Bucket' => $this->bucket,
|
||||
'Key' => $this->cleanKey($target),
|
||||
'CopySource' => S3Client::encodeKey($this->bucket . '/' . $source),
|
||||
$this->copyObject($source, $target, [
|
||||
'StorageClass' => $this->storageClass,
|
||||
]);
|
||||
$this->testTimeout();
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
namespace OC\Files\ObjectStore;
|
||||
|
||||
use Aws\S3\Exception\S3MultipartUploadException;
|
||||
use Aws\S3\MultipartCopy;
|
||||
use Aws\S3\MultipartUploader;
|
||||
use Aws\S3\S3Client;
|
||||
use GuzzleHttp\Psr7;
|
||||
|
|
@ -189,9 +190,16 @@ trait S3ObjectTrait {
|
|||
return $this->getConnection()->doesObjectExist($this->bucket, $urn, $this->getSSECParameters());
|
||||
}
|
||||
|
||||
public function copyObject($from, $to) {
|
||||
$this->getConnection()->copy($this->getBucket(), $from, $this->getBucket(), $to, 'private', [
|
||||
'params' => $this->getSSECParameters() + $this->getSSECParameters(true)
|
||||
]);
|
||||
public function copyObject($from, $to, array $options = []) {
|
||||
$copy = new MultipartCopy($this->getConnection(), [
|
||||
"source_bucket" => $this->getBucket(),
|
||||
"source_key" => $from
|
||||
], array_merge([
|
||||
"bucket" => $this->getBucket(),
|
||||
"key" => $to,
|
||||
"acl" => "private",
|
||||
"params" => $this->getSSECParameters() + $this->getSSECParameters(true)
|
||||
], $options));
|
||||
$copy->copy();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue