diff options
author | Robin Appelman <robin@icewind.nl> | 2017-04-20 17:08:22 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2017-09-18 15:16:27 +0200 |
commit | dad18baec8274995ff384789ccc2577aabc6dde8 (patch) | |
tree | 15e53802f49cb7d32e664f1e75f6234014b68a88 /lib/private/Files/ObjectStore/S3ConnectionTrait.php | |
parent | cf1da57c1d38852a21aea701fd9194c0c6226c20 (diff) | |
download | nextcloud-server-dad18baec8274995ff384789ccc2577aabc6dde8.tar.gz nextcloud-server-dad18baec8274995ff384789ccc2577aabc6dde8.zip |
update aws sdk and move it to 3rdparty
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/ObjectStore/S3ConnectionTrait.php')
-rw-r--r-- | lib/private/Files/ObjectStore/S3ConnectionTrait.php | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php index a8b57cb18d3..f665bc2e7ce 100644 --- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php +++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php @@ -53,7 +53,7 @@ trait S3ConnectionTrait { $this->bucket = $params['bucket']; $this->timeout = (!isset($params['timeout'])) ? 15 : $params['timeout']; $params['region'] = empty($params['region']) ? 'eu-west-1' : $params['region']; - $params['hostname'] = empty($params['hostname']) ? 's3.amazonaws.com' : $params['hostname']; + $params['hostname'] = empty($params['hostname']) ? 's3.' . $params['region'] . '.amazonaws.com' : $params['hostname']; if (!isset($params['port']) || $params['port'] === '') { $params['port'] = (isset($params['use_ssl']) && $params['use_ssl'] === false) ? 80 : 443; } @@ -76,20 +76,23 @@ trait S3ConnectionTrait { $base_url = $scheme . '://' . $this->params['hostname'] . ':' . $this->params['port'] . '/'; $options = [ - 'key' => $this->params['key'], - 'secret' => $this->params['secret'], - 'base_url' => $base_url, + 'version' => isset($this->params['version']) ? $this->params['version'] : 'latest', + 'credentials' => [ + 'key' => $this->params['key'], + 'secret' => $this->params['secret'], + ], + 'endpoint' => $base_url, 'region' => $this->params['region'], - S3Client::COMMAND_PARAMS => [ + 'command.params' => [ 'PathStyle' => isset($this->params['use_path_style']) ? $this->params['use_path_style'] : false, ] ]; if (isset($this->params['proxy'])) { - $options[S3Client::REQUEST_OPTIONS] = ['proxy' => $this->params['proxy']]; + $options['request.options'] = ['proxy' => $this->params['proxy']]; } - $this->connection = S3Client::factory($options); + $this->connection = new S3Client($options); - if (!$this->connection->isValidBucketName($this->bucket)) { + if (!S3Client::isBucketDnsCompatible($this->bucket)) { throw new \Exception("The configured bucket name is invalid."); } @@ -98,11 +101,6 @@ trait S3ConnectionTrait { $this->connection->createBucket(array( 'Bucket' => $this->bucket )); - $this->connection->waitUntilBucketExists(array( - 'Bucket' => $this->bucket, - 'waiter.interval' => 1, - 'waiter.max_attempts' => 15 - )); $this->testTimeout(); } catch (S3Exception $e) { \OCP\Util::logException('files_external', $e); |