From 3fa06153b2548703cb1dd04858b5c5123fe93e23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Mart=C3=ADnez=20Ochoa?= Date: Fri, 12 Nov 2021 11:03:13 -0700 Subject: [PATCH] minor improvs Minor final improvements. --- lib/bkp | 7 +++---- lib/general | 2 ++ lib/install | 2 +- lib/sites | 14 +++++++++----- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/bkp b/lib/bkp index 6cc1602..4f246f3 100644 --- a/lib/bkp +++ b/lib/bkp @@ -505,7 +505,7 @@ check_exported_conf() { fi if tar -tvf $file --absolute-names | grep -oq "/opt/webinoly/templates/source/pph_webinoly.data"; then tar -C / -xf $file /opt/webinoly/templates/source/pph_webinoly.data --absolute-names - sudo webinoly -header-permission-policy=on + sudo webinoly -header-permissions-policy=on fi if tar -tvf $file --absolute-names | grep -oq "/opt/webinoly/templates/source/cch_webinoly.data"; then tar -C / -xf $file /opt/webinoly/templates/source/cch_webinoly.data --absolute-names @@ -712,7 +712,7 @@ export_site() { fi # Check if site contains WP in subfolders and include these db's. - for sit in "/etc/nginx/apps.d/$siteto_"*-wpcommon.conf + for sit in "/etc/nginx/apps.d/${siteto}_"*-wpcommon.conf do local suby="/$(echo $sit | cut -f 2- -d "_" -s | cut -f -1 -d "-" -s | sed "s/_/\//g")" if [[ -n $suby && -f /var/www/$siteto/htdocs$suby/wp-config.php ]]; then @@ -824,8 +824,7 @@ import_site() { # Remove old configurations remove_nginx_default_server $domain - source /opt/webinoly/lib/site-ssl - [[ $(is_ssl $domain) == "true" ]] && revoke="off" && site_ssl_off > /dev/null 2>&1 + [[ $(is_ssl $domain) == "true" ]] && sudo site $domain -ssl=off -revoke=off > /dev/null 2>&1 if [[ $(conf_read php) != "true" && ( $(is_wp $domain) == "true" || $(is_php $domain) == "true" ) ]]; then diff --git a/lib/general b/lib/general index 900f3fc..421e2ea 100644 --- a/lib/general +++ b/lib/general @@ -1023,9 +1023,11 @@ FLUSH PRIVILEGES; _EOF_ else echo "${red}${dim}[ERROR] WordPress Multisite database cannot be updated!${end}" >&2 + return 1 fi else echo "${red}${dim}[ERROR] WordPress Multisite database cannot be updated!${end}" >&2 + return 1 fi fi } diff --git a/lib/install b/lib/install index 1a8194f..2bbbfca 100644 --- a/lib/install +++ b/lib/install @@ -353,7 +353,7 @@ fastcgi_param HTTP_ACCEPT_ENCODING ""; [[ -n $(conf_read header-referrer) ]] && sudo webinoly -header-referrer=$(conf_read header-referrer) [[ -n $(conf_read header-hsts) ]] && sudo webinoly -header-hsts=$(conf_read header-hsts) [[ -s /opt/webinoly/templates/source/csp_webinoly.data ]] && sudo webinoly -header-csp=on - [[ -s /opt/webinoly/templates/source/pph_webinoly.data ]] && sudo webinoly -header-permission-policy=on + [[ -s /opt/webinoly/templates/source/pph_webinoly.data ]] && sudo webinoly -header-permissions-policy=on [[ -s /opt/webinoly/templates/source/cch_webinoly.data ]] && sudo webinoly -header-cache-control=on [[ -s /opt/webinoly/templates/source/rob_webinoly.data ]] && sudo webinoly -header-robots=on [[ $(conf_read header-xssp) == "false" ]] && sudo webinoly -header-xssp=off diff --git a/lib/sites b/lib/sites index 54fc0ed..1eaae65 100644 --- a/lib/sites +++ b/lib/sites @@ -663,7 +663,7 @@ deletesite_subfolder() { fi sudo rm -rf /var/www/$domain/htdocs$subfolder - echo "${gre}Subfolder${blu} $subfolder ${gre}from${blu} $domain ${gre}has been successfully deleted!${end}" + echo "${gre}Subfolder successfully removed!${end}" } @@ -1192,8 +1192,12 @@ parked_domain() { echo "${red}${dim}[ERROR] Domain Mapping failed because WP blog ID cannot be 1 (main site)! ${end}" elif [[ -n $domain_mapping_wp_id && $domain_mapping_wp_id =~ ^[0-9]+$ && $(is_wp_multisite $parked) =~ ^(subdomain|subdirectory)$ ]]; then edit_wp_db_url_multisite $parked $domain $domain_mapping_wp_id - edit_wp_db_url $domain "http://${domain}" - echo "${gre}${dim}Domain Mapping successfully configured! ${end}" + if [[ $? != 1 ]]; then + edit_wp_db_url $domain "http://${domain}" + echo "${gre}${dim}Domain Mapping successfully configured! ${end}" + else + echo "${red}Domain Mapping configuration failed! ${end}" + fi elif [[ -n $domain_mapping_wp_id && $domain_mapping_wp_id =~ ^[0-9]+$ ]]; then echo "${red}${dim}[ERROR] Domain Mapping failed because main site is not a Multisite Network! ${end}" elif [[ -n $domain_mapping_wp_id ]]; then @@ -1622,7 +1626,7 @@ cloning_site() { # Clone Subfolder conf files from apps.d conf_write nginx-reload false - for appfile in /etc/nginx/apps.d/$clone_from*.conf + for appfile in /etc/nginx/apps.d/${clone_from}*.conf do if [[ -s $appfile ]]; then local newfile=$(echo $appfile | sed "s/$clone_from/$domain/") @@ -1678,7 +1682,7 @@ cloning_site() { # 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 + [[ $(is_ssl $clone_from) == "true" ]] && sudo site $domain -ssl=off -revoke=off -no-db-update > /dev/null 2>&1 [[ $(conf_read default-site) == $clone_from ]] && remove_nginx_default_server $domain conf_delete nginx-reload