diff options
-rw-r--r-- | modules-available/webinterface/hooks/cron.inc.php | 2 | ||||
-rw-r--r-- | modules-available/webinterface/inc/acme.inc.php | 15 |
2 files changed, 14 insertions, 3 deletions
diff --git a/modules-available/webinterface/hooks/cron.inc.php b/modules-available/webinterface/hooks/cron.inc.php index cc30ed05..baedfa4c 100644 --- a/modules-available/webinterface/hooks/cron.inc.php +++ b/modules-available/webinterface/hooks/cron.inc.php @@ -1,5 +1,5 @@ <?php -if (mt_rand(1, 36) === 1 && Property::get(WebInterface::PROP_TYPE) === 'acme') { +if (mt_rand(1, 72) === 1 && Property::get(WebInterface::PROP_TYPE) === 'acme') { Acme::renew(); }
\ No newline at end of file diff --git a/modules-available/webinterface/inc/acme.inc.php b/modules-available/webinterface/inc/acme.inc.php index 446c0e45..3f5e76a0 100644 --- a/modules-available/webinterface/inc/acme.inc.php +++ b/modules-available/webinterface/inc/acme.inc.php @@ -94,13 +94,24 @@ class Acme { if (!Taskmanager::isFinished($task)) return; - if (Taskmanager::isFailed($task)) { + $otherError = false; + if (isset($task['data']['error'])) { + // This should never happen, so make it an error + if (strpos($task['data']['error'], " is not an issued domain, skipping.") !== false) { + $otherError = true; + } + } + if (Taskmanager::isFailed($task) || $otherError) { if (($args['user'] ?? null) === null) { EventLog::warning('Automatic ACME renewal of HTTPS certificate failed', print_r($task, true)); } Property::set(self::PROP_ERROR, $task['data']['error'] ?? 'Unknown error'); } else { - EventLog::info('ACME issue/renewal of HTTPS certificate by ' . ($args['user'] ?? 'automatic cronjob')); + // If the cronjob called us and there is nothing to do, suppress the event log entry + if (($args['user'] ?? null) !== null + || strpos($task['data']['error'] ?? '', 'Skipping. Next renewal time is: ') === false) { + EventLog::info('ACME issue/renewal of HTTPS certificate by ' . ($args['user'] ?? 'automatic cronjob'), print_r($task, true)); + } Property::set(self::PROP_ERROR, false); } } |