Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion features/COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Legend: covered / partial / not covered (reason). Feature files are abbreviated:
| restore latest, restore `--id`, unknown id | covered | backup: Restore the latest backup; Restore a specific backup by id; Restoring an unknown backup id fails |
| disabled site | covered | backup: A disabled site cannot be backed up...; en-dis outline |
| `--dash-auth` format and ed-api-url check | covered | backup: A malformed --dash-auth is rejected; --dash-auth needs ed-api-url in the config |
| `--dash-auth` success/failure callbacks, rollback of the uploaded backup | not covered | needs an EasyDash API endpoint (`ed-api-url`) |
| `--dash-auth` success/failure callbacks, rollback of the uploaded backup | not covered | needs an EasyEngine Dashboard API endpoint (`ed-api-url`) |
| per-site lock blocks, lock left by a failed restore | covered | backup: A lock file of another backup blocks the backup (held with flock(1), so it holds with or without EasyEngine/site-command#480); not covered yet: a failed restore leaves the lock file and blocks later backups (its scenario comes back with the fix) |
| stale download reuse | not covered yet | a restore by id reuses files an earlier restore left behind (its scenario comes back with the fix) |
| retention (`no-of-backups`) | not covered yet | retention keeps one backup more than `no-of-backups` (its scenario comes back with the fix) |
Expand Down
26 changes: 13 additions & 13 deletions src/helper/Site_Backup_Restore.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Site_Backup_Restore {
public $site_data;
private $rclone_config_path;

// Properties for EasyDash callback handling
// Properties for EasyEngine Dashboard callback handling
private $dash_auth_enabled = false;
private $dash_backup_id;
private $dash_verify_token;
Expand All @@ -45,7 +45,7 @@ class Site_Backup_Restore {
private $dash_backup_completed = false;
private $dash_new_backup_path; // Track new backup path for potential rollback

// Error tracking for EasyDash failure callbacks
// Error tracking for EasyEngine Dashboard failure callbacks
private $dash_error_message = '';
private $dash_error_type = 'unknown';
private $dash_error_code = 0;
Expand Down Expand Up @@ -80,7 +80,7 @@ public function backup( $args, $assoc_args = [] ) {
return; // Exit after listing backups
}

// Handle --dash-auth flag for EasyDash integration
// Handle --dash-auth flag for EasyEngine Dashboard integration
if ( $dash_auth ) {
// Parse backup-id:backup-verification-token format
$auth_parts = explode( ':', $dash_auth, 2 );
Expand Down Expand Up @@ -184,7 +184,7 @@ public function backup( $args, $assoc_args = [] ) {
}

/**
* Shutdown handler to send failure callback to EasyDash if backup didn't complete.
* Shutdown handler to send failure callback to EasyEngine Dashboard if backup didn't complete.
* This is called when script terminates (including via EE::error which calls exit).
*
* Automatically captures fatal errors and interrupted processes if no error was
Expand Down Expand Up @@ -235,7 +235,7 @@ public function dash_shutdown_handler() {
}

/**
* Capture error details for EasyDash failure callback.
* Capture error details for EasyEngine Dashboard failure callback.
* Stores error information to be sent when backup fails.
*
* @param string $message Error message describing what went wrong.
Expand All @@ -250,7 +250,7 @@ private function capture_error( $message, $type = self::ERROR_TYPE_UNKNOWN, $cod
$this->dash_error_code = $code;

EE::debug( sprintf(
'Captured error for EasyDash: [%s] %s (code: %d)',
'Captured error for EasyEngine Dashboard: [%s] %s (code: %d)',
$type,
$message,
$code
Expand Down Expand Up @@ -1627,8 +1627,8 @@ private function cleanup_old_backups() {
}

/**
* Rollback (delete) the newly uploaded backup when EasyDash API callback fails.
* This prevents orphaned backups in remote storage that aren't tracked by EasyDash.
* Rollback (delete) the newly uploaded backup when EasyEngine Dashboard API callback fails.
* This prevents orphaned backups in remote storage that aren't tracked by the EasyEngine Dashboard.
*/
private function rollback_failed_backup() {
if ( empty( $this->dash_new_backup_path ) ) {
Expand All @@ -1637,7 +1637,7 @@ private function rollback_failed_backup() {
return;
}

EE::warning( 'EasyDash API callback failed. Rolling back newly uploaded backup...' );
EE::warning( 'EasyEngine Dashboard API callback failed. Rolling back newly uploaded backup...' );
EE::log( 'Deleting unregistered backup: ' . $this->dash_new_backup_path );

$result = EE::launch( sprintf( 'rclone purge %s', escapeshellarg( $this->dash_new_backup_path ) ) );
Expand Down Expand Up @@ -1696,9 +1696,9 @@ private function restore_php_conf( $backup_dir ) {
}

/**
* Send success callback to EasyDash API after successful backup.
* Send success callback to EasyEngine Dashboard API after successful backup.
*
* @param string $ed_api_url The EasyDash API URL.
* @param string $ed_api_url The EasyEngine Dashboard API URL.
* @param string $backup_id The backup ID.
* @param string $verify_token The verification token.
* @param array $backup_metadata The backup metadata.
Expand Down Expand Up @@ -1738,10 +1738,10 @@ private function send_dash_success_callback( $ed_api_url, $backup_id, $verify_to
}

/**
* Send failure callback to EasyDash API after failed backup.
* Send failure callback to EasyEngine Dashboard API after failed backup.
* Includes error details (message, type, code) for debugging and user feedback.
*
* @param string $ed_api_url The EasyDash API URL.
* @param string $ed_api_url The EasyEngine Dashboard API URL.
* @param string $backup_id The backup ID.
* @param string $verify_token The verification token.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/helper/class-ee-site.php
Original file line number Diff line number Diff line change
Expand Up @@ -2936,7 +2936,7 @@ public function sync( $args, $assoc_args ) {
* : List all available backups on remote.
*
* [--dash-auth]
* : Pass dash auth token and backup id. For EasyEngine dash use only.
* : Pass dash auth token and backup id. For EasyEngine Dashboard use only.
*
* ## EXAMPLES
*
Expand Down