Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
Some minor fixes before release.
  • Loading branch information
QROkes committed Jul 31, 2020
1 parent 45a0404 commit 0af33c5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
11 changes: 5 additions & 6 deletions lib/general
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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


# ***********************************************
Expand Down
10 changes: 7 additions & 3 deletions lib/install
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions lib/sites
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
2 changes: 1 addition & 1 deletion plugins/stack
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions plugins/webinoly
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 0af33c5

Please sign in to comment.