From 0af33c51b5a7ee493864b95e0d6ec96b4843b92a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Mart=C3=ADnez=20Ochoa?= Date: Fri, 31 Jul 2020 13:44:59 -0600 Subject: [PATCH] minor fixes Some minor fixes before release. --- lib/general | 11 +++++------ lib/install | 10 +++++++--- lib/sites | 4 ++-- plugins/stack | 2 +- plugins/webinoly | 1 + 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/general b/lib/general index 6734b42..5f31757 100644 --- a/lib/general +++ b/lib/general @@ -1,11 +1,5 @@ #!/bin/bash -# STOP and exit if not root or sudo. -if [[ $(whoami) != "root" ]]; then - echo "${red}Please run this script as root or using sudo.${end}" - exit 1 -fi - # Don't remove dumb re-check! # Prevent 'tput' errors when running from Cron [[ -z $TERM || $TERM == "unknown" || $TERM == "dumb" ]] && export TERM=dumb @@ -25,6 +19,11 @@ readonly bol=`tput bold` readonly dim=`tput dim` +# STOP and exit if not root or sudo. +if [[ $(whoami) != "root" ]]; then + echo "${red}Please run this script as root or using sudo.${end}" + exit 1 +fi # *********************************************** diff --git a/lib/install b/lib/install index 35a5e74..3d433af 100644 --- a/lib/install +++ b/lib/install @@ -152,6 +152,7 @@ nginx_install() { sudo cp -p /etc/nginx/sites-available/default /opt/webinoly/templates/source/ sudo cp -p /etc/nginx/nginx.conf /opt/webinoly/templates/source/ + sudo systemctl enable nginx sudo nginx -t && sudo service nginx start conf_write nginx true echo "${gre}Nginx has been installed successfully! ${end}" @@ -490,7 +491,7 @@ mysql_tool() { sudo chown -R www-data:www-data /var/www/$(conf_read tools-port)/htdocs/pma conf_write mysql-tool true - echo "${gre}PhpMyAdmin has been installed successfully! ${end}" + echo "${gre}phpMyAdmin has been installed successfully! ${end}" else echo "${red}[ERROR] Downloading phpMyAdmin failed!${end}" fi @@ -516,8 +517,11 @@ swap_delete() { swap_create() { + # Need a fresh value here, not use the global var. + local sw=$(($(grep SwapTotal /proc/meminfo | cut -f 2 -d ':' | tr -d ' ' | cut -f 1 -d 'k')/1024000)) + # https://help.ubuntu.com/community/SwapFaq - if [[ -z $swap || $swap == "0" ]]; then + if [[ -z $sw || $sw == "0" ]]; then api-events_update in5 if [[ -n $(conf_read swap-mem) && $(conf_read swap-mem) =~ ^[0-9]+$ ]]; then local newswap=$(conf_read swap-mem) @@ -562,6 +566,6 @@ swap_create() { api-events_update in6 else [[ $(conf_read swap-owner) != "webinoly" ]] && conf_write swap-owner system - echo "${gre}SWAP file (${swap}Gb) detected!${end}" + echo "${gre}SWAP file (${sw}Gb) detected!${end}" fi } diff --git a/lib/sites b/lib/sites index 67c4f48..a5f4cb8 100644 --- a/lib/sites +++ b/lib/sites @@ -1273,10 +1273,10 @@ clone_wp_site() { if [[ $replace_content != "off" ]]; then replace_content="[http://$clone_from,http://$domain]" && wp_replace_content > /dev/null 2>&1 - replace_content="[https://$clone_from,http://$domain]" && wp_replace_content > /dev/null 2>&1 + replace_content="[https://$clone_from,https://$domain]" && wp_replace_content > /dev/null 2>&1 # In case www is forced replace_content="[http://www.$clone_from,http://$domain]" && wp_replace_content > /dev/null 2>&1 - replace_content="[https://www.$clone_from,http://$domain]" && wp_replace_content > /dev/null 2>&1 + replace_content="[https://www.$clone_from,https://$domain]" && wp_replace_content > /dev/null 2>&1 fi echo "${gre}Site ${blu}'$domain$subfolder'${gre} is now a successfull clone of ${blu}'$clone_from$subfolder'${end}" diff --git a/plugins/stack b/plugins/stack index ab6d2b3..0045755 100644 --- a/plugins/stack +++ b/plugins/stack @@ -122,7 +122,7 @@ elif [[ -n $purge && -n $php ]]; then if [[ $answer == [Yy] || $(conf_read force-flag) == "true" ]]; then [[ $(conf_read mysql-tool) == "true" ]] && stack -pma -purge=force sudo service php*-fpm stop - local ver=$(conf_read php-ver) + ver=$(conf_read php-ver) sudo apt -y purge 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 diff --git a/plugins/webinoly b/plugins/webinoly index cb3a6ea..6e3fde7 100644 --- a/plugins/webinoly +++ b/plugins/webinoly @@ -273,6 +273,7 @@ elif [[ -n $header_csp ]]; then elif [[ -n $query_string_cache || -n $query_string_never_cache || -n $skip_cache ]]; then + check_for_nginx custom_cache_global