adds certificates to deletes worker
This commit is contained in:
parent
ef29a87f61
commit
f97c87a3e9
|
@ -1585,7 +1585,7 @@ App::delete('/v1/projects/:projectId/domains/:domainId')
|
|||
|
||||
if ($consoleDB->deleteDocument($domain->getId())) {
|
||||
$deletes
|
||||
->setParam('type', DELETE_TYPE_DOCUMENT)
|
||||
->setParam('type', DELETE_TYPE_CERTIFICATES)
|
||||
->setParam('document', $domain)
|
||||
;
|
||||
} else {
|
||||
|
|
|
@ -60,6 +60,7 @@ const DELETE_TYPE_DOCUMENT = 'document';
|
|||
const DELETE_TYPE_EXECUTIONS = 'executions';
|
||||
const DELETE_TYPE_AUDIT = 'audit';
|
||||
const DELETE_TYPE_ABUSE = 'abuse';
|
||||
const DELETE_TYPE_CERTIFICATES = 'certificates';
|
||||
|
||||
$register = new Registry();
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class DeletesV1
|
|||
switch (strval($type)) {
|
||||
case DELETE_TYPE_DOCUMENT:
|
||||
$document = $this->args['document'];
|
||||
$document = new Document($document);
|
||||
$document = new Document($document);
|
||||
switch (strval($document->getCollection())) {
|
||||
case Database::SYSTEM_COLLECTION_PROJECTS:
|
||||
$this->deleteProject($document);
|
||||
|
@ -52,9 +52,6 @@ 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;
|
||||
|
@ -72,6 +69,11 @@ class DeletesV1
|
|||
case DELETE_TYPE_ABUSE:
|
||||
$this->deleteAbuseLogs($this->args['timestamp']);
|
||||
break;
|
||||
|
||||
case DELETE_TYPE_CERTIFICATES:
|
||||
$document = new Document($this->args['document']);
|
||||
$this->deleteCertificates($document);
|
||||
break;
|
||||
|
||||
default:
|
||||
Console::error('No delete operation for type: '.$type);
|
||||
|
@ -310,13 +312,15 @@ class DeletesV1
|
|||
|
||||
protected function deleteCertificates(Document $document)
|
||||
{
|
||||
$domain = $document->getAttribute('domain', null);
|
||||
$domain = $document->getAttribute('domain');
|
||||
$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}");
|
||||
Console::info("Deleted certificate files for {$domain}");
|
||||
} else {
|
||||
Console::info("No certificate files found for {$domain}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue