inserttask(1) after updating certificates, updated install/update - SQL

Signed-off-by: Florian Aders <eleras@froxlor.org>
This commit is contained in:
Florian Aders
2016-01-30 15:19:40 +01:00
parent 272ba3f74e
commit dd9e540ca3
3 changed files with 18 additions and 9 deletions

View File

@@ -31,6 +31,7 @@ $upd_stmt = Database::prepare("
UPDATE `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` SET `ssl_cert_file` = :crt, `ssl_key_file` = :key, `ssl_ca_file` = :ca, expirationdate = :expirationdate WHERE `id` = :id
");
$changedetected = 0;
while ($certrow = $certificates_stmt->fetch(PDO::FETCH_ASSOC)) {
// Only renew let's encrypt certificate for domains where a documentroot
@@ -81,6 +82,9 @@ while ($certrow = $certificates_stmt->fetch(PDO::FETCH_ASSOC)) {
'expirationdate' => date('Y-m-d H:i:s', $newcert['validTo_time_t']),
'id' => $certrow['id'])
);
$changedetected = 1;
} catch (\Exception $e) {
fwrite($debugHandler, 'letsencrypt exception: ' . $e->getMessage() . "\n");
}
@@ -88,3 +92,9 @@ while ($certrow = $certificates_stmt->fetch(PDO::FETCH_ASSOC)) {
fwrite($debugHandler, 'letsencrypt skipped because documentroot ' . $certrow['documentroot'] . ' does not exist' . "\n");
}
}
// If we have a change in a certificate, we need to update the webserver - configs
// This is easiest done by just creating a new task ;)
if ($changedetected) {
inserttask(1);
}