#!/bin/bash source /usr/share/yunohost/helpers source ../settings/scripts/_common.sh ynh_trap_on export app=$YNH_APP_INSTANCE_NAME user=$app export domain=$(ynh_app_setting_get $app domain) export path=$(ynh_app_setting_get $app path) export admin=$(ynh_app_setting_get $app admin) dbpass=$(ynh_app_setting_get $app mysqlpwd) export local_path=$(ynh_app_setting_get $app local_path) export is_public=$(ynh_app_setting_get $app is_public) export prefix=$(ynh_app_setting_get $app prefix) dbname=$app dbuser=$user #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= #ynh_path_validity "$domain$path" ynh_check_restore #================================================= # RESTORE THE APP BY MODIFYING THE SYSTEM #================================================= ynh_app_dependencies php5-imap ynh_system_user_create "$user" "$local_path" # Create and restore the database ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql # Restore file ynh_restore # Fix app ownerships & permissions ynh_set_default_perm $local_path sudo chmod -R u+w $local_path/tmp sudo chmod -R u+w $local_path/upload sudo chmod -R u+w $local_path/application/config/ ynh_sso_access "/index.php?r=admin,/index.php?r=plugins,/scripts" # Reload services sudo service php5-fpm restart || true sudo service nginx reload || true