2019-07-29 19:50:23 +02:00
#!/bin/bash
2021-02-01 14:42:41 +01:00
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
2021-04-14 12:45:50 +02:00
# RESTORE THE APP MAIN DIR
2021-02-01 14:42:41 +01:00
#=================================================
2024-09-01 13:59:23 +02:00
ynh_script_progression "Restoring the app main directory..."
2021-02-01 14:42:41 +01:00
2024-09-01 13:59:23 +02:00
ynh_restore "$install_dir"
2021-02-01 14:42:41 +01:00
# Restore permissions on app files
2024-09-01 13:59:23 +02:00
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx $install_dir
2023-10-09 10:09:28 +02:00
chmod -R 775 $install_dir/storage $install_dir/bootstrap/cache $install_dir/public/uploads
2024-09-01 13:59:23 +02:00
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data $install_dir
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 640 $install_dir/.env
2021-04-14 12:45:50 +02:00
2022-01-29 15:29:42 +01:00
#=================================================
2023-02-26 16:31:30 +01:00
# RESTORE THE MYSQL DATABASE
2022-01-29 15:29:42 +01:00
#=================================================
2024-09-01 13:59:23 +02:00
ynh_script_progression "Restoring the MySQL database..."
2022-01-29 15:29:42 +01:00
2024-09-01 13:59:23 +02:00
ynh_mysql_db_shell < ./db.sql
2022-01-29 15:29:42 +01:00
2023-02-26 16:31:30 +01:00
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
2021-02-01 14:42:41 +01:00
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
2024-09-01 13:59:23 +02:00
ynh_script_progression "Restoring system configurations related to $app..."
2021-02-01 14:42:41 +01:00
2024-09-01 13:59:23 +02:00
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
2021-02-01 14:42:41 +01:00
2024-09-01 13:59:23 +02:00
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
2022-12-30 12:09:15 +01:00
2024-09-01 13:59:23 +02:00
ynh_restore "/etc/systemd/system/$app.service"
2022-05-25 18:35:13 +02:00
systemctl enable $app.service --quiet
2024-08-29 17:44:37 +02:00
yunohost service add $app --description="Platform to create documentation/wiki content" --log="/var/log/$app/$app.log"
2022-05-25 18:35:13 +02:00
2021-02-01 14:42:41 +01:00
#=================================================
2023-02-26 16:31:30 +01:00
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
2021-02-01 14:42:41 +01:00
#=================================================
2024-09-01 13:59:23 +02:00
ynh_script_progression "Reloading NGINX web server and $app's service..."
2021-02-01 14:42:41 +01:00
2024-09-01 13:59:23 +02:00
ynh_systemctl --service=php$php_version-fpm --action=reload
ynh_systemctl --service=nginx --action=reload
2021-02-01 14:42:41 +01:00
2024-09-01 13:59:23 +02:00
ynh_systemctl --service=$app --action="start" --log_path="systemd"
2023-02-26 16:31:30 +01:00
2021-02-01 14:42:41 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2019-07-29 19:50:23 +02:00
2024-09-01 13:59:23 +02:00
ynh_script_progression "Restoration completed for $app"