legacy syntax removed
Removed support for legacy syntax.
This commit is contained in:
parent
cf00bc3518
commit
6f01171709
3 changed files with 61 additions and 61 deletions
|
@ -56,10 +56,10 @@ elif [[ -n $delete ]]; then
|
|||
echo "${gre}User '$userpurge has been deleted successfully!${end}"
|
||||
|
||||
|
||||
elif [[ -n $wp_admin_on || -n $wp_admin_off || -n $wp_admin ]]; then
|
||||
elif [[ -n $wp_admin ]]; then
|
||||
api-events_update ha3
|
||||
[[ $(conf_read nginx) == "true" ]] && iswpadon=$( grep -F "acl.conf;" /etc/nginx/common/wpcommon.conf )
|
||||
if [[ -n $wp_admin_on || $wp_admin == "on" ]]; then
|
||||
if [[ $wp_admin == "on" ]]; then
|
||||
if [[ -z $iswpadon ]]; then
|
||||
if [[ $(conf_read nginx) == "true" ]]; then
|
||||
sudo sed -i "/\/wp-login\.php/a \include common/acl.conf;" /etc/nginx/common/wpcommon.conf
|
||||
|
@ -72,7 +72,7 @@ elif [[ -n $wp_admin_on || -n $wp_admin_off || -n $wp_admin ]]; then
|
|||
echo "${gre}HTTP Authentication for WP Admin pages is already enabled! ${end}"
|
||||
fi
|
||||
|
||||
elif [[ -n $wp_admin_off || $wp_admin == "off" ]]; then
|
||||
elif [[ $wp_admin == "off" ]]; then
|
||||
if [[ -n $iswpadon || ( -z $iswpadon && $(conf_read nginx) != "true" ) ]]; then
|
||||
if [[ $(conf_read nginx) == "true" ]]; then
|
||||
sudo sed -i "/acl.conf/d" /etc/nginx/common/wpcommon.conf
|
||||
|
@ -84,7 +84,7 @@ elif [[ -n $wp_admin_on || -n $wp_admin_off || -n $wp_admin ]]; then
|
|||
echo "${gre}HTTP Authentication for WP Admin pages is already disabled! ${end}"
|
||||
fi
|
||||
else
|
||||
echo "${red}[ERROR] Invalid option! ${end}"
|
||||
echo "${red}[ERROR] Invalid value for wp-admin! ${end}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
100
plugins/site
100
plugins/site
|
@ -333,14 +333,11 @@ elif [[ -n $delete && -a /etc/nginx/sites-available/$domain ]]; then
|
|||
|
||||
|
||||
# SSL (Letsencrypt)
|
||||
elif [[ $ssl == "renew" && -z $domain ]]; then
|
||||
# Post-Hook removed because we always restart nginx at the end of site command
|
||||
sudo certbot renew
|
||||
elif [[ ( -n $ssl_off || $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}"
|
||||
ssl_revoke
|
||||
elif [[ ( -n $ssl_on || -n $ssl_off || -n $ssl ) && -a /etc/nginx/sites-available/$domain ]]; then
|
||||
if [[ -n $ssl_on || $ssl == "on" || $ssl == "force-renewal" ]]; then
|
||||
elif [[ -n $ssl ]]; then
|
||||
if [[ $ssl == "renew" && -z $domain ]]; then
|
||||
# Post-Hook removed because we always restart nginx at the end of site command
|
||||
sudo certbot renew
|
||||
elif [[ ( $ssl == "on" || $ssl == "force-renewal" ) && -a /etc/nginx/sites-available/$domain ]]; then
|
||||
api-events_update si10
|
||||
if [[ $(is_ssl $domain) == "true" && $ssl != "force-renewal" ]]; then
|
||||
echo "${gre}SSL is already enabled for your site -${blu} $domain ${end}"
|
||||
|
@ -376,57 +373,62 @@ elif [[ ( -n $ssl_on || -n $ssl_off || -n $ssl ) && -a /etc/nginx/sites-availabl
|
|||
else
|
||||
site_ssl_on
|
||||
fi
|
||||
elif [[ -n $ssl_off || $ssl =~ ^(off|off-force)$ ]]; then
|
||||
elif [[ $ssl == "off" && -a /etc/nginx/sites-available/$domain ]]; then
|
||||
api-events_update si11
|
||||
[[ $(is_ssl $domain) == "true" ]] && site_ssl_off || echo "${gre}SSL is already disabled for your site${blu} $domain ${end}"
|
||||
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}"
|
||||
ssl_revoke
|
||||
else
|
||||
echo "${red}[ERROR] Invalid option for SSL command! ${end}"
|
||||
echo "${red}[ERROR] Invalid value for SSL command! ${end}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# FastCGI Cache disabled
|
||||
elif [[ ( -n $nocache || ( -n $cache && $cache == "off" )) && -a /etc/nginx/sites-available/$domain ]]; then
|
||||
api-events_update si9
|
||||
if [[ $(is_wp_cache $domain) == "true" ]]; then
|
||||
sudo sed -i '/wpfc.conf/c \ include common/php.conf;' /etc/nginx/sites-available/$domain
|
||||
echo "${gre}FastCGI Cache in${blu} $domain ${gre}has been disabled!${end}"
|
||||
else
|
||||
if [[ $(is_wp $domain) == "false" ]]; then
|
||||
echo "${red}[ERROR] Site${blu} $domain ${red}is not a WP site!${end}"
|
||||
exit 1
|
||||
# FastCGI Cache
|
||||
elif [[ -n $cache ]]; then
|
||||
if [[ $cache == "off" && -a /etc/nginx/sites-available/$domain ]]; then
|
||||
api-events_update si9
|
||||
if [[ $(is_wp_cache $domain) == "true" ]]; then
|
||||
sudo sed -i '/wpfc.conf/c \ include common/php.conf;' /etc/nginx/sites-available/$domain
|
||||
echo "${gre}FastCGI Cache in${blu} $domain ${gre}has been disabled!${end}"
|
||||
else
|
||||
echo "${gre}FastCGI Cache is already disabled on your site${blu} $domain${end}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# FastCGI Cache enabled
|
||||
elif [[ ( -n $cache || $cache == "on" ) && -a /etc/nginx/sites-available/$domain ]]; then
|
||||
api-events_update si8
|
||||
if [[ $(is_php $domain) == "true" && $(is_wp $domain) == "true" ]]; then
|
||||
sudo sed -i '/php.conf/c \ include common/wpfc.conf;' /etc/nginx/sites-available/$domain
|
||||
if [[ ! -d /var/www/$domain/htdocs/wp-content/plugins/nginx-helper || ! -d /var/www/$domain/htdocs/wp-content/plugins/redis-cache ]]; then
|
||||
if [[ $(is_wp $domain) == "false" ]]; then
|
||||
echo "${red}[ERROR] Site${blu} $domain ${red}is not a WP site!${end}"
|
||||
exit 1
|
||||
else
|
||||
echo "${gre}FastCGI Cache is already disabled on your site${blu} $domain${end}"
|
||||
fi
|
||||
fi
|
||||
elif [[ $cache == "on" && -a /etc/nginx/sites-available/$domain ]]; then
|
||||
api-events_update si8
|
||||
if [[ $(is_php $domain) == "true" && $(is_wp $domain) == "true" ]]; then
|
||||
sudo sed -i '/php.conf/c \ include common/wpfc.conf;' /etc/nginx/sites-available/$domain
|
||||
if [[ ! -d /var/www/$domain/htdocs/wp-content/plugins/nginx-helper || ! -d /var/www/$domain/htdocs/wp-content/plugins/redis-cache ]]; then
|
||||
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 "${blu}Do you want to install it now [Y/n]? ${end}"
|
||||
while read -r -n 1 -s answer; do
|
||||
answer=${answer:-y}
|
||||
if [[ $answer = [YyNn] ]]; then
|
||||
[[ $answer = [Yy] ]] && wp_cache_plugins
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
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 "${blu}Do you want to install it now [Y/n]? ${end}"
|
||||
while read -r -n 1 -s answer; do
|
||||
answer=${answer:-y}
|
||||
if [[ $answer = [YyNn] ]]; then
|
||||
[[ $answer = [Yy] ]] && wp_cache_plugins
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
echo "${gre}"
|
||||
echo "FastCGI Cache in${blu} $domain ${gre}has been successfully enabled! "
|
||||
echo "${end}"
|
||||
else
|
||||
if [[ $(is_wp $domain) == "false" ]]; then
|
||||
echo "${red}[ERROR] Site${blu} $domain ${red}is not a WP site!${end}"
|
||||
exit 1
|
||||
echo "FastCGI Cache in${blu} $domain ${gre}has been successfully enabled! "
|
||||
echo "${end}"
|
||||
else
|
||||
echo "${gre}FastCGI Cache is already enabled on your site${blu} $domain${end}"
|
||||
if [[ $(is_wp $domain) == "false" ]]; then
|
||||
echo "${red}[ERROR] Site${blu} $domain ${red}is not a WP site!${end}"
|
||||
exit 1
|
||||
else
|
||||
echo "${gre}FastCGI Cache is already enabled on your site${blu} $domain${end}"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "${red}[ERROR] Invalid value for cache! ${end}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
@ -162,14 +162,9 @@ elif [[ -n $tools_site ]]; then
|
|||
fi
|
||||
|
||||
|
||||
elif [[ -n $login_www_data || -n $nologin_www_data ]]; then
|
||||
elif [[ -n $login_www_data ]]; then
|
||||
check_for_nginx -ask
|
||||
if [[ -n $login_www_data && ! $login_www_data =~ ^(on|off|true)$ ]]; then
|
||||
echo "${red}[ERROR] Invalid option! ${end}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $login_www_data == true || $login_www_data == "on" ]]; then
|
||||
if [[ $login_www_data == "on" ]]; then
|
||||
if [[ $(conf_read login-www-data) == "true" ]]; then
|
||||
echo "${gre}SFTP access for www-data user is already enabled! ${end}"
|
||||
exit 0
|
||||
|
@ -205,7 +200,7 @@ ForceCommand internal-sftp
|
|||
sudo service ssh restart
|
||||
echo "${gre}SFTP access for www-data user has been successfuly enabled! ${end}"
|
||||
|
||||
elif [[ $nologin_www_data == true || $login_www_data == "off" ]]; then
|
||||
elif [[ $login_www_data == "off" ]]; then
|
||||
if [[ $(conf_read login-www-data) != "true" ]]; then
|
||||
echo "${gre}SFTP access for www-data user is already disabled! ${end}"
|
||||
exit 0
|
||||
|
@ -229,6 +224,9 @@ ForceCommand internal-sftp
|
|||
conf_write login-www-data purged
|
||||
sudo service ssh restart
|
||||
echo "${gre}SFTP access for www-data user has been successfuly disabled! ${end}"
|
||||
else
|
||||
echo "${red}[ERROR] Invalid value for login-www-data! ${end}"
|
||||
exit 1
|
||||
fi
|
||||
nginx_not="true" # Nginx-Reload not-needed.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue