small fixes
Error for external-db if no data. WP db creation for external dbs not working. wp-admin not working without domain for global settings. Multisite convert failing with external db.
This commit is contained in:
parent
f797ead841
commit
7465cb0783
4 changed files with 24 additions and 13 deletions
|
@ -152,9 +152,12 @@ wp_dbdata() {
|
|||
wp_uroot=$(echo "${dbdata}" | cut -d',' -f 1 -s)
|
||||
wp_proot=$(echo "${dbdata}" | cut -d',' -f 2 -s)
|
||||
if [[ $(echo "${external_db}" | cut -c-1) != "[" || $(echo "${external_db}" | rev | cut -c-1) != "]" || -z $wp_uroot || -z $wp_proot ]]; then
|
||||
echo "${red}[ERROR] Invalid data for External Database!${end}"
|
||||
echo "${red}[ERROR] Invalid data for External Database!${end}" >&2
|
||||
exit 1
|
||||
fi
|
||||
elif [[ -z $external_db && $wp_dbhost != "localhost" ]]; then
|
||||
echo "${red}[ERROR] External Database found, please use the '-external-db=[user,password]' option!${end}" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -364,8 +364,8 @@ wpinstall() {
|
|||
# We can not use GRAN ALL PRIVILIGES with AWS RDS, that's why are all separate.
|
||||
sudo mysql --connect-timeout=10 -h "$dburl" -P "$dbport" -u"$dburoot" -p"$dbproot" <<_EOF_
|
||||
CREATE DATABASE ${dbname};
|
||||
grant usage on ${dbname}.* to ${dbuser}@\`%\` identified by '${dbpass}';
|
||||
GRANT SELECT,ALTER,UPDATE,INSERT,CREATE,DELETE,DROP,INDEX,REFERENCES on ${dbname}.* to ${dbuser}@\`%\`;
|
||||
CREATE USER '${dbuser}'@'%' IDENTIFIED BY '${dbpass}';
|
||||
GRANT SELECT,ALTER,UPDATE,INSERT,CREATE,DELETE,DROP,INDEX,REFERENCES on ${dbname}.* to '${dbuser}'@'%';
|
||||
FLUSH PRIVILEGES;
|
||||
_EOF_
|
||||
|
||||
|
|
|
@ -90,13 +90,15 @@ elif [[ -n $delete ]]; then
|
|||
|
||||
elif [[ -n $wp_admin ]]; then
|
||||
api-events_update ha3
|
||||
if [[ ( -z $subfolder && $(is_wp $domain) == "false" ) || ( -n $subfolder && $(is_wp $domain $subfolder) == "false" ) ]]; then
|
||||
echo "${red}[ERROR] Site${blu} $domain$subfolder ${red}is not a WP site!${end}"
|
||||
exit 1
|
||||
elif [[ -n $subfolder && $(is_wp $domain $subfolder) == "true" ]]; then
|
||||
iswpadon=$( grep -F "wpcommon.conf;" /etc/nginx/apps.d/$domain$subname-php.conf )
|
||||
else
|
||||
iswpadon=$( grep -F "wpcommon.conf;" /etc/nginx/sites-available/$domain )
|
||||
if [[ -n $domain ]]; then
|
||||
if [[ ( -z $subfolder && $(is_wp $domain) == "false" ) || ( -n $subfolder && $(is_wp $domain $subfolder) == "false" ) ]]; then
|
||||
echo "${red}[ERROR] Site${blu} $domain$subfolder ${red}is not a WP site!${end}"
|
||||
exit 1
|
||||
elif [[ -n $subfolder && $(is_wp $domain $subfolder) == "true" ]]; then
|
||||
iswpadon=$( grep -F "wpcommon.conf;" /etc/nginx/apps.d/$domain$subname-php.conf )
|
||||
else
|
||||
iswpadon=$( grep -F "wpcommon.conf;" /etc/nginx/sites-available/$domain )
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $wp_admin == "on" && -n $domain ]]; then
|
||||
|
|
12
plugins/site
12
plugins/site
|
@ -271,7 +271,13 @@ elif [[ -n $multisite_convert && -a /etc/nginx/sites-available/$domain ]]; then
|
|||
if [[ ( -z $subfolder && $(is_wp $domain) == "false" ) || ( -n $subfolder && $(is_wp $domain $subfolder) == "false" ) ]]; then
|
||||
echo "${red}[ERROR] Site${blu} $domain$subfolder ${red}is not a WP site!${end}"
|
||||
exit 1
|
||||
elif [[ $(is_wp_multisite $domain) =~ ^(subdomain|subdirectory)$ ]]; then
|
||||
fi
|
||||
|
||||
check=$(is_wp_multisite $domain)
|
||||
if ! [[ $check =~ ^(subdomain|subdirectory|false)$ ]]; then
|
||||
echo "${red}[ERROR] Task aborted due to an error!${end}"
|
||||
exit 1
|
||||
elif [[ $check =~ ^(subdomain|subdirectory)$ ]]; then
|
||||
echo "${red}[ERROR] Site${blu} $domain$subfolder ${red}is already in multisite configuration!${end}"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -322,11 +328,11 @@ elif [[ -n $multisite_convert && -a /etc/nginx/sites-available/$domain ]]; then
|
|||
sudo sed -i "/stop editing/i \#define('SUBDOMAIN_INSTALL', false);" $wpcon
|
||||
sudo sed -i '/locations.conf/i \ include common/wpsubdir.conf;' /etc/nginx/sites-available/$domain
|
||||
echo "${gre}Subdirectory Multisite configuration has been successfully completed!${end}"
|
||||
else
|
||||
fi
|
||||
else
|
||||
sudo sed -i "/WP_ALLOW_MULTISITE/d" $wpcon
|
||||
echo "${red}[ERROR] Multisite installation incomplete or not detected!${end}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue