From b64343012af1efb95c324162e948b33f2657e249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn?= Date: Tue, 1 Sep 2020 14:30:05 +0200 Subject: [PATCH] adding #32 --- app/Factories/NginxVhostFactory.php | 14 +++++++++++++- app/Helpers/NginxVhostHelper.php | 8 +++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/Factories/NginxVhostFactory.php b/app/Factories/NginxVhostFactory.php index 0776c0b..205d0bc 100644 --- a/app/Factories/NginxVhostFactory.php +++ b/app/Factories/NginxVhostFactory.php @@ -134,7 +134,19 @@ class NginxVhostFactory }) ->addLineBreak('-') ->addMenuItem($checkbox) - ->addLineBreak('-') + ->addLineBreak('-'); + + if ($vhost['ssl']) { + if ($vhost['ssl_certificate_exists']) { + $builder->addStaticItem('expired_at: '.$vhost['ssl_certificate_expired_at']); + } else { + $builder->addStaticItem('no certificate'); + } + + $builder->addLineBreak('-'); + } + + $builder ->addItem('Back', new NginxVhostGoBackAction()) ->addItem('Exit', new ExitAction()); diff --git a/app/Helpers/NginxVhostHelper.php b/app/Helpers/NginxVhostHelper.php index cedf38f..be2ab6d 100644 --- a/app/Helpers/NginxVhostHelper.php +++ b/app/Helpers/NginxVhostHelper.php @@ -73,8 +73,11 @@ class NginxVhostHelper $content = file_get_contents($path); // check for path of sites - preg_match(self::REGEX_SSL_CERTIFICATE, $content, $matches); - preg_match(self::REGEX_SSL_CERTIFICATE_KEY, $content, $matches); + preg_match(self::REGEX_SSL_CERTIFICATE, $content, $certificates); + $matches = array_merge([], $certificates); + + preg_match(self::REGEX_SSL_CERTIFICATE_KEY, $content, $certificates); + $matches = array_merge($matches, $certificates); // check ssl certificates if (count($matches) >= 2) { @@ -89,7 +92,6 @@ class NginxVhostHelper if (isset($openssl[1])) { $openssl = str_replace('notAfter=', '', $openssl[1]); - } }