mirror of
https://github.com/YunoHost-Apps/piwigo_ynh.git
synced 2024-09-03 20:06:03 +02:00
Backup PHP-FPM conf and fix data restoration (fixes #14)
This commit is contained in:
parent
54cdce47b0
commit
5e28392c61
2 changed files with 11 additions and 3 deletions
|
@ -42,8 +42,7 @@ ynh_backup "$final_path"
|
|||
backup_core_only=$(ynh_app_setting_get "$app" backup_core_only)
|
||||
if [ -z $backup_core_only ] # If backup_core_only setting set, don't backup data directory
|
||||
then
|
||||
DATADIR="/home/yunohost.app/${app}"
|
||||
ynh_backup "$DATADIR"
|
||||
ynh_backup /home/yunohost.app/${app}
|
||||
else
|
||||
echo "Data dir won't be saved, because backup_core_only is set." >&2
|
||||
fi
|
||||
|
@ -65,6 +64,7 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
|
||||
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
||||
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||
|
||||
#=================================================
|
||||
# BACKUP MYSQL DB
|
||||
|
|
|
@ -54,9 +54,15 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
|
||||
ynh_restore_file "$final_path"
|
||||
# Restore data directory if backed-up
|
||||
if [ -d "$YNH_BACKUP_DIR/data" ] ; then
|
||||
if [ -d "$YNH_BACKUP_DIR/apps/${app}/backup/home/yunohost.app/${app}" ] ; then
|
||||
ynh_restore_file "/home/yunohost.app/${app}"
|
||||
else
|
||||
# Create app folders
|
||||
mkdir /home/yunohost.app/${app}/_data /home/yunohost.app/${app}/upload
|
||||
fi
|
||||
# Remove the option backup_core_only if it's in the settings.yml file
|
||||
ynh_app_setting_delete $app backup_core_only
|
||||
|
||||
#=================================================
|
||||
# RESTORE MYSQL DB
|
||||
#=================================================
|
||||
|
@ -76,6 +82,7 @@ ynh_system_user_create $app # Recreate the dedicated user, if not existing
|
|||
#=================================================
|
||||
|
||||
chown -R $app: $final_path
|
||||
chown -R $app: /home/yunohost.app/${app}
|
||||
|
||||
#=================================================
|
||||
# RESTORE FAIL2BAN CONFIGURATION
|
||||
|
@ -89,6 +96,7 @@ systemctl restart fail2ban
|
|||
#=================================================
|
||||
|
||||
ynh_restore_file /etc/php5/fpm/pool.d/$app.conf
|
||||
ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
Loading…
Reference in a new issue