2017-03-02 15:44:54 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-09-03 23:31:52 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2017-03-02 15:44:54 +01:00
|
|
|
|
2022-10-06 00:00:31 +02:00
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
2018-09-03 23:31:52 +02:00
|
|
|
source ../settings/scripts/_common.sh
|
2017-03-02 15:44:54 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2021-09-09 22:54:05 +02:00
|
|
|
#=================================================
|
|
|
|
# RESTORE THE APP MAIN DIR
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoring the app main directory..." --weight=2
|
|
|
|
|
2023-04-27 23:04:36 +02:00
|
|
|
ynh_restore_file --origin_path="$install_dir"
|
2021-02-07 17:05:09 +01:00
|
|
|
|
2023-04-27 23:04:36 +02:00
|
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
find "$install_dir" -type f -exec chmod 640 {} \;
|
|
|
|
find "$install_dir/bin" -type f -exec chmod 750 {} \;
|
|
|
|
find "$install_dir" -type d -exec chmod 750 {} \;
|
|
|
|
find "$install_dir" -type d -exec chmod +s {} \;
|
2021-02-07 17:05:09 +01:00
|
|
|
|
|
|
|
#=================================================
|
2018-09-03 23:31:52 +02:00
|
|
|
# RESTORE THE PHP-FPM CONFIGURATION
|
2018-09-03 21:35:41 +02:00
|
|
|
#=================================================
|
2022-10-06 00:00:31 +02:00
|
|
|
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
|
2018-09-03 21:35:41 +02:00
|
|
|
|
2022-10-06 00:00:31 +02:00
|
|
|
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
2017-03-02 15:44:54 +01:00
|
|
|
|
2021-11-29 20:25:33 +01:00
|
|
|
#=================================================
|
2022-10-06 00:00:31 +02:00
|
|
|
# RESTORE THE NGINX CONFIGURATION
|
2021-11-29 20:25:33 +01:00
|
|
|
#=================================================
|
2022-10-06 00:00:31 +02:00
|
|
|
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
2021-11-29 20:25:33 +01:00
|
|
|
|
2022-10-06 00:00:31 +02:00
|
|
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RESTORE VARIOUS FILES
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoring various files..." --weight=1
|
|
|
|
|
|
|
|
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
|
|
|
chmod 644 /etc/cron.d/$app
|
2017-03-09 17:27:59 +01:00
|
|
|
|
2018-09-03 23:31:52 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# RELOAD NGINX AND PHP-FPM
|
|
|
|
#=================================================
|
2021-01-20 08:52:18 +01:00
|
|
|
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
2017-04-01 17:03:40 +02:00
|
|
|
|
2022-10-06 00:00:31 +02:00
|
|
|
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
2020-07-10 19:22:37 +02:00
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
2019-10-26 15:25:19 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2021-01-20 08:46:17 +01:00
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|