From f1f22a5c86f199edfcdc6664c49482013bf75742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Mart=C3=ADnez=20Ochoa?= Date: Tue, 29 Oct 2019 20:57:18 -0700 Subject: [PATCH] tools site and port improved PHP purge now removes tools-site. Tools-port check for PHP. --- plugins/stack | 6 ++++++ plugins/webinoly | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/stack b/plugins/stack index 8664a09..d9ba326 100644 --- a/plugins/stack +++ b/plugins/stack @@ -135,6 +135,12 @@ elif [[ -n $purge && -n $php ]]; then sudo rm -rf /opt/webinoly/templates/source/www.conf sudo rm -rf /opt/webinoly/templates/source/main.cf + # Remove tools-site + sudo rm -rf /etc/nginx/sites-available/$(conf_read tools-port) + sudo rm -rf /etc/nginx/sites-enabled/$(conf_read tools-port) + sudo rm -rf /var/www/$(conf_read tools-port) + conf_delete tools-site + conf_write php purged conf_write php-optim purged [[ $(conf_read php-v7.4) == "true" ]] && conf_write php-v7.4 purged diff --git a/plugins/webinoly b/plugins/webinoly index 9abff76..afa2fa5 100644 --- a/plugins/webinoly +++ b/plugins/webinoly @@ -97,12 +97,16 @@ elif [[ -n $dbpass ]]; then elif [[ -n $tools_port ]]; then + check_for_php + oldport="$(conf_read tools-port)" if [[ -a /etc/nginx/sites-available/$tools_port ]]; then echo "${red}[ERROR] Port/site '$tools_port' is already in use!${end}" exit 1 + elif [[ ! -a /etc/nginx/sites-available/$oldport ]]; then + echo "${red}[ERROR] Site '$oldport' not found!${end}" + exit 1 fi - oldport="$(conf_read tools-port)" [[ $tools_port != true ]] && tools_port $tools_port || tools_port newport="$(conf_read tools-port)" if [[ $oldport != $newport && $(conf_read nginx-tool) == "true" && $(conf_read nginx) == "true" ]]; then @@ -171,6 +175,7 @@ elif [[ -n $tools_site ]]; then sudo rm -rf /etc/nginx/sites-available/$(conf_read tools-port) sudo cp /opt/webinoly/templates/nginx/22222 /etc/nginx/sites-available/$(conf_read tools-port) sudo sed -i "s/22222/$(conf_read tools-port)/g" /etc/nginx/sites-available/$(conf_read tools-port) + conf_delete tools-site echo "${gre}Tools Site settings has been reset successfully!${end}" elif [[ -a /etc/nginx/sites-available/$tools_site && ! -a /etc/nginx/sites-available/$(conf_read tools-port) ]]; then echo "${red}[ERROR] Tools Site is not enabled! ${end}"