From f858776a9e0f32b5d68f40be55d34062c09eec53 Mon Sep 17 00:00:00 2001 From: ray Date: Tue, 8 Sep 2020 17:35:16 +0100 Subject: [PATCH] move reset-wordpress.sh --- reset.sh | 7 +------ scripts/debian10/reset-wordpress.sh | 0 scripts/reset-wordpress.sh | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) mode change 100755 => 100644 scripts/debian10/reset-wordpress.sh create mode 100755 scripts/reset-wordpress.sh diff --git a/reset.sh b/reset.sh index 8e0fddb..9dcc984 100755 --- a/reset.sh +++ b/reset.sh @@ -18,11 +18,6 @@ for _file in ./config/$_target/* ; do . "$_file" done -if [ "$_target" = remote ] && [ -n "$cloudways_user" ] ; then - echo "Using Cloudways - nothing to install" - exit -fi - # source script files if [ -n "$_target_os" ] ; then _script_dir="./scripts/$_target_os" @@ -42,6 +37,6 @@ if [ -n "$wp_user" ] ; then echo "IMPORTANT - we need a confirmation prompt here" echo "You are about to reinstall the $_target WordPress installation" echo "Reinstall WordPress (y/N): " - . "$_script_dir/reset-wordpress.sh" + . "./scripts/reset-wordpress.sh" . "$_script_dir/install-wordpress.sh" fi diff --git a/scripts/debian10/reset-wordpress.sh b/scripts/debian10/reset-wordpress.sh old mode 100755 new mode 100644 diff --git a/scripts/reset-wordpress.sh b/scripts/reset-wordpress.sh new file mode 100755 index 0000000..547975f --- /dev/null +++ b/scripts/reset-wordpress.sh @@ -0,0 +1,15 @@ +echo "Removing WordPress .." + +_mysql_cmd="mysql -uroot -p$db_root_pass -e " + +ssh -T $ssh << EOSSH + # remove database + if command -v mysql ; then + $_mysql_cmd "DROP DATABASE $wp_db_name;" + else + echo "ERROR: no installed database found - aborting WordPress removal" + exit 40 + fi + # remove files + rm -Rf $wp_path +EOSSH