From 97887cf7fe45293baa4e3f23a72c58e642ef0294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Mart=C3=ADnez=20Ochoa?= Date: Sun, 8 Jul 2018 17:20:21 -0500 Subject: [PATCH] fixed delete wp site Failing when wp-config is at root instead of one level below. --- lib/general | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/general b/lib/general index dbc66b9..45cfcc8 100644 --- a/lib/general +++ b/lib/general @@ -18,9 +18,17 @@ db_delete() { fi # Get dbname and dbuser of a WP site - local name=$( grep -F "DB_NAME" /var/www/$domain/wp-config.php | cut -f 4 -d "'" ) - local user=$( grep -F "DB_USER" /var/www/$domain/wp-config.php | cut -f 4 -d "'" ) - local host=$( grep -F "DB_HOST" /var/www/$domain/wp-config.php | cut -f 4 -d "'" ) + if [[ -a /var/www/$domain/wp-config.php ]]; then + wpconfpath="/var/www/$domain/wp-config.php" + elif [[ -a /var/www/$domain/htdocs/wp-config.php ]]; then + wpconfpath="/var/www/$domain/htdocs/wp-config.php" + else + return + fi + + local name=$( grep -F "DB_NAME" $wpconfpath | cut -f 4 -d "'" ) + local user=$( grep -F "DB_USER" $wpconfpath | cut -f 4 -d "'" ) + local host=$( grep -F "DB_HOST" $wpconfpath | cut -f 4 -d "'" ) local url=$(echo "$host" | cut -f 1 -d ':') local port=$(echo "$host" | cut -f 2 -d ':') local done="0"