1
0
Fork 0
mirror of synced 2024-07-04 06:00:53 +12:00

fix: deletes worker for projects

This commit is contained in:
Torsten Dittmann 2023-04-27 17:37:14 +02:00
parent e1cf068652
commit 31e65d954b

View file

@ -9,7 +9,6 @@ use Utopia\Database\Document;
use Utopia\Database\Query;
use Appwrite\Resque\Worker;
use Executor\Executor;
use Utopia\Storage\Device\Local;
use Utopia\Abuse\Abuse;
use Utopia\Abuse\Adapters\TimeLimit;
use Utopia\CLI\Console;
@ -291,12 +290,13 @@ class DeletesV1 extends Worker
protected function deleteProject(Document $document): void
{
$projectId = $document->getId();
$projectInternalId = $document->getInternalId();
// Delete project domains and certificates
// Delete project certificates
$dbForConsole = $this->getConsoleDB();
$domains = $dbForConsole->find('domains', [
Query::equal('projectInternalId', [$document->getInternalId()])
Query::equal('projectInternalId', [$projectInternalId])
]);
foreach ($domains as $domain) {
@ -318,6 +318,21 @@ class DeletesV1 extends Worker
}
}
// Delete Platforms
$this->deleteByGroup('platforms', [
Query::equal('projectInternalId', [$projectInternalId])
], $dbForConsole);
// Delete Domains
$this->deleteByGroup('domains', [
Query::equal('projectInternalId', [$projectInternalId])
], $dbForConsole);
// Delete Keys
$this->deleteByGroup('keys', [
Query::equal('projectInternalId', [$projectInternalId])
], $dbForConsole);
// Delete metadata tables
try {
$dbForProject->deleteCollection('_metadata');