mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Handle deleting functions with new db
This commit is contained in:
+26
-1
@@ -50,7 +50,7 @@ class DeletesV1 extends Worker
|
||||
$this->deleteProject($document);
|
||||
break;
|
||||
case Database::SYSTEM_COLLECTION_FUNCTIONS:
|
||||
$this->deleteFunction($document, $projectId);
|
||||
$this->deleteFunction2($document, $projectId);
|
||||
break;
|
||||
case Database::SYSTEM_COLLECTION_USERS:
|
||||
$this->deleteUser2($document, $projectId);
|
||||
@@ -265,6 +265,31 @@ class DeletesV1 extends Worker
|
||||
], $projectDB);
|
||||
}
|
||||
|
||||
// TODO@kodumbeats typehint Utopia\Database\Document $document
|
||||
protected function deleteFunction2($document, $projectId)
|
||||
{
|
||||
$dbForInternal = $this->getInternalDB($projectId);
|
||||
$device = new Local(APP_STORAGE_FUNCTIONS.'/app-'.$projectId);
|
||||
|
||||
// Delete Tags
|
||||
$this->deleteByGroup2('tags', [
|
||||
new Query('functionId', Query::TYPE_EQUAL, [$document->getId()])
|
||||
], $dbForInternal, function(Document2 $document) use ($device) {
|
||||
|
||||
if ($device->delete($document->getAttribute('path', ''))) {
|
||||
Console::success('Delete code tag: '.$document->getAttribute('path', ''));
|
||||
}
|
||||
else {
|
||||
Console::error('Failed to delete code tag: '.$document->getAttribute('path', ''));
|
||||
}
|
||||
});
|
||||
|
||||
// Delete Executions
|
||||
$this->deleteByGroup2('executions', [
|
||||
new Query('functionId', Query::TYPE_EQUAL, [$document->getId()])
|
||||
], $dbForInternal);
|
||||
}
|
||||
|
||||
protected function deleteById(Document $document, Database $database, callable $callback = null): bool
|
||||
{
|
||||
Authorization::disable();
|
||||
|
||||
Reference in New Issue
Block a user