From ec1b1766adaea346e67005ad83abb146d9aa9bb7 Mon Sep 17 00:00:00 2001
From: harshadyeola <harshad.yeola@rtcamp.com>
Date: Wed, 10 Sep 2014 16:25:18 +0530
Subject: [PATCH] ee clean

---
 bin/easyengine                      | 18 +++++++++---------
 src/modules/stack/ee_cache_clean.sh | 11 +++++++++++
 2 files changed, 20 insertions(+), 9 deletions(-)
 create mode 100644 src/modules/stack/ee_cache_clean.sh

diff --git a/bin/easyengine b/bin/easyengine
index 02c46737..ac92761f 100644
--- a/bin/easyengine
+++ b/bin/easyengine
@@ -667,17 +667,17 @@ elif [ "$EE_FIRST" = "secure" ]; then
 #EasyEngine cd
 elif [ "$EE_FIRST" = "cd" ]; then
 	# Check the website name is empty or not
-		EE_DOMAIN_CHECK=$EE_SECOND
-		ee_lib_check_domain
+	EE_DOMAIN_CHECK=$EE_SECOND
+	ee_lib_check_domain
 
-		#Check the website exist
-		ls /etc/nginx/sites-available/$EE_DOMAIN &> /dev/null \
-		|| ee_lib_error "The $EE_DOMAIN is not found in /etc/nginx/sites-available, exit status = " $?
+	#Check the website exist
+	ls /etc/nginx/sites-available/$EE_DOMAIN &> /dev/null \
+	|| ee_lib_error "The $EE_DOMAIN is not found in /etc/nginx/sites-available, exit status = " $?
 
-		# Change Directory to $EE_DOMAIN webroot
-		if [ $? -eq 0 ]; then
-			ee_site_cd
-		fi
+	# Change Directory to $EE_DOMAIN webroot
+	if [ $? -eq 0 ]; then
+		ee_site_cd
+	fi
 
 # EasyEngine update
 elif [ "$EE_FIRST" = "update" ]; then
diff --git a/src/modules/stack/ee_cache_clean.sh b/src/modules/stack/ee_cache_clean.sh
new file mode 100644
index 00000000..0aeb776f
--- /dev/null
+++ b/src/modules/stack/ee_cache_clean.sh
@@ -0,0 +1,11 @@
+#Clean all cache
+
+function ee_cache_clean()
+{
+	#Clean fastcgi cache 
+	rm -rf $(grep fastcgi_cache_path /etc/nginx/conf.d/fastcgi.conf | awk '{ print $2 }' | sed 's/$/\/*/g') \
+	|| ee_lib_error "Unable to clean fastcgi cache, exit status = " $? 
+
+	#Clean memcache
+	service memcached restart &>> $EE_COMMAND_LOG || ee_lib_error "Unable to clean memcache, exit status = " $? 
+}
\ No newline at end of file