delete storage bucket

This commit is contained in:
Damodar Lohani
2021-07-28 15:51:06 +05:45
parent f9df66b925
commit 5d14dcfa9d
3 changed files with 21 additions and 9 deletions
+11
View File
@@ -358,7 +358,18 @@ class DeletesV1 extends Worker
protected function deleteBucket(Document $document, string $projectId)
{
/** @var Utopia\Database\Database $db */
$db = $this->getInternalDB($projectId);
$bucketId = $document->getId();
$this->deleteByGroup('files',[
new Query('bucketId', Query::TYPE_EQUAL, [$bucketId])
], $db, function () use ($projectId, $bucketId) {
$device = new Local(APP_STORAGE_UPLOADS.'/app-'.$projectId);
$device->deletePath($device->getRoot() . DIRECTORY_SEPARATOR . $bucketId);
});
$db->deleteDocument('buckets', $bucketId);
}
/**
+1 -1
View File
@@ -51,7 +51,7 @@
"utopia-php/preloader": "0.2.*",
"utopia-php/domains": "1.1.*",
"utopia-php/swoole": "0.2.*",
"utopia-php/storage": "0.5.*",
"utopia-php/storage": "dev-feat-large-file-support",
"utopia-php/image": "0.5.*",
"resque/php-resque": "1.3.6",
"matomo/device-detector": "4.2.3",
Generated
+9 -8
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "17c1c46d283e4745df9915d082c22078",
"content-hash": "ab60fcd2b30e9c0ddcb490cd67a758c3",
"packages": [
{
"name": "adhocore/jwt",
@@ -2337,16 +2337,16 @@
},
{
"name": "utopia-php/storage",
"version": "0.5.0",
"version": "dev-feat-large-file-support",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/storage.git",
"reference": "92ae20c7a2ac329f573a58a82dc245134cc63408"
"reference": "0d031ffb159efa78b52db547b3471f228472a1a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/storage/zipball/92ae20c7a2ac329f573a58a82dc245134cc63408",
"reference": "92ae20c7a2ac329f573a58a82dc245134cc63408",
"url": "https://api.github.com/repos/utopia-php/storage/zipball/0d031ffb159efa78b52db547b3471f228472a1a1",
"reference": "0d031ffb159efa78b52db547b3471f228472a1a1",
"shasum": ""
},
"require": {
@@ -2383,9 +2383,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/storage/issues",
"source": "https://github.com/utopia-php/storage/tree/0.5.0"
"source": "https://github.com/utopia-php/storage/tree/feat-large-file-support"
},
"time": "2021-04-15T16:43:12+00:00"
"time": "2021-07-19T05:38:11+00:00"
},
{
"name": "utopia-php/swoole",
@@ -6237,7 +6237,8 @@
"minimum-stability": "stable",
"stability-flags": {
"utopia-php/abuse": 20,
"utopia-php/audit": 20
"utopia-php/audit": 20,
"utopia-php/storage": 20
},
"prefer-stable": false,
"prefer-lowest": false,