2020-10-18 11:06:07 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2021-03-25 08:13:18 +01:00
|
|
|
#=================================================
|
|
|
|
# RESTORE THE APP MAIN DIR
|
|
|
|
#=================================================
|
2021-07-21 21:50:52 +02:00
|
|
|
ynh_script_progression --message="Restoring the app main directory..." --weight=2
|
2021-03-25 08:13:18 +01:00
|
|
|
|
2023-03-15 22:38:37 +01:00
|
|
|
ynh_restore_file --origin_path="$install_dir"
|
2021-03-25 08:13:18 +01:00
|
|
|
|
2020-10-18 11:06:07 +02:00
|
|
|
# Set permissions to app files
|
2023-03-15 22:38:37 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2020-10-18 11:06:07 +02:00
|
|
|
|
2021-12-12 17:39:50 +01:00
|
|
|
#=================================================
|
2020-10-18 11:06:07 +02:00
|
|
|
# RESTORE THE MYSQL DATABASE
|
|
|
|
#=================================================
|
2023-03-15 22:43:06 +01:00
|
|
|
ynh_script_progression --message="Restoring the MySQL database..." --weight=5
|
2020-10-18 11:06:07 +02:00
|
|
|
|
|
|
|
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql
|
|
|
|
|
|
|
|
#=================================================
|
2023-03-16 20:19:47 +01:00
|
|
|
# RESTORE THE PHP-FPM CONFIGURATION
|
2020-10-18 11:06:07 +02:00
|
|
|
#=================================================
|
2023-03-16 20:19:47 +01:00
|
|
|
ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=50
|
|
|
|
|
|
|
|
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|
|
|
|
|
|
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
2020-10-18 11:06:07 +02:00
|
|
|
|
|
|
|
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2021-07-21 21:50:52 +02:00
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|