Automatic cleanup for old update backups
Automatically retain update database backups in 1.0.13
Add an automatic backup retention setting to Admin > Backups. Keep five completed automatic update database backups by default, with a configurable limit of 1 to 1000. Saving the setting also cleans up old automatic copies immediately. Manual backups are always preserved.
Production startup schedules cleanup every minute, so it resumes automatically after an upgrade releases its lock. Cleanup shares the updater mutex, pauses during updates or recovery, preserves protected recovery copies even beyond the configured count, and prevents incomplete snapshots from displacing completed copies. Malformed settings stop cleanup until corrected. The private retention setting survives upgrades and database rollback.
Cleanup never touches uploads, private logs, manual backups or root deployment snapshots. Failures retry without stopping the application or rolling back a successful upgrade. The API repeats superadmin and same-origin checks and accepts only a validated retention count.
Validated with npm run check, npm run build, retention and recovery regressions, and a disposable production HTTP test covering authorization, origin/input checks, busy startup, scheduled retry after lock release, immediate cleanup, and preservation of manual/recovery copies and live data.
