A restore that stops at a file gone from the location points at --salvage; test a full restore with a damaged and a missing pack

The DR test of 1.0.2 over SMB is done: result in PLAN, empty folders as a known issue (#27).
This commit is contained in:
2026-11-06 10:27:41 +01:00
parent 74bfa7052f
commit b625fe7666
7 changed files with 114 additions and 4 deletions
+8 -1
View File
@@ -67,7 +67,7 @@ HELP);
}, $skipped);
} catch (\Throwable $e) {
$output->writeln('<error>' . $e->getMessage() . '</error>');
if ($skipped === null && ($e instanceof \OCA\NgBackup\Repository\RepositoryException || $e instanceof \OCA\NgBackup\Crypto\CryptoException)) {
if ($skipped === null && self::backupLooksDamaged($e)) {
$output->writeln('The data of a file on the location is damaged or missing. Run the same command with --salvage to restore everything else and list what could not be restored.');
}
return 1;
@@ -76,6 +76,13 @@ HELP);
return self::reportSkipped($skipped, $output);
}
/** Damaged data, or a file that is gone from the location: what --salvage is for. */
public static function backupLooksDamaged(\Throwable $e): bool {
return $e instanceof \OCA\NgBackup\Repository\RepositoryException
|| $e instanceof \OCA\NgBackup\Crypto\CryptoException
|| ($e instanceof \OCA\NgBackup\Backend\BackendException && str_starts_with($e->getMessage(), 'Not found'));
}
/**
* The files --salvage left out; exit code 2 when there are any.
*