Recursive option added for deleting folder objects

This commit is contained in:
Bilal TAS 2019-06-03 08:52:35 +03:00
parent 12b4f6a627
commit 267ba3e4a6
2 changed files with 21 additions and 6 deletions

View file

@ -238,8 +238,12 @@ class SpacesConnect {
/*
Deletes an object.
*/
function DeleteObject($file_path = "") {
function DeleteObject($file_path = "", $recursive = false) {
try {
if ($recursive) return $this->ObjReturn($this->client->deleteMatchingObjects(
$this->space,
$file_path
));
return $this->ObjReturn($this->client->deleteObject([
'Bucket' => $this->space,
'Key' => $file_path,
@ -284,7 +288,7 @@ class SpacesConnect {
}
catch (\Exception $e) {
$this->HandleAWSException($e);
} finally {
} finally {
if ($is_file) {
fclose($file);
}