1
0
Fork 0
mirror of synced 2024-09-28 07:21:35 +12:00

add certificates to deletion worker

This commit is contained in:
Torsten Dittmann 2021-02-05 10:05:26 +01:00
parent fbc5994697
commit 9e9fb6414d

View file

@ -52,6 +52,9 @@ class DeletesV1
case Database::SYSTEM_COLLECTION_COLLECTIONS:
$this->deleteDocuments($document, $projectId);
break;
case Database::SYSTEM_COLLECTION_DOMAINS:
$this->deleteCertificates($document);
break;
default:
Console::error('No lazy delete operation available for document of type: '.$document->getCollection());
break;
@ -305,6 +308,18 @@ class DeletesV1
Console::info("Deleted {$count} document by group in " . ($executionEnd - $executionStart) . " seconds");
}
protected function deleteCertificates(Document $document)
{
$domain = $document->getAttribute('domain', null);
$directory = APP_STORAGE_CERTIFICATES . '/' . $domain;
if($domain && is_dir($directory)) {
array_map('unlink', glob("$directory/*.*"));
rmdir($directory);
Console::info("Deleted certificate files for domain {$domain}");
}
}
/**
* @return Database;
*/