mirror of
https://github.com/nextcloud/server.git
synced 2026-03-26 20:33:55 -04:00
Delete S3 versions in rmdir
When deleting a complete folder in a bucket that has versioning enabled, also make sure to delete all associated versions and delete markers Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
parent
4a1a9d6821
commit
09ab7a40fe
1 changed files with 23 additions and 1 deletions
|
|
@ -311,13 +311,35 @@ class AmazonS3 extends \OC\Files\Storage\Common {
|
|||
$connection->deleteObjects([
|
||||
'Bucket' => $this->bucket,
|
||||
'Delete' => [
|
||||
'Objects' => $objects['Contents']
|
||||
'Objects' => $objects['Contents'],
|
||||
]
|
||||
]);
|
||||
$this->testTimeout();
|
||||
}
|
||||
// we reached the end when the list is no longer truncated
|
||||
} while ($objects['IsTruncated']);
|
||||
|
||||
do {
|
||||
// delete all contained versions and deletion markers
|
||||
$objects = $connection->listObjectVersions($params);
|
||||
if (isset($objects['Versions'])) {
|
||||
$connection->deleteObjects([
|
||||
'Bucket' => $this->bucket,
|
||||
'Delete' => [
|
||||
'Objects' => $objects['Versions'],
|
||||
]
|
||||
]);
|
||||
}
|
||||
if (isset($objects['DeleteMarkers'])) {
|
||||
$connection->deleteObjects([
|
||||
'Bucket' => $this->bucket,
|
||||
'Delete' => [
|
||||
'Objects' => $objects['DeleteMarkers'],
|
||||
]
|
||||
]);
|
||||
}
|
||||
// we reached the end when the list is no longer truncated
|
||||
} while ($objects['IsTruncated']);
|
||||
$this->deleteObject($path);
|
||||
} catch (S3Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, ['app' => 'files_external']);
|
||||
|
|
|
|||
Loading…
Reference in a new issue