فهرست منبع

better site check

Now we have an option to check for nginx and php including tools and optim.
Subfolder option now check if subfolder exists.
Cristhian Martínez Ochoa 5 سال پیش
والد
کامیت
5c47e39782
4فایلهای تغییر یافته به همراه21 افزوده شده و 19 حذف شده
  1. 12 0
      lib/general
  2. 1 16
      lib/site-ssl
  3. 7 2
      plugins/site
  4. 1 1
      plugins/webinoly

+ 12 - 0
lib/general

@@ -69,6 +69,12 @@ check_for_nginx() {
 		exit 1
 		exit 1
 	fi
 	fi
 }
 }
+check_for_nginx_tool() {
+	if [[ $(conf_read nginx) != "true"  || $(conf_read nginx-optim) != "true" || $(conf_read nginx-tool) != "true" ]]; then
+		echo "${red}[ERROR] NGINX Tools are required and not found! ${end}"
+		exit 1
+	fi
+}
 check_for_php() {
 check_for_php() {
 	if [[ $(conf_read php) != "true" && $1 == "-ask" ]]; then
 	if [[ $(conf_read php) != "true" && $1 == "-ask" ]]; then
 		echo "${red}"
 		echo "${red}"
@@ -88,6 +94,12 @@ check_for_php() {
 		exit 1
 		exit 1
 	fi
 	fi
 }
 }
+check_for_php_tool() {
+	if [[ $(conf_read php) != "true"  || $(conf_read php-optim) != "true" || $(conf_read php-tool) != "true" ]]; then
+		echo "${red}[ERROR] PHP Tools are required and not found! ${end}"
+		exit 1
+	fi
+}
 check_for_mysql() {
 check_for_mysql() {
 	if [[ $(conf_read mysql) != "true" && $1 == "-ask" ]]; then
 	if [[ $(conf_read mysql) != "true" && $1 == "-ask" ]]; then
 		echo "${red}"
 		echo "${red}"

+ 1 - 16
lib/site-ssl

@@ -52,6 +52,7 @@ site_ssl_on() {
 	local path=$domain
 	local path=$domain
 	
 	
 	# Some validations to prevent errors when creating certs.
 	# Some validations to prevent errors when creating certs.
+	check_for_nginx_tool
 	if [[ -n $root && -a /etc/nginx/sites-available/$root ]]; then
 	if [[ -n $root && -a /etc/nginx/sites-available/$root ]]; then
 		path=$root
 		path=$root
 	elif [[ -n $root && ! -a /etc/nginx/sites-available/$root ]]; then
 	elif [[ -n $root && ! -a /etc/nginx/sites-available/$root ]]; then
@@ -75,22 +76,6 @@ site_ssl_on() {
 		exit 1
 		exit 1
 	fi
 	fi
 	
 	
-	# Check if Letsencrypt is installed
-	if [[ $(conf_read nginx-tool) != "true" || ! -a /usr/bin/letsencrypt ]]; then
-		echo "${red}Seems like Let's Encrypt tool is not installed!"
-		echo "${blu}Do you want to install it now? [y/N]? ${end}"
-		while read -r -n 1 -s answer; do
-			answer=${answer:-n}
-			echo ""
-			[[ $answer = [YyNn] ]] && break
-		done
-		
-		[[ $answer == [Yy] ]] && sudo stack -nginx=force
-		if [[ $(conf_read nginx-tool) != "true" || ! -a /usr/bin/letsencrypt ]]; then
-			echo "${red}[ERROR] Let's Encrypt is required and not found! ${end}"
-			exit 1
-		fi
-	fi
 
 
 	echo "${gre}"
 	echo "${gre}"
 	echo "*************************************************************************************************"
 	echo "*************************************************************************************************"

+ 7 - 2
plugins/site

@@ -110,10 +110,12 @@ fi
 if [[ -n $subfolder && ! ( $subfolder =~ ^\/([A-Za-z0-9_\/\-]+)?[^\/]$ ) ]]; then
 if [[ -n $subfolder && ! ( $subfolder =~ ^\/([A-Za-z0-9_\/\-]+)?[^\/]$ ) ]]; then
 	echo "${red}[ERROR] Please, enter a valid value for subfolder!${end}"
 	echo "${red}[ERROR] Please, enter a valid value for subfolder!${end}"
 	exit 1
 	exit 1
-fi
-if [[ -n $subfolder && $type != [123] && -z $delete && -z $cache && -z $yoast_sitemap && -z $multisite_convert && -z $clone_from && -z $replace_content ]]; then
+elif [[ -n $subfolder && $type != [123] && -z $delete && -z $cache && -z $yoast_sitemap && -z $multisite_convert && -z $clone_from && -z $replace_content ]]; then
 	echo "${red}[ERROR] Subfolder option is only supported for WordPress sites!${end}"
 	echo "${red}[ERROR] Subfolder option is only supported for WordPress sites!${end}"
 	exit 1
 	exit 1
+elif [[ -n $subfolder && ( -n $delete || -n $cache || -n $yoast_sitemap || -n $multisite_convert || -n $clone_from || -n $replace_content ) && ! -d /var/www/$domain/htdocs$subfolder ]]; then
+	echo "${red}[ERROR] Subfolder not found!${end}"
+	exit 1
 else
 else
 	subname=$(echo $subfolder | sed "s/\//_/g")
 	subname=$(echo $subfolder | sed "s/\//_/g")
 fi
 fi
@@ -523,6 +525,9 @@ elif [[ -n $ssl ]]; then
 	elif [[ $ssl == "off" && ! -a /etc/nginx/sites-available/$domain && -a /etc/letsencrypt/live/$domain/cert.pem ]]; then
 	elif [[ $ssl == "off" && ! -a /etc/nginx/sites-available/$domain && -a /etc/letsencrypt/live/$domain/cert.pem ]]; then
 		echo "${red}[WARNING] SSL Orphan-Cert found and will be revoked automatically!${end}"
 		echo "${red}[WARNING] SSL Orphan-Cert found and will be revoked automatically!${end}"
 		ssl_revoke
 		ssl_revoke
+	elif [[ -n $domain && ! -f /etc/nginx/sites-available/$domain ]]; then
+		echo "${red}[ERROR] Domain not found! ${end}"
+		exit 1
 	else
 	else
 		echo "${red}[ERROR] Invalid value for SSL command! ${end}"
 		echo "${red}[ERROR] Invalid value for SSL command! ${end}"
 		exit 1
 		exit 1

+ 1 - 1
plugins/webinoly

@@ -639,7 +639,7 @@ elif [[ -n $smtp ]]; then
 
 
 
 
 elif [[ -n $backup ]]; then
 elif [[ -n $backup ]]; then
-	check_for_nginx
+	check_for_nginx_tool
 	if [[ $backup == "local" ]]; then
 	if [[ $backup == "local" ]]; then
 		bkp_local_db
 		bkp_local_db
 	elif [[ $backup == "s3" && -n $list ]]; then
 	elif [[ $backup == "s3" && -n $list ]]; then