Skip to content

Commit

Permalink
Delete DB improved
Browse files Browse the repository at this point in the history
Catch error improved and press enter twice to skip in external DB.
  • Loading branch information
QROkes committed Jan 26, 2018
1 parent b8a768a commit ae127a1
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 23 deletions.
68 changes: 46 additions & 22 deletions lib/general
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,57 @@ db_delete() {
fi
local ROOT_PASS=$( echo $(conf_read mysql-root) | openssl enc -d -a -salt )
sudo mysql --connect-timeout=10 --user=root -p$ROOT_PASS -e "$dbsetup"
if [ $? != "0" ]; then
done="0"
echo "${red}============================================"
echo " [Error]: Database delete failed."
echo "============================================"
echo ""
echo "${blu} Retry [Y/n]? "
while read -r -n 1 -s answer; do
answer=${answer:-y}
if [[ $answer = [YyNn] ]]; then
break
fi
done
if [[ $answer == [Nn] ]]; then
done="1"
fi
else
echo "${gre}Database of your site ${blu}${domain}${gre} has been successfully deleted! ${end}"
fi
else
echo ""
echo "${gre} External DB found in $domain "
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
uroot=${uroot:-root}
read -p "External DB root password: " proot
echo "${end}"
sudo mysql --connect-timeout=10 -h "$url" -P "$port" -u"$uroot" -p"$proot" -e "$dbsetup"
fi

if [ $? != "0" ]; then
done="0"
echo "${red}============================================"
echo " [Error]: Database delete failed."
echo "============================================"
echo ""
echo "${blu} Retry [Y/n]? "
while read -r -n 1 -s answer; do
answer=${answer:-y}
if [[ $answer = [YyNn] ]]; then
break
fi
done
if [[ $answer == [Nn] ]]; then
done="1"
if [[ $uroot == "root" && -z $proot ]]; then
echo "${red} Action aborted!"
continue 1;
else
sudo mysql --connect-timeout=10 -h "$url" -P "$port" -u"$uroot" -p"$proot" -e "$dbsetup"
if [ $? != "0" ]; then
done="0"
echo "${red}============================================"
echo " [Error]: Database delete failed."
echo "============================================"
echo ""
echo "${blu} Retry [Y/n]? "
while read -r -n 1 -s answer; do
answer=${answer:-y}
if [[ $answer = [YyNn] ]]; then
break
fi
done
if [[ $answer == [Nn] ]]; then
done="1"
fi
else
echo "${gre}Database of your site ${blu}${domain}${gre} has been successfully deleted! ${end}"
fi
fi
else
echo "${gre}Database of your site ${blu}${domain}${gre} has been successfully deleted! ${end}"
echo "${end}"
fi
done

Expand Down
2 changes: 1 addition & 1 deletion weby
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Webinoly script.
# This script is designed to install latest Webinoly.
webyversion="1.2.3-beta"
webyversion="1.2.3"


# Check OS support
Expand Down

0 comments on commit ae127a1

Please sign in to comment.