Backup cleanup improvement#470
Merged
mrrobot47 merged 3 commits intoEasyEngine:developfrom Dec 11, 2025
Merged
Conversation
…tion Implement intelligent backup cleanup that only deletes old backups when EasyDash API successfully registers the new backup. If API callback fails, rollback the newly uploaded backup to prevent orphaned backups in remote storage. Key changes: - Add conditional cleanup based on API callback success/failure - Implement rollback mechanism to delete unregistered backups - Extend retry logic to handle connection errors (DNS, timeouts, etc.) - Add proper return values to API callback methods - Remove dead code from error handling paths - Optimize backup path tracking to only when dash-auth is enabled Retry behavior: - Retries 5xx server errors (500-599) - Retries connection errors (connection refused, DNS failures, timeouts) - Retries HTTP 0 (no response received) - Does NOT retry 4xx client errors - Max 3 retries with 5-minute delays between attempts Error handling improvements: - Changed rollback deletion failure from error to warning for consistency - Clear error messages distinguish between retry attempts and final failures - Proper "after N retries" messaging for all retryable errors
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements intelligent backup cleanup that conditionally deletes old backups based on EasyDash API callback success. When the API callback fails, the newly uploaded backup is rolled back to prevent orphaned backups in remote storage that aren't tracked by EasyDash.
Key changes:
- Add conditional cleanup that only removes old backups after successful API registration
- Implement rollback mechanism to delete unregistered backups when API callback fails
- Extend retry logic to handle connection errors (DNS failures, timeouts, connection refused) in addition to 5xx errors
Comments suppressed due to low confidence (1)
src/helper/Site_Backup_Restore.php:1104
- While
$backupcomes from remote directory listing which should be safe, consider addingescapeshellarg()to the sprintf format for defense in depth, similar to line 1132 where the full path is escaped. This ensures consistency in shell command construction and protects against potential injection if the backup naming format ever changes.
$result = EE::launch( sprintf( 'rclone purge %s/%s', $this->get_rclone_config_path(), $backup ) );
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement intelligent backup cleanup that only deletes old backups when
EasyDash API successfully registers the new backup. If API callback
fails, rollback the newly uploaded backup to prevent orphaned backups
in remote storage.
Key changes:
Retry behavior:
Error handling improvements: