Restoring lychee from backup

This commit is contained in:
Bob Mottram 2018-01-21 12:02:13 +00:00
parent 5d0e497c10
commit 4cbd1cce34
1 changed files with 20 additions and 0 deletions

View File

@ -163,11 +163,22 @@ function restore_local_lychee {
LYCHEE_DOMAIN_NAME=$(get_completion_param "lychee domain")
fi
if [ $LYCHEE_DOMAIN_NAME ]; then
suspend_site ${LYCHEE_DOMAIN_NAME}
function_check lychee_create_database
lychee_create_database
function_check restore_database
restore_database lychee ${LYCHEE_DOMAIN_NAME}
if [ -f /var/www/$LYCHEE_DOMAIN_NAME/htdocs/data/config.php ]; then
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
sed -i "s|dbPassword.*|dbPassword = '$MARIADB_PASSWORD';|g" /var/www/$LYCHEE_DOMAIN_NAME/htdocs/data/config.php
MARIADB_PASSWORD=
fi
restart_site
chown -R lychee: /var/www/$LYCHEE_DOMAIN_NAME/htdocs/
fi
}
@ -195,12 +206,21 @@ function restore_remote_lychee {
LYCHEE_DOMAIN_NAME=$(get_completion_param "lychee domain")
fi
suspend_site ${LYCHEE_DOMAIN_NAME}
function_check restore_database_from_friend
function_check lychee_create_database
lychee_create_database
restore_database_from_friend lychee ${LYCHEE_DOMAIN_NAME}
if [ -f /var/www/$LYCHEE_DOMAIN_NAME/htdocs/data/config.php ]; then
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
sed -i "s|dbPassword.*|dbPassword = '$MARIADB_PASSWORD';|g" /var/www/$LYCHEE_DOMAIN_NAME/htdocs/data/config.php
MARIADB_PASSWORD=
fi
restart_site
chown -R lychee: /var/www/$LYCHEE_DOMAIN_NAME/htdocs/
}