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

66 lines
2.4 KiB
Text
Raw Permalink Normal View History

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2021-05-15 19:19:38 +02:00
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
2019-06-14 18:57:58 +02:00
source ../settings/scripts/_common.sh
2020-03-29 05:02:23 +02:00
source /usr/share/yunohost/helpers
2020-06-03 01:58:54 +02:00
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
2024-03-16 13:58:59 +01:00
ynh_restore_file --origin_path="$install_dir"
2019-06-19 02:18:00 +02:00
2024-03-16 13:58:59 +01:00
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
2024-03-16 13:58:59 +01:00
chmod 2775 "$install_dir/app/sites/default/files"
#=================================================
2021-05-15 19:19:38 +02:00
# RESTORE THE DATA DIRECTORY
#=================================================
2021-05-18 02:21:01 +02:00
ynh_script_progression --message="Restoring the data directory..."
2024-03-16 13:58:59 +01:00
ynh_restore_file --origin_path="$data_dir" --not_mandatory
2019-08-05 03:11:07 +02:00
2024-03-16 13:58:59 +01:00
chmod -R o-rwx "$data_dir"
chown -R "$app:www-data" "$data_dir"
2022-07-29 01:12:30 +02:00
#=================================================
2024-03-16 13:58:59 +01:00
# RESTORE THE POSTGRESQL DATABASE
2022-07-29 01:12:30 +02:00
#=================================================
2024-03-16 13:58:59 +01:00
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
2022-07-29 01:12:30 +02:00
2024-03-16 13:58:59 +01:00
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
2022-07-29 01:12:30 +02:00
#=================================================
2024-03-16 13:58:59 +01:00
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
2024-03-16 13:58:59 +01:00
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
2020-06-04 22:59:34 +02:00
# Restore the file first, so it can have a backup if different
2020-06-03 01:58:54 +02:00
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
2024-03-18 13:23:11 +01:00
ynh_add_fpm_config --usage=low --footprint=low
2019-06-19 02:18:00 +02:00
2022-07-29 01:12:30 +02:00
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2019-06-19 02:18:00 +02:00
2022-07-29 01:12:30 +02:00
ynh_restore_file --origin_path="/etc/cron.d/$app"
#=================================================
2019-06-14 18:57:58 +02:00
# RELOAD NGINX AND PHP-FPM
#=================================================
2020-10-01 22:37:20 +02:00
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
2024-03-16 13:58:59 +01:00
ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
2019-06-14 18:57:58 +02:00
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
2019-06-14 18:57:58 +02:00
# END OF SCRIPT
#=================================================
2020-03-29 05:02:23 +02:00
ynh_script_progression --message="Restoration completed for $app" --last