From b36ee27735a6ab4a278ccff4c3eb46528ead143c Mon Sep 17 00:00:00 2001 From: edwinvandeven Date: Wed, 14 May 2014 13:08:28 +0900 Subject: [PATCH 1/3] Allow deleting site without prompt ee site delete example.com --all-no-prompt Removes db, files and nginx config without asking user. Useful to remove interactivity when calling from a remote server. --- usr/local/sbin/easyengine | 47 +++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/usr/local/sbin/easyengine b/usr/local/sbin/easyengine index 63636b18..c1d407db 100644 --- a/usr/local/sbin/easyengine +++ b/usr/local/sbin/easyengine @@ -1533,7 +1533,14 @@ REMOVEDB() # Remove Database # For Proper read Command Output stty echo - read -p "Are You Sure To Drop $WPDBNAME Database (y/n): " ANSWER + if [ "$1" = "no-prompt" ] + then + # Assume yes + ANSWER="y" + else + # Ask user for confirmation + read -p "Are You Sure To Drop $WPDBNAME Database (y/n): " ANSWER + fi if [ "$ANSWER" = "y" ] then @@ -1564,7 +1571,14 @@ REMOVEFILES() # Remove Webroot # For Proper read Command Output stty echo - read -p "Are You Sure To Remove $DOMAIN Webroot (y/n): " ANSWER + if [ "$1" = "no-prompt" ] + then + # Assume yes + ANSWER="y" + else + # Ask user for confirmation + read -p "Are You Sure To Drop $WPDBNAME Database (y/n): " ANSWER + fi if [ "$ANSWER" = "y" ] then @@ -1581,8 +1595,14 @@ REMOVENGINXCONF() # Remove Nginx Configuration # For Proper read Command Output stty echo - read -p "Are You Sure To Remove $DOMAIN Nginx Configuration (y/n): " ANSWER - + if [ "$1" = "no-prompt" ] + then + # Assume yes + ANSWER="y" + else + # Ask user for confirmation + read -p "Are You Sure To Drop $WPDBNAME Database (y/n): " ANSWER + fi if [ "$ANSWER" = "y" ] then # Remove Webroot @@ -3001,6 +3021,25 @@ then EEGITCOMMIT fi + elif [ "$SITEDELETEARG" = "--all-no-prompt" ] + then + + # Remove All Database And Webroot + REMOVEDB "no-prompt" + REMOVEFILES "no-prompt" + + # Remove Nginx Configuration + REMOVENGINXCONF "no-prompt" + + # Reload Nginx + NGINXRELOAD + + # Take Nginx Configuration In Git Version Control + EEGITDIR=/etc/nginx + EEGITMESSAGE="Delete Website With $SITEDELETEARG Option: $DOMAIN" + EEGITCOMMIT + fi + elif [ "$2" = "edit" ] then From fe7d241db770b13f56aa04f378e867d825578524 Mon Sep 17 00:00:00 2001 From: Edwin van de Ven Date: Wed, 14 May 2014 15:48:20 +0900 Subject: [PATCH 2/3] Fixed extra fi There was one fi too much --- usr/local/sbin/easyengine | 1 - 1 file changed, 1 deletion(-) diff --git a/usr/local/sbin/easyengine b/usr/local/sbin/easyengine index c1d407db..a0c31fd1 100644 --- a/usr/local/sbin/easyengine +++ b/usr/local/sbin/easyengine @@ -3019,7 +3019,6 @@ then EEGITDIR=/etc/nginx EEGITMESSAGE="Delete Website With $SITEDELETEARG Option: $DOMAIN" EEGITCOMMIT - fi elif [ "$SITEDELETEARG" = "--all-no-prompt" ] then From f6c4a13345688eccb154b1286b1785a37abc558c Mon Sep 17 00:00:00 2001 From: Edwin van de Ven Date: Wed, 14 May 2014 18:10:22 +0900 Subject: [PATCH 3/3] Fixed wrong messages REMOVEFILES() AND REMOVENGINX() had the REMOVEDB() confirmation message --- usr/local/sbin/easyengine | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/local/sbin/easyengine b/usr/local/sbin/easyengine index a0c31fd1..26f77b3c 100644 --- a/usr/local/sbin/easyengine +++ b/usr/local/sbin/easyengine @@ -1577,7 +1577,7 @@ REMOVEFILES() ANSWER="y" else # Ask user for confirmation - read -p "Are You Sure To Drop $WPDBNAME Database (y/n): " ANSWER + read -p "Are You Sure To Remove $DOMAIN Webroot (y/n): " ANSWER fi if [ "$ANSWER" = "y" ] @@ -1601,7 +1601,7 @@ REMOVENGINXCONF() ANSWER="y" else # Ask user for confirmation - read -p "Are You Sure To Drop $WPDBNAME Database (y/n): " ANSWER + read -p "Are You Sure To Remove $DOMAIN Nginx Configuration (y/n): " ANSWER fi if [ "$ANSWER" = "y" ] then