From c7082c734ac0c9c7c67c81e47ffd17c9bd1b1fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Fauvel?= Date: Tue, 14 Mar 2017 12:00:19 +0100 Subject: [PATCH] Fixed MultipartUploader usage --- library/CM/File/Filesystem/Adapter/AwsS3.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/library/CM/File/Filesystem/Adapter/AwsS3.php b/library/CM/File/Filesystem/Adapter/AwsS3.php index 6cb18167b..a6a9a9bc3 100644 --- a/library/CM/File/Filesystem/Adapter/AwsS3.php +++ b/library/CM/File/Filesystem/Adapter/AwsS3.php @@ -88,19 +88,14 @@ public function write($path, $content) { } public function writeStream($path, $stream) { - /** @var \Aws\S3\Model\MultipartUpload\UploadBuilder $uploader */ - $uploadBuilder = \Aws\S3\Model\MultipartUpload\UploadBuilder::newInstance(); - $uploadBuilder->setClient($this->_client); - $uploadBuilder->setSource($stream); - $uploadBuilder->setBucket($this->_bucket); - $uploadBuilder->setKey($this->_getAbsolutePath($path)); - /** @var \Aws\Common\Model\MultipartUpload\TransferInterface $uploader */ - $uploader = $uploadBuilder->build(); + $uploader = new \Aws\S3\MultipartUploader($this->_client, $stream, [ + 'bucket' => $this->_bucket, + 'key' => $this->_getAbsolutePath($path), + ]); try { $uploader->upload(); - } catch (\Aws\Common\Exception\MultipartUploadException $exception) { - $uploader->abort(); + } catch (\Aws\Exception\MultipartUploadException $exception) { throw new CM_Exception('AWS S3 Upload to path failed', null, [ 'path' => $path, 'originalExceptionMessage' => $exception->getMessage(),