From bf91611b976fc97b9e07e1065d733849f7b7a7f4 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Sun, 5 Jul 2026 19:39:37 -0500 Subject: [PATCH] fix(engine): check + log restore-script remote upload (no longer silent) The standalone restore script was uploaded to each remote with the result discarded and nothing logged, so a failed second upload left the restore script missing from the remote with no warning while the archive still recorded 'complete'. Capture the result: log success, and on failure set uploadFailed (-> warning status) and log the reason. Fixes #226 Claude-Session: https://claude.ai/code/session_01WbGBN9VyRK61zczYWcCQ2i --- CHANGELOG.md | 2 ++ .../com_mokosuitebackup/src/Engine/BackupEngine.php | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a461584f..3de1626b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] +### Fixed +- Remote upload: the standalone restore script upload is no longer silent — its result is now checked and logged, and a failed restore-script upload marks the backup as `warning` (previously the result was discarded, so a missing restore script on the remote went unreported while the archive still showed success). (#226) ## [02.58.00] --- 2026-07-06 diff --git a/source/packages/com_mokosuitebackup/src/Engine/BackupEngine.php b/source/packages/com_mokosuitebackup/src/Engine/BackupEngine.php index d9105d32..71f014ab 100644 --- a/source/packages/com_mokosuitebackup/src/Engine/BackupEngine.php +++ b/source/packages/com_mokosuitebackup/src/Engine/BackupEngine.php @@ -304,7 +304,18 @@ class BackupEngine $this->log(' Upload complete: ' . $result['message']); if (!empty($restoreScriptPath) && is_file($restoreScriptPath)) { - $uploader->upload($restoreScriptPath, basename($restoreScriptPath)); + $scriptName = basename($restoreScriptPath); + $this->log(' Uploading restore script: ' . $scriptName . '...'); + $scriptResult = $uploader->upload($restoreScriptPath, $scriptName); + + if (!empty($scriptResult['success'])) { + $this->log(' Restore script uploaded: ' . ($scriptResult['message'] ?? $scriptName)); + } else { + /* Never silent: a missing restore script makes the archive + much harder to restore, so surface it as a warning. */ + $uploadFailed = true; + $this->log(' WARNING: Restore script upload failed: ' . ($scriptResult['message'] ?? 'unknown error')); + } } } else { $uploadFailed = true;