Skip to content

Commit

Permalink
[Backup core only] Do not backup image cache - First step
Browse files Browse the repository at this point in the history
  • Loading branch information
lapineige authored and Salamandar committed Mar 15, 2024
1 parent 4c2f0ef commit 65d4ee5
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion scripts/backup
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,32 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_print_info --message="Declaring files to be backed up..."

#=================================================
# APPLY BACKUP CORE ONLY POLICY
#=================================================
# Apply policy only if we are not in upgrade mode

BACKUP_CORE_ONLY=${BACKUP_CORE_ONLY:-auto}
if [ "$BACKUP_CORE_ONLY" == "auto" ] ; then
BACKUP_CORE_ONLY=$(ynh_app_setting_get --app="$app" --key="backup_core_only")
BACKUP_CORE_ONLY=${BACKUP_CORE_ONLY:-0}
fi

#=================================================
# BACKUP THE APP MAIN DIR
#=================================================

# Clean cache files before backup (saved some disk space)
ynh_secure_remove --file=$install_dir/var/cache/prod

ynh_backup --src_path="$install_dir"
if [ "$BACKUP_CORE_ONLY" ] ; then
ynh_print_warn --message="Backing up only the core... If you downloaded article images, they will not be saved."
mv "$install_dir/web/assets/images" "/tmp/$app/web/assets/images"
ynh_backup --src_path="$install_dir"
mv "/tmp/$app/web/assets/images" "$install_dir/web/assets/images"
else
ynh_backup --src_path="$install_dir"
fi

#=================================================
# BACKUP THE SYSTEM CONFIGURATION
Expand Down

0 comments on commit 65d4ee5

Please sign in to comment.