From 26f33401203523dbda08b77bc809a482b64ed71f Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@robotics.uk.to>
Date: Sun, 10 Jul 2016 13:17:51 +0100
Subject: [PATCH] Move remote gnusocial restore to app script

---
 src/freedombone-app-gnusocial  | 20 +++++++++++++++++++-
 src/freedombone-restore-remote | 25 -------------------------
 2 files changed, 19 insertions(+), 26 deletions(-)

diff --git a/src/freedombone-app-gnusocial b/src/freedombone-app-gnusocial
index 24e15f051..d2dd16a0b 100755
--- a/src/freedombone-app-gnusocial
+++ b/src/freedombone-app-gnusocial
@@ -163,7 +163,25 @@ function backup_remote_gnusocial {
 }
 
 function restore_remote_gnusocial {
-	echo -n ''
+	if grep -q "GNU Social domain" $COMPLETION_FILE; then
+		echo $"Restoring GNU Social"
+		MICROBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "GNU Social domain" | awk -F ':' '{print $2}')
+
+		# stop the daemons
+		cd /var/www/${MICROBLOG_DOMAIN_NAME}/htdocs
+		scripts/stopdaemons.sh
+
+		function_check restore_database_from_friend
+		restore_database_from_friend gnusocial ${MICROBLOG_DOMAIN_NAME}
+		if [ -d /root/tempgnusocial ]; then
+			rm -rf /root/tempgnusocial
+		fi
+
+		# start the daemons
+		cd /var/www/${MICROBLOG_DOMAIN_NAME}/htdocs
+		scripts/startdaemons.sh
+		echo $"Restore of GNU Social complete"
+	fi
 }
 
 function remove_gnusocial {
diff --git a/src/freedombone-restore-remote b/src/freedombone-restore-remote
index b659f670c..9cef3f737 100755
--- a/src/freedombone-restore-remote
+++ b/src/freedombone-restore-remote
@@ -666,30 +666,6 @@ function restore_mailing_list {
 	fi
 }
 
-function restore_gnusocial {
-	if [[ $RESTORE_APP != 'all' ]]; then
-		if [[ $RESTORE_APP != 'gnusocial' ]]; then
-			return
-		fi
-	fi
-	if grep -q "GNU Social domain" $COMPLETION_FILE; then
-		MICROBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "GNU Social domain" | awk -F ':' '{print $2}')
-
-		# stop the daemons
-		cd /var/www/${MICROBLOG_DOMAIN_NAME}/htdocs
-		scripts/stopdaemons.sh
-
-		restore_database_from_friend gnusocial ${MICROBLOG_DOMAIN_NAME}
-		if [ -d /root/tempgnusocial ]; then
-			rm -rf /root/tempgnusocial
-		fi
-
-		# start the daemons
-		cd /var/www/${MICROBLOG_DOMAIN_NAME}/htdocs
-		scripts/startdaemons.sh
-	fi
-}
-
 function restore_rss {
 	if [[ $RESTORE_APP != 'all' ]]; then
 		if [[ $RESTORE_APP != 'ttrss' ]]; then
@@ -1098,7 +1074,6 @@ restore_personal_settings
 restore_mailing_list
 restore_email
 
-restore_gnusocial
 restore_hubzilla
 restore_rss
 restore_syncthing
-- 
GitLab