fix permanent rebuilding of vhost configs due to always-true renew check of let's encrypt certificates

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2020-07-25 17:21:52 +02:00
parent 665c87cca7
commit 0af655f106

View File

@@ -62,7 +62,7 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron
$issue_froxlor = self::issueFroxlorVhost();
$issue_domains = self::issueDomains();
$renew_froxlor = self::renewFroxlorVhost();
$renew_domains = self::renewDomains();
$renew_domains = self::renewDomains(true);
if ($issue_froxlor || $issue_domains || $renew_froxlor || $renew_domains) {
// insert task to generate certificates and vhost-configs
\Froxlor\System\Cronjob::inserttask(1);
@@ -409,7 +409,7 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron
/**
* get a list of domains that have a lets encrypt certificate (possible renew)
*/
private static function renewDomains()
private static function renewDomains($check = false)
{
$certificates_stmt = Database::query("
SELECT
@@ -437,6 +437,13 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron
");
$renew_certs = $certificates_stmt->fetchAll(\PDO::FETCH_ASSOC);
if ($renew_certs) {
if ($check) {
foreach ($renew_certs as $cert) {
if (self::checkFsFilesAreNewer($cert['domain'], $cert['expirationdate'])) {
return true;
}
}
}
return $renew_certs;
}
return array();