Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
Some minor fixes after testing.
  • Loading branch information
QROkes committed May 11, 2021
1 parent a4abf37 commit fe15124
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/bkp
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ import_site() {
sudo rm -rf /var/www/$domain/webinoly_backup_db

if [[ $overwrite != "on" ]]; then
wp_conf_retrieve $domain
wp_conf_retrieve $domain true false
sudo mysql --connect-timeout=10 --user=admin -p$ADMIN_PASS <<_EOF_
CREATE USER '${wp_dbuser}'@'%' IDENTIFIED BY '${wp_dbpass}';
GRANT $(db_user_role) ON ${wp_dbname}.* TO ${wp_dbuser}@${wp_dbhost} IDENTIFIED BY '${wp_dbpass}';
Expand Down
8 changes: 7 additions & 1 deletion lib/general
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ is_cache() {


is_wp_multisite() {
wp_conf_retrieve $1 true false $2 # 3th parameter should be never set to 'true' to prevent an infinite loop!
wp_conf_retrieve $1 true false $2 # 3th parameter should always be 'false' to prevent an infinite loop!
local dbsetup="SELECT * FROM information_schema.tables WHERE table_schema = '$wp_dbname' AND table_name = '${wp_dbpref}sitemeta' LIMIT 1;"
local dbsetuc="USE $wp_dbname; SELECT meta_value FROM ${wp_dbpref}sitemeta where meta_key='subdomain_install';"

Expand All @@ -785,6 +785,12 @@ is_wp_installed() {
# When you create a WP site, DB is created only after the initial WP installation wizard is completed.

wp_conf_retrieve $1 true false $2
# It makes no sense checking for mapped domains, that's why is set to false.
# is_wp_installed will return true even if domain is not mapped, only a domain parked pointing to a WP site.
# if we want to check for mapped domains: wp_conf_retrieve $1 true false $2 > /dev/null (silenced echoed messages because affects this function)
# but that makes no-sense because even if it's not mapped, it will return the main site data
# Until now, we don't need a "is_domain_mapped" function, maybe we can change "is_wp_installed" to only be true for main domain sites, not parked (if it's not mapped). This can change in the future!!!

local dbsetup="SELECT * FROM information_schema.tables WHERE table_schema = '$wp_dbname' AND table_name = '${wp_dbpref}options' LIMIT 1;"

if [[ $wp_dbhost == "localhost" && $(check_mysql_connection localhost) == "true" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion lib/verify
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ do
echo "${blu}${dim}- [INFO] HTTP Authentication Credentials not found for $ver_domi${end}${red}"
fi

wp_conf_retrieve $ver_domi false
wp_conf_retrieve $ver_domi false > /dev/null
if [[ $wp_dbhost == "localhost" && -n $wp_dbuser && -n $wp_dbpass && -n $wp_dbname && $(check_mysql_connection localhost $wp_dbuser $wp_dbpass $wp_dbname 2>/dev/null) != "true" ]]; then
echo "${dim}- [WARNING] Database connection failed for your WP site $ver_domi ${end}${red}"
ver_nine_war="1"
Expand Down

0 comments on commit fe15124

Please sign in to comment.