summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-01-29 15:06:10 +0100
committerRobin Appelman <robin@icewind.nl>2018-01-29 15:06:10 +0100
commit7afd77604eeca78d82a15d57c22716c5e4850cc7 (patch)
treee8beae842421d73193d2a9fc366baeaf7956641a /apps
parent1d8b90b8d3c8a85104d223b7f1d5693280370774 (diff)
downloadnextcloud-server-7afd77604eeca78d82a15d57c22716c5e4850cc7.tar.gz
nextcloud-server-7afd77604eeca78d82a15d57c22716c5e4850cc7.zip
adjust s3 bulk delete to new sdk syntax
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_external/lib/Lib/Storage/AmazonS3.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php
index 03a24e89765..efcae431f92 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -242,17 +242,22 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$params['Prefix'] = $path . '/';
}
try {
+ $connection = $this->getConnection();
// Since there are no real directories on S3, we need
// to delete all objects prefixed with the path.
do {
// instead of the iterator, manually loop over the list ...
- $objects = $this->getConnection()->listObjects($params);
+ $objects = $connection->listObjects($params);
// ... so we can delete the files in batches
- $this->getConnection()->deleteObjects(array(
- 'Bucket' => $this->bucket,
- 'Objects' => $objects['Contents']
- ));
- $this->testTimeout();
+ if (isset($objects['Contents'])) {
+ $connection->deleteObjects([
+ 'Bucket' => $this->bucket,
+ 'Delete' => [
+ 'Objects' => $objects['Contents']
+ ]
+ ]);
+ $this->testTimeout();
+ }
// we reached the end when the list is no longer truncated
} while ($objects['IsTruncated']);
} catch (S3Exception $e) {