Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
Fix issue with simlynks in home.
Fix warning message displayed when db created.
Fix clone WP issue when SSL enabled.
Fix new logs for mysql not working on mariadb 10.4.
Fix mariadb not removing repo when purge stack.
  • Loading branch information
QROkes committed Nov 8, 2020
1 parent b113668 commit b2cbd82
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
8 changes: 6 additions & 2 deletions lib/install
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,13 @@ fastcgi_param HTTP_PROXY "";
fastcgi_param HTTP_ACCEPT_ENCODING "";
# WebinolyCustomEnd' >> /etc/nginx/fastcgi_params

# Current original user HOME even with sudo (root) - This script always run with sudo, so $HOME is always /root
# https://askubuntu.com/questions/1186999/how-does-sudo-handle-home-differently-since-19-10
local current_home=$(eval echo ~${SUDO_USER:-${USER}})

# Create Direct Access for easy navigation
[ -L $HOME/sites-available ] || ln -s /etc/nginx/sites-available $HOME
[ -L $HOME/www ] || ln -s /var/www $HOME
[ -L $current_home/sites-available ] || ln -s /etc/nginx/sites-available $current_home
[ -L $current_home/www ] || ln -s /var/www $current_home

# www-data sftp default uploads permissions 755 and 644, instead of 775 and 664.
sudo sed -i '/USERGROUPS_ENAB/c \USERGROUPS_ENAB no' /etc/login.defs
Expand Down
14 changes: 8 additions & 6 deletions lib/sites
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ warning_messages() {
if [[ $type == [123] && $(conf_read wp-admin-auth) != "purged" && ! -s /etc/nginx/.htpasswd && ! -s /etc/nginx/apps.d/.htpasswd-$domain ]]; then
echo "${dim}[WARNING] HTTP Authentication Credentials not found and you may need it to complete the WordPress installation process!!${end}"
fi
if [[ $(conf_read login-www-data) != "true" && -z $forward && -z $proxy && -z $parked ]]; then
if [[ $(conf_read login-www-data) != "true" && (( -z $forward && -z $proxy && -z $parked && -z $mysql ) || ( -n $mysql && -n $domain )) ]]; then
echo "${dim}[WARNING] Login for www-data is not enabled and you may need it to upload your site files!${end}"
fi
warning_mes="true"
Expand Down Expand Up @@ -1313,16 +1313,12 @@ clone_wp_site() {
sudo ln -s /etc/nginx/sites-available/$domain /etc/nginx/sites-enabled/$domain
sudo sed -i "s/$clone_from/$domain/g" /etc/nginx/sites-available/$domain

# Remove custom settings from cloned site
sudo site $domain -subdomain=false -force-redirect=off > /dev/null 2>&1
[[ $(is_ssl $clone_from) == "true" ]] && revoke="off" && site_ssl_off > /dev/null 2>&1
[[ $(conf_read default-site) == $clone_from ]] && remove_nginx_default_server $domain

# Fix server_name according to new domain/site.
[[ $subdomain == "true" ]] && local sername="server_name $domain;" || local sername="server_name $domain www.$domain;"
sudo sed -i "/server_name /c \ $sername" /etc/nginx/sites-available/$domain

# Clone Subfolder conf files from apps.d
conf_write nginx-reload false
for appfile in /etc/nginx/apps.d/$clone_from*.conf
do
if [[ -s $appfile ]]; then
Expand Down Expand Up @@ -1367,6 +1363,12 @@ clone_wp_site() {
edit_wp_db_url $domain "http://${domain}${subfolder}" $subfolder
fi

# Remove custom settings from cloned site
sudo site $domain -subdomain=false -force-redirect=off > /dev/null 2>&1
[[ $(is_ssl $clone_from) == "true" ]] && revoke="off" && site_ssl_off > /dev/null 2>&1
[[ $(conf_read default-site) == $clone_from ]] && remove_nginx_default_server $domain
conf_delete nginx-reload

if [[ $replace_content != "off" ]]; then
replace_content="[http://$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
Expand Down
3 changes: 1 addition & 2 deletions plugins/log
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ cnf_delete() {
}
cnf_write() {
#Example: cnf_write error_log /var/log/mysql/error.log
mysql_default_cnf
cnf_delete $1
[[ -n $2 ]] && local value="= $2"
echo "$1 $value" >> /etc/mysql/mariadb.conf.d/90-webinoly.cnf
Expand Down Expand Up @@ -118,7 +117,7 @@ elif [[ -n $ssh ]]; then

# MySQL Logs
elif [[ -n $mysql ]]; then
check_for_mysql
check_for_mysql && mysql_default_cnf

# General Log
if [[ $mysql == "general" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion plugins/site
Original file line number Diff line number Diff line change
Expand Up @@ -469,5 +469,5 @@ else
fi

shopt -u extglob
[[ $(conf_read nginx) == "true" && -z $nginx_not ]] && sudo service nginx reload
[[ $(conf_read nginx) == "true" && -z $nginx_not && $(conf_read nginx-reload) != "false" ]] && sudo service nginx reload
api-events_update sie
7 changes: 5 additions & 2 deletions plugins/stack
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ if [[ -n $purge && ( -n $html || -n $nginx ) ]]; then
sudo sed -i '/certbot renew/d' /var/spool/cron/crontabs/root
fi
sudo apt -y autoremove
sudo rm $HOME/www
sudo rm $HOME/sites-available

current_home=$(eval echo ~${SUDO_USER:-${USER}})
[ -L $current_home/www ] && sudo rm $current_home/www
[ -L $current_home/sites-available ] && sudo rm $current_home/sites-available

# Remove sources
sudo rm -rf /opt/webinoly/templates/source/default
Expand Down Expand Up @@ -228,6 +230,7 @@ elif [[ -n $purge && -n $mysql ]]; then
sudo apt -y purge mariadb-server mariadb-common mysql-common
sudo apt -y purge debconf-utils
purge_mysql_client
sudo add-apt-repository --remove "http://mirrors.syringanetworks.net/mariadb/repo/${mysqlver}/ubuntu"
sudo apt -y autoremove

if [[ $mysql != "keep-data" ]]; then
Expand Down

0 comments on commit b2cbd82

Please sign in to comment.