Retention does not delete pruned backups from remote destinations #229
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Backup retention (both
RetentionManager::prune()after a backup and the plugin's hourlydoCleanup()) only deletes the local record + archive +.log. The archive copies uploaded to remote destinations (SFTP / FTP / S3 / Google Drive) are never removed, so remotes grow unbounded regardless of the profile'sretention_days/retention_count.Root causes
RemoteUploaderInterfaceonly hadupload()/testConnection().#__mokosuitebackup_recordsdoes not track which destinations a backup was uploaded to.Fix (in progress)
delete(string $remoteName): arraytoRemoteUploaderInterfaceand implement it in all four uploaders (idempotent — already-absent file counts as success).RetentionManagernow, for each pruned record, deletes the archive (archivename) from the profile's currently-enabled remotes (best-effort; failures logged, never block local pruning).restore.phpis intentionally NOT deleted — it is a single fixed-name file every backup overwrites, so newer backups still depend on it.Since records don't store their destinations, deletion targets the profile's current enabled remotes. Documented as a known limitation (a destination removed after a backup won't be cleaned).
https://claude.ai/code/session_01WbGBN9VyRK61zczYWcCQ2i
Branch created:
feature/229-retention-does-not-delete-pruned-backupsFixed in #231, merged to
dev. Each uploader (SFTP/FTP/S3/Google Drive) now has an idempotentdelete(), andRetentionManagerremoves each pruned archive from the profile's enabled remotes (best-effort;restore.phpdeliberately preserved). Will verify remote pruning on suite.dev after the nextdevbuild, then close.✅ Verified on suite.dev (
02.58.09-dev).RetentionManager::deleteFromRemotes()is deployed and wired intoprune(); a post-backup prune ran (profile 1 held at itsretention_count=10after the 11th backup).delete()path retention uses was exercised directly against the live SFTP remote: upload throwaway →delete()removes it → seconddelete()is an idempotent no-op success (all OK). So an expiring archive is genuinely removed from the destination, and a partially-cleaned remote never blocks pruning.restore.phpwas correctly left in place on the remote (shared, overwritten each backup — not pruned).Remote retention delete confirmed working. Closing.