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]); - } }