Browse Source

more improvements

-Parked sites now will not try install cache plugins.
- PHP-Recode removed from 7.4
- Proxy sites error with ORL host.
Cristhian Martínez Ochoa 5 years ago
parent
commit
485854d224
4 changed files with 25 additions and 11 deletions
  1. 4 0
      lib/general
  2. 5 5
      lib/install
  3. 15 5
      plugins/site
  4. 1 1
      plugins/stack

+ 4 - 0
lib/general

@@ -345,3 +345,7 @@ is_wp_multisite() {
 is_proxy() {
 is_proxy() {
 	[[ -a /etc/nginx/sites-available/$1 && -n $(sed -n -e '/WebinolyNginxServerStart/,$p' /etc/nginx/sites-available/$1 | grep -F "proxy_pass") ]] && echo "true" || echo "false"
 	[[ -a /etc/nginx/sites-available/$1 && -n $(sed -n -e '/WebinolyNginxServerStart/,$p' /etc/nginx/sites-available/$1 | grep -F "proxy_pass") ]] && echo "true" || echo "false"
 }
 }
+
+is_parked() {
+	[[ -a /etc/nginx/sites-available/$1 && ! -d /var/www/$1 && $(is_proxy $1) == "false" ]] && echo "true" || echo "false"
+}

+ 5 - 5
lib/install

@@ -186,12 +186,12 @@ php_install() {
 		sudo LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
 		sudo LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
 	fi
 	fi
 	pre_install
 	pre_install
-	sudo apt -y install php${ver}-common php${ver}-cli php${ver}-fpm php${ver}-curl php${ver}-gd php${ver}-imap php${ver}-readline php${ver}-recode php${ver}-mysql php${ver}-mbstring php${ver}-bcmath php${ver}-mysql php${ver}-opcache php${ver}-zip php${ver}-xml php${ver}-soap php-imagick graphviz php-pear php-msgpack
+	sudo apt -y install php${ver}-common php${ver}-cli php${ver}-fpm php${ver}-curl php${ver}-gd php${ver}-imap php${ver}-readline php${ver}-mysql php${ver}-mbstring php${ver}-bcmath php${ver}-mysql php${ver}-opcache php${ver}-zip php${ver}-xml php${ver}-soap php-imagick graphviz php-pear php-msgpack
 	
 	
-	if [[ -n $ver && $ver == "7.1" ]]; then
-		# mcrypt deprecated in 7.2
-		sudo apt -y install php${ver}-mcrypt
-	fi
+	# mcrypt deprecated in 7.2
+	[[ $ver == "7.1" ]] && sudo apt -y install php${ver}-mcrypt
+	# recode still not available in 7.4
+	[[ $ver != "7.4" ]] && sudo apt -y install php${ver}-recode
 	
 	
 	def=$(conf_read php-ver)
 	def=$(conf_read php-ver)
 	if [[ $(conf_read php-v${def}) != "true" ]]; then
 	if [[ $(conf_read php-v${def}) != "true" ]]; then

+ 15 - 5
plugins/site

@@ -394,10 +394,20 @@ elif [[ -n $proxy && -n $domain ]]; then
 		firstchar=$(echo "${proxy}" | cut -c-1)
 		firstchar=$(echo "${proxy}" | cut -c-1)
 		lastchar=$(echo "${proxy}" | rev | cut -c-1)
 		lastchar=$(echo "${proxy}" | rev | cut -c-1)
 		proxydata=${proxy:1:-1}
 		proxydata=${proxy:1:-1}
-		rphost=$(echo "${proxydata}" | cut -d':' -f 1 -s)
-		rpport=$(echo "${proxydata}" | cut -d':' -f 2 -s)
 		
 		
-		if ! [[ -n $proxydata && $firstchar == "[" && $lastchar == "]" && -n $rphost && -n $rpport && $rpport =~ ^[0-9]+$ && $rpport -ge 0 && $rpport -le 65535 ]]; then
+		rpport=$(echo "${proxydata}" | rev | cut -d':' -f 1 -s | rev)
+		if [[ $rpport =~ ^[0-9]+$ && $rpport -ge 0 && $rpport -le 65535 ]]; then
+			rphost=$(echo "${proxydata}" | rev | cut -d':' -f 2- -s | rev)
+		elif [[ $rpport =~ ^[0-9]+$ ]]; then
+			echo "${red}[ERROR] Please, enter a valid port number!${end}"
+			exit 1
+		else
+			rphost=$proxydata
+			rpport=""
+		fi
+		
+		
+		if ! [[ -n $proxydata && $firstchar == "[" && $lastchar == "]" && -n $rphost ]]; then
 			echo "${red}[ERROR] Please, enter a valid host and port!${end}"
 			echo "${red}[ERROR] Please, enter a valid host and port!${end}"
 			exit 1
 			exit 1
 		fi
 		fi
@@ -415,7 +425,7 @@ elif [[ -n $proxy && -n $domain ]]; then
 		
 		
 	echo "${gre}"
 	echo "${gre}"
 	if [[ -n $rphost ]]; then
 	if [[ -n $rphost ]]; then
-		sudo sed -i "s/localhost/$rphost/g"  /etc/nginx/sites-available/$domain
+		sudo sed -i "s#localhost#$rphost#g"  /etc/nginx/sites-available/$domain
 		echo " Custom host found: $rphost"
 		echo " Custom host found: $rphost"
 	else
 	else
 		echo " Default host: localhost"
 		echo " Default host: localhost"
@@ -553,7 +563,7 @@ elif [[ -n $cache ]]; then
 		if [[ ( -z $subfolder && $(is_php $domain) == "true" && $(is_wp $domain) == "true" ) || ( -n $subfolder && $(is_wp $domain $subfolder) == "true" && $(is_wp_cache $domain $subfolder) == "false" ) ]]; then
 		if [[ ( -z $subfolder && $(is_php $domain) == "true" && $(is_wp $domain) == "true" ) || ( -n $subfolder && $(is_wp $domain $subfolder) == "true" && $(is_wp_cache $domain $subfolder) == "false" ) ]]; then
 			[[ -z $subfolder ]] && sudo sed -i '/php.conf/c \	include common/wpfc.conf;' /etc/nginx/sites-available/$domain
 			[[ -z $subfolder ]] && sudo sed -i '/php.conf/c \	include common/wpfc.conf;' /etc/nginx/sites-available/$domain
 			[[ -n $subfolder ]] && sudo sed -i "/$domain$subname-php.conf;/c \	include apps.d/$domain$subname-wpfc.conf;" /etc/nginx/sites-available/$domain
 			[[ -n $subfolder ]] && sudo sed -i "/$domain$subname-php.conf;/c \	include apps.d/$domain$subname-wpfc.conf;" /etc/nginx/sites-available/$domain
-			if [[ ! -d /var/www/$domain/htdocs$subfolder/wp-content/plugins/nginx-helper || ! -d /var/www/$domain/htdocs$subfolder/wp-content/plugins/redis-cache ]]; then
+			if [[ $(is_parked $domain) == "false" && ( ! -d /var/www/$domain/htdocs$subfolder/wp-content/plugins/nginx-helper || ! -d /var/www/$domain/htdocs$subfolder/wp-content/plugins/redis-cache ) ]]; then
 				echo "${gre}"
 				echo "${gre}"
 				echo "We recommend Nginx Helper Plugin and Redis Object Cache Plugin as an easy way to manage FastCGI and Redis Cache on your WordPress site."
 				echo "We recommend Nginx Helper Plugin and Redis Object Cache Plugin as an easy way to manage FastCGI and Redis Cache on your WordPress site."
 				echo "${blu}Do you want to install it now [Y/n]? ${end}"
 				echo "${blu}Do you want to install it now [Y/n]? ${end}"

+ 1 - 1
plugins/stack

@@ -121,7 +121,7 @@ elif [[ -n $purge && -n $php ]]; then
 	if [[ $answer == [Yy] || $(conf_read force-flag) == "true" ]]; then
 	if [[ $answer == [Yy] || $(conf_read force-flag) == "true" ]]; then
 		[[ $(conf_read mysql-tool) == "true" ]] && stack -pma -purge=force
 		[[ $(conf_read mysql-tool) == "true" ]] && stack -pma -purge=force
 		sudo service php*-fpm stop
 		sudo service php*-fpm stop
-		sudo apt -y purge php*-fpm php*-curl php*-gd php*-imap php*-mcrypt php*-readline php*-common php*-recode php*-mysql php*-cli php*-mbstring php*-bcmath php*-mysql php*-opcache php*-zip php*-xml php*-soap php-imagick graphviz php-pear php-xdebug php-msgpack
+		sudo apt -y purge php*-fpm php*-curl php*-gd php*-imap php*-mcrypt php*-readline php*-common php*-recode php*-mysql php*-cli php*-mbstring php*-bcmath php*-mysql php*-opcache php*-zip php*-xml php*-soap php-imagick graphviz php-pear php-msgpack
 		sudo apt -y purge php-memcached php-memcache memcached
 		sudo apt -y purge php-memcached php-memcache memcached
 		sudo apt -y purge redis-server php-redis postfix
 		sudo apt -y purge redis-server php-redis postfix
 		echo | sudo add-apt-repository --remove 'ppa:ondrej/php'
 		echo | sudo add-apt-repository --remove 'ppa:ondrej/php'