delete site w ext-db unattended
Delete site with external database now is unattended.
This commit is contained in:
parent
4e26e73afe
commit
a0a8981f0c
|
@ -56,13 +56,19 @@ db_delete() {
|
||||||
echo "${gre}Database of your site ${blu}${domain}${gre} has been successfully deleted! ${end}"
|
echo "${gre}Database of your site ${blu}${domain}${gre} has been successfully deleted! ${end}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
if [[ $dbdatadel == "true" ]]; then
|
||||||
|
local dbdatauser=$(echo "${dbdata}" | cut -d',' -f 3 -s)
|
||||||
|
local dbdatapass=$(echo "${dbdata}" | cut -d',' -f 4 -s)
|
||||||
|
fi
|
||||||
|
if [[ -z $dbdatauser || -z $dbdatapass ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "${gre}External DB found in $domain (Press 'Enter' key twice to skip and not delete)"
|
echo "${gre}External DB found in $domain (Press 'Enter' key twice to skip and not delete)"
|
||||||
read -p "${blu}External DB root username [root]: " uroot
|
read -p "${blu}External DB root username [root]: " uroot
|
||||||
uroot=${uroot:-root}
|
uroot=${uroot:-root}
|
||||||
read -p "External DB root password: " proot
|
read -p "External DB root password: " proot
|
||||||
|
fi
|
||||||
if [[ $uroot == "root" && -z $proot ]]; then
|
if [[ $uroot == "root" && -z $proot ]]; then
|
||||||
echo "${red} Action aborted!"
|
echo "${red} Action aborted, database not deteted!"
|
||||||
continue 1;
|
continue 1;
|
||||||
else
|
else
|
||||||
sudo mysql --connect-timeout=10 -h "$url" -P "$port" -u"$uroot" -p"$proot" -e "$dbsetup"
|
sudo mysql --connect-timeout=10 -h "$url" -P "$port" -u"$uroot" -p"$proot" -e "$dbsetup"
|
||||||
|
|
11
lib/sites
11
lib/sites
|
@ -415,16 +415,23 @@ _EOF_
|
||||||
|
|
||||||
|
|
||||||
deletesite() {
|
deletesite() {
|
||||||
|
if [[ -n $value ]]; then
|
||||||
|
dbdata=${value:1:-1}
|
||||||
|
local dbdatahost=$(echo "${dbdata}" | cut -d',' -f 1 -s)
|
||||||
|
[[ $dbdatahost == "external" ]] && dbdatadel=$(echo "${dbdata}" | cut -d',' -f 2 -s)
|
||||||
|
[[ $dbdatadel =~ ^(true|false)$ || $value == "force" ]] && local skip="true"
|
||||||
|
fi
|
||||||
|
|
||||||
# Determine if site is WP, so you should delete the DB too.
|
# Determine if site is WP, so you should delete the DB too.
|
||||||
if [[ -a /var/www/$domain/wp-config.php || -a /var/www/$domain/htdocs/wp-config.php ]]; then
|
if [[ -a /var/www/$domain/wp-config.php || -a /var/www/$domain/htdocs/wp-config.php ]]; then
|
||||||
if [[ $value != "force" ]]; then
|
if [[ $skip != "true" ]]; then
|
||||||
echo "${blu}Delete Database [Y/n]?${end}"
|
echo "${blu}Delete Database [Y/n]?${end}"
|
||||||
while read -r -n 1 -s dbdel; do
|
while read -r -n 1 -s dbdel; do
|
||||||
local dbdel=${dbdel:-y}
|
local dbdel=${dbdel:-y}
|
||||||
[[ $dbdel = [YyNn] ]] && break
|
[[ $dbdel = [YyNn] ]] && break
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
dbdel="Y"
|
[[ $dbdatadel != "false" ]] && dbdel="Y"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue