1
0
Fork 0
mirror of synced 2024-10-01 01:37:56 +13:00

Merge pull request #5442 from appwrite/fix-project-deletion-leftovers

fix: project deletion leftovers
This commit is contained in:
Torsten Dittmann 2023-04-27 20:19:09 +02:00 committed by GitHub
commit b2c8e182a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 6 deletions

2
.gitmodules vendored
View file

@ -1,4 +1,4 @@
[submodule "app/console"] [submodule "app/console"]
path = app/console path = app/console
url = https://github.com/appwrite/console url = https://github.com/appwrite/console
branch = 2.3.3 branch = 2.3.4

View file

@ -3,6 +3,7 @@
## Bugs ## Bugs
- Fixed auto-setting custom ID on nested documents [#5363](https://github.com/appwrite/appwrite/pull/5363) - Fixed auto-setting custom ID on nested documents [#5363](https://github.com/appwrite/appwrite/pull/5363)
- Fixed listDocuments not returning all the documents [#5395](https://github.com/appwrite/appwrite/pull/5395) - Fixed listDocuments not returning all the documents [#5395](https://github.com/appwrite/appwrite/pull/5395)
- Fixed deleting keys, webhooks, platforms and domains after deleting project [#5395](https://github.com/appwrite/appwrite/pull/5395)
# Version 1.3.1 # Version 1.3.1

@ -1 +1 @@
Subproject commit ac4181aea403d888e63cb527c700e80013c68ea8 Subproject commit 9174d8f8cb584744dd7a53f69d324f490ee82ee3

View file

@ -1237,7 +1237,7 @@ App::get('/v1/projects/:projectId/platforms')
} }
$platforms = $dbForConsole->find('platforms', [ $platforms = $dbForConsole->find('platforms', [
Query::equal('projectId', [$project->getId()]), Query::equal('projectInternalId', [$project->getInternalId()]),
Query::limit(5000), Query::limit(5000),
]); ]);

View file

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