1
0
Fork 0
mirror of synced 2024-06-29 11:40:45 +12:00

feat: address review comments:

This commit is contained in:
Christy Jacob 2022-11-11 13:54:05 +00:00
parent f2f56aa310
commit 72a37516d3

View file

@ -259,8 +259,8 @@ class DeletesV1 extends Worker
$this->getProjectDB($projectId)->delete($projectId);
// Delete all storage directories
$uploads = $this->getDevice(APP_STORAGE_UPLOADS . '/app-' . $document->getId());
$cache = $this->getDevice(APP_STORAGE_CACHE . '/app-' . $document->getId());
$uploads = $this->getFilesDevice($document->getId());
$cache = new Local(APP_STORAGE_CACHE . '/app-' . $document->getId());
$uploads->delete($uploads->getRoot(), true);
$cache->delete($cache->getRoot(), true);
@ -425,7 +425,7 @@ class DeletesV1 extends Worker
* Delete Deployments
*/
Console::info("Deleting deployments for function " . $functionId);
$storageFunctions = $this->getDevice(APP_STORAGE_FUNCTIONS . '/app-' . $projectId);
$storageFunctions = $this->getFunctionsDevice($projectId);
$deploymentIds = [];
$this->deleteByGroup('deployments', [
Query::equal('resourceId', [$functionId])
@ -442,7 +442,7 @@ class DeletesV1 extends Worker
* Delete builds
*/
Console::info("Deleting builds for function " . $functionId);
$storageBuilds = $this->getDevice(APP_STORAGE_BUILDS . '/app-' . $projectId);
$storageBuilds = $this->getBuildsDevice($projectId);
foreach ($deploymentIds as $deploymentId) {
$this->deleteByGroup('builds', [
Query::equal('deploymentId', [$deploymentId])
@ -491,7 +491,7 @@ class DeletesV1 extends Worker
* Delete deployment files
*/
Console::info("Deleting deployment files for deployment " . $deploymentId);
$storageFunctions = $this->getDevice(APP_STORAGE_FUNCTIONS . '/app-' . $projectId);
$storageFunctions = $this->getFunctionsDevice($projectId);
if ($storageFunctions->delete($document->getAttribute('path', ''), true)) {
Console::success('Deleted deployment files: ' . $document->getAttribute('path', ''));
} else {
@ -502,7 +502,7 @@ class DeletesV1 extends Worker
* Delete builds
*/
Console::info("Deleting builds for deployment " . $deploymentId);
$storageBuilds = $this->getDevice(APP_STORAGE_BUILDS . '/app-' . $projectId);
$storageBuilds = $this->getBuildsDevice($projectId);
$this->deleteByGroup('builds', [
Query::equal('deploymentId', [$deploymentId])
], $dbForProject, function (Document $document) use ($storageBuilds) {
@ -671,7 +671,7 @@ class DeletesV1 extends Worker
$dbForProject = $this->getProjectDB($projectId);
$dbForProject->deleteCollection('bucket_' . $document->getInternalId());
$device = $this->getDevice(APP_STORAGE_UPLOADS . '/app-' . $projectId);
$device = $this->getFilesDevice($projectId);
$device->deletePath($document->getId());
}