Skip to content

Commit

Permalink
after testing
Browse files Browse the repository at this point in the history
Small fixes after testing.
  • Loading branch information
QROkes committed Dec 30, 2019
1 parent 8be5259 commit 8e8e993
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 26 deletions.
18 changes: 5 additions & 13 deletions lib/sites
Original file line number Diff line number Diff line change
Expand Up @@ -722,9 +722,9 @@ force_redirect() {

redirection_manager() {
if [[ -n $list ]]; then
echo "${gre}"
sudo sed -n '/RedirectFrom/{h;d;}; H; /To:/{x;p;}' /etc/nginx/apps.d/a.com-nginx.conf | sed '/# To:/ s/$/\n/' | sed 's/^# //'
echo "${end}"
[[ $list == "raw" ]] && echo "" || echo "${gre}"
sudo sed -n '/RedirectFrom/{h;d;}; H; /To:/{x;p;}' /etc/nginx/apps.d/$domain-nginx.conf | sed '/# To:/ s/$/\n/' | sed 's/^# //'
[[ $list == "raw" ]] && echo "" || echo "${end}"
elif [[ -n $delete ]]; then
echo ""
[[ -z $from ]] && read -p "${blu}Redirect 'from path' to delete: ${end}" from
Expand Down Expand Up @@ -759,7 +759,7 @@ redirection_manager() {
elif ! [[ $from =~ ^\/([A-Za-z0-9_\/\.\-]+)?$ ]]; then
echo "${red}[ERROR] Please, enter a valid from/to redirection path!${end}"
exit 1
elif [[ -n $to ]] && ! [[ $to =~ ^\/([A-Za-z0-9_\/\.\-]+)?$ ]]; then
elif [[ -n $to ]] && ! [[ $to =~ ^[A-Za-z0-9_\/\.\-:]+$ ]]; then
echo "${red}[ERROR] Please, enter a valid from/to redirection path!${end}"
exit 1
fi
Expand Down Expand Up @@ -787,15 +787,7 @@ location $sign$from {
return $http_code $to;
}
# RedirectEnd" >> /etc/nginx/apps.d/$domain-nginx.conf
elif [[ $http_code =~ ^(410|451)$ && -n $to ]]; then
echo "# RedirectFrom: ${code}
# To: $to ($http_code)
location $sign$from {
error_page $http_code $to;
return $http_code;
}
# RedirectEnd" >> /etc/nginx/apps.d/$domain-nginx.conf
elif [[ $http_code =~ ^(410|444|451)$ && -z $to ]]; then
elif [[ $http_code =~ ^(410|444|451)$ ]]; then
echo "# RedirectFrom: ${code}
# To: $to ($http_code)
location $sign$from {
Expand Down
16 changes: 5 additions & 11 deletions plugins/site
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# Site Manager Plugin (Create, delete and de/activate)
# Syntax: site <domain> <option> <argument>
# Options: -html, -php, -mysql, -wp, -wpsubdir, -wpsubdom, -parked, -proxy, -on, -off, -delete, -delete-all, -list, -cache, -ssl, -force-redirect, -yoast-sitemap, -multisite-convert
# Arguments: -cache, -root, -root-path, -subdomain, -ignore-ssl, -wildcard, -raw, -external-db, -revoke, -ssl-crt, -ssl-key, -ssl-ocsp, -subfolder
# Options: -html, -php, -mysql, -wp, -wpsubdir, -wpsubdom, -parked, -proxy, -on, -off, -delete, -delete-all, -list, -cache, -ssl, -force-redirect, -yoast-sitemap, -multisite-convert, -clone-from, -replace-content, -redirection
# Arguments: -cache, -root, -root-path, -subdomain, -ignore-ssl, -wildcard, -raw, -external-db, -revoke, -ssl-crt, -ssl-key, -ssl-ocsp, -subfolder, -from, -to, -http-code

# shopt is necessary for this kind !(html|22222) of patterns
shopt -s extglob
Expand Down Expand Up @@ -677,7 +677,7 @@ elif [[ -n $clone_from ]]; then
sudo sed -i "s/$clone_from/$domain/g" /etc/nginx/sites-available/$domain
fi

[[ $(is_ssl $clone_from) == "true" ]] && site $domain -ssl=off > /dev/null 2>&1
[[ $(is_ssl $clone_from) == "true" ]] && site $domain -ssl=off -revoke=off > /dev/null 2>&1
dom=$(echo $domain$subfolder | sed "s/[^0-9A-Za-z]/_/g")
AUTOGENPASS_WPDB=`pwgen -s -1 16`
wp_dbdata $clone_from
Expand All @@ -694,14 +694,8 @@ UPDATE ${wp_dbpref}options SET option_value='http://${domain}${subfolder}' WHERE
FLUSH PRIVILEGES;
_EOF_
else
site -mysql=[${wp_dburl}:${wp_dbport},$dom,$dom,$AUTOGENPASS_WPDB,$wp_uroot,$wp_proot] > /dev/null 2>&1
mysqldump -u root -p$ROOT_PASS $wp_dbname | mysql -u root -p$ROOT_PASS $dom
sudo mysql --connect-timeout=10 -h "$wp_dburl" -P "$wp_dbport" -u"$wp_uroot" -p"$wp_proot" <<_EOF_
USE $dom;
UPDATE ${wp_dbpref}_options SET option_value='http://${domain}${subfolder}' WHERE option_name='home';
UPDATE ${wp_dbpref}_options SET option_value='http://${domain}${subfolder}' WHERE option_name='siteurl';
FLUSH PRIVILEGES;
_EOF_
echo "${red}[ERROR] Database host is not localhost!${end}"
exit 1
fi

sudo sed -i "/DB_NAME/c \define('DB_NAME', '$dom');" $wpcon
Expand Down
4 changes: 2 additions & 2 deletions plugins/webinoly
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# Webinoly Server Manager Plugin
# Syntax: webinoly <option> <argument>
# Options: -update, -server-reset, -verify, -dbpass, -tools-port, -login-www-data, -config-cache, -uninstall, -info, -external-sources-update, -clear-cache, -version, -blockip, -conf-value_, -yoast-sitemap, -default-site, -tools-site, -mysql-password, -smtp
# Arguments: -raw
# Options: -update, -server-reset, -verify, -dbpass, -tools-port, -login-www-data, -config-cache, -uninstall, -info, -external-sources-update, -clear-cache, -version, -blockip, -conf-value_, -yoast-sitemap, -default-site, -tools-site, -mysql-password, -smtp, -backup, -aws-s3-credentials
# Arguments: -raw, -profile, -list, -bucket, -source, -delete, -run, -restore, -wp, -destination

source /opt/webinoly/lib/webin
source /opt/webinoly/lib/bkp
Expand Down

0 comments on commit 8e8e993

Please sign in to comment.