From c28faf1644d962e76ceea77ff42e98b6533ab52d Mon Sep 17 00:00:00 2001
From: Jesse Norell <jesse@kci.net>
Date: Mon, 28 Sep 2020 18:31:15 -0600
Subject: [PATCH] hide unneeded Certificate exists message.  closes #5757

---
 install/install.php | 16 ++++++++++------
 install/update.php  | 16 ++++++++++------
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/install/install.php b/install/install.php
index a894ed45b4..8667a9d3bb 100644
--- a/install/install.php
+++ b/install/install.php
@@ -545,6 +545,7 @@ if($conf['apache']['installed'] == true) {
 }
 
 //** Configure ISPConfig :-)
+$issue_asked = false;
 $issue_tried = false;
 $install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == 'y')?'n':'y';
 if($install_mode == 'standard' || strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default,'install_ispconfig_web_interface')) == 'y') {
@@ -574,6 +575,7 @@ if($install_mode == 'standard' || strtolower($inst->simple_query('Install ISPCon
 		$inst->make_ispconfig_ssl_cert();
 		$issue_tried = true;
 	}
+	$issue_asked = true;
 	$inst->install_ispconfig_interface = true;
 
 } else {
@@ -581,12 +583,14 @@ if($install_mode == 'standard' || strtolower($inst->simple_query('Install ISPCon
 }
 
 // Create SSL certs for non-webserver(s)?
-if(!file_exists('/usr/local/ispconfig/interface/ssl/ispserver.crt')) {
-    if(!$issue_tried && strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y','create_ssl_server_certs')) == 'y') {
-        $inst->make_ispconfig_ssl_cert();
-	}
-} else {
-	swriteln('Certificate exists. Not creating a new one.');
+if(!$issue_asked) {
+    if(!file_exists('/usr/local/ispconfig/interface/ssl/ispserver.crt')) {
+        if(!$issue_tried && strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y','create_ssl_server_certs')) == 'y') {
+            $inst->make_ispconfig_ssl_cert();
+	    }
+    } else {
+        swriteln('Certificate exists. Not creating a new one.');
+    }
 }
 
 if($conf['services']['web'] == true) {
diff --git a/install/update.php b/install/update.php
index 94fca6b101..1e81ac268c 100644
--- a/install/update.php
+++ b/install/update.php
@@ -519,6 +519,7 @@ if($reconfigure_services_answer == 'yes' || $reconfigure_services_answer == 'sel
 //** Configure ISPConfig
 swriteln('Updating ISPConfig');
 
+$issue_asked = false;
 $issue_tried = false;
 // create acme vhost
 if($conf['nginx']['installed'] == true) {
@@ -544,15 +545,18 @@ if ($inst->install_ispconfig_interface) {
 		$inst->make_ispconfig_ssl_cert();
 		$issue_tried = true;
 	}
+	$issue_asked = true;
 }
 
 // Create SSL certs for non-webserver(s)?
-if(!file_exists('/usr/local/ispconfig/interface/ssl/ispserver.crt')) {
-    if(!$issue_tried && strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y','create_ssl_server_certs')) == 'y') {
-        $inst->make_ispconfig_ssl_cert();
-	}
-} else {
-	swriteln('Certificate exists. Not creating a new one.');
+if(!$issue_asked) {
+    if(!file_exists('/usr/local/ispconfig/interface/ssl/ispserver.crt')) {
+        if(!$issue_tried && strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y','create_ssl_server_certs')) == 'y') {
+            $inst->make_ispconfig_ssl_cert();
+	    }
+    } else {
+        swriteln('Certificate exists. Not creating a new one.');
+    }
 }
 
 $inst->install_ispconfig();
-- 
GitLab