From b36ee27735a6ab4a278ccff4c3eb46528ead143c Mon Sep 17 00:00:00 2001 From: edwinvandeven Date: Wed, 14 May 2014 13:08:28 +0900 Subject: [PATCH] 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