1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kanboard_ynh.git synced 2024-09-03 19:36:17 +02:00
kanboard_ynh/scripts/restore

48 lines
1.1 KiB
Text
Raw Normal View History

#!/bin/bash
2015-10-23 16:24:30 +02:00
2017-10-19 12:13:47 +02:00
# Source local helpers
source ./_common.sh
# Source app helpers
source /usr/share/yunohost/helpers
# Abort script if errors
ynh_abort_if_errors
app=$YNH_APP_INSTANCE_NAME
2016-02-07 00:56:33 +01:00
# Set app specific variables
dbname=$app
dbuser=$app
2016-02-07 00:56:33 +01:00
# Retrieve old app settings
domain=$(ynh_app_setting_get "$app" domain)
path=$(ynh_app_setting_get "$app" path)
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
final_path=$(ynh_app_setting_get "$app" final_path)
2017-10-19 12:34:02 +02:00
# Check web path availability
ynh_webpath_available "$domain" "$path"
# Check destination directory
test ! -e "$final_path" || ynh_die "This path already contains a folder"
2015-10-26 14:49:22 +01:00
# Restore the app files
ynh_restore_file "$final_path"
2014-12-22 18:57:15 +01:00
# Create and restore the database
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./db.sql
# Restore permissions
chown -R root:root "$final_path"
chown -R www-data ${final_path}/{data,plugins}
# Restore configuration files
ynh_restore_file "/etc/nginx/conf.d/${domain}.d/${app}.conf"
ynh_restore_file "/etc/php5/fpm/pool.d/${app}.conf"
2016-02-07 00:56:33 +01:00
# Reload services
2017-10-19 12:22:39 +02:00
service php5-fpm restart || true
service nginx reload || true