Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions src/services/OrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,7 @@ public function init()

if ($this->_renew)
{
foreach ($pathMap as $propertyName => $fileName)
{
@unlink($basePath.DIRECTORY_SEPARATOR.$fileName);
}
$this->removeLocalData();
}

is_file($this->_orderInfoPath) ? $this->getOrder() : $this->createOrder();
Expand Down Expand Up @@ -462,6 +459,8 @@ public function revokeCertificate($reason = 0)
throw new OrderException("Revoke certificate failed, the domain list is: ".implode(', ', $this->_domainList).", the code is: {$code}, the header is: {$header}, the body is: ".print_r($body, TRUE));
}

$this->removeLocalData();

return TRUE;
}

Expand Down Expand Up @@ -641,4 +640,24 @@ private function populate($orderInfo)
$this->{$key} = $value;
}
}
}

/**
* Remove local copy of certificate data
* @return boolean
*/
private function removeLocalData()
{
$filesToUnlink = [
$this->_privateKeyPath,
$this->_publicKeyPath,
$this->_csrPath,
$this->_certificatePath,
$this->_certificateFullChainedPath,
$this->_orderInfoPath,
];
foreach ($filesToUnlink as $file)
{
@unlink($file);
}
}
}