Backup System
Understand backup paths, metadata, retention, cleanup, and restore-safe source handling.
The backup system supports the non-destructive promise of the plugin.
Backup storage
Backups are stored in a plugin-managed backup directory under uploads. The backup path is recorded in _vacimg_backup_path.
Creation rules
The WebP generator ensures a backup before derivative generation when backups are enabled. For WebP source optimization, the backup is essential because the source file can be replaced with a smaller WebP candidate.
Cleanup
Backup cleanup runs on the vacimg_cleanup_backups cron hook. The last cleanup time is stored in vacimg_last_backup_cleanup. Retention of 0 means keep backups indefinitely.
Restore
Restore uses the saved backup path, validates source context, restores the source file, removes derivative files where safe, and clears related metadata.