From 791b250742a0547189dd2a6bd3465a4f7e922cb9 Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Sat, 4 Jun 2016 20:41:48 +0200 Subject: [PATCH] Show renewals in auto command, fix reference notice, correct exit code for renewed certs --- src/Commands/Auto.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Commands/Auto.php b/src/Commands/Auto.php index e465a9b..233b840 100644 --- a/src/Commands/Auto.php +++ b/src/Commands/Auto.php @@ -114,6 +114,15 @@ class Auto implements Command { "failure" => count($errors), ]; + if ($status["renewed"] > 0) { + foreach ($values as $i => $value) { + if ($value === self::STATUS_RENEWED) { + $certificate = $config["certificates"][$i]; + $this->climate->info("Certificate for " . implode(", ", array_keys($this->toDomainPathMap($certificate["paths"]))) . " successfully renewed."); + } + } + } + if ($status["failure"] > 0) { foreach ($errors as $i => $error) { $certificate = $config["certificates"][$i]; @@ -128,6 +137,11 @@ class Auto implements Command { yield new CoroutineResult($exitCode); return; } + + if ($status["renewed"] > 0) { + yield new CoroutineResult(self::EXIT_ISSUANCE_OK); + return; + } } /** @@ -139,7 +153,8 @@ class Auto implements Command { */ private function checkAndIssue(array $certificate, $server, $storage) { $domainPathMap = $this->toDomainPathMap($certificate["paths"]); - $commonName = reset(array_keys($domainPathMap)); + $domains = array_keys($domainPathMap); + $commonName = reset($domains); $args = [ PHP_BINARY, @@ -175,7 +190,7 @@ class Auto implements Command { "--storage", $storage, "--domains", - implode(",", array_keys($domainPathMap)), + implode(",", $domains), "--path", implode(PATH_SEPARATOR, array_values($domainPathMap)), ];