Skip to content

Commit 729ca96

Browse files
committed
fix: aggiunto try - catch in fase di aggiunta file all'archivio del backup
1 parent da7205e commit 729ca96

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/Util/Zip.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,17 @@ public static function create($source, $destination, $ignores = [])
9696
$finder->notName($value);
9797
}
9898

99+
// Aggiungi i file all'archivio, gestendo eventuali errori
99100
foreach ($finder as $file) {
100-
$zip->addFile($file, $file->getRelativePathname());
101+
try {
102+
// Verifica se il file è accessibile prima di aggiungerlo
103+
if (is_readable($file->getRealPath())) {
104+
$zip->addFile($file, $file->getRelativePathname());
105+
}
106+
} catch (\Exception $e) {
107+
// Log dell'errore ma continua con gli altri file
108+
error_log('Errore durante l\'aggiunta del file ' . $file->getPathname() . ' al backup: ' . $e->getMessage());
109+
}
101110
}
102111
$zip->close();
103112
} else {

0 commit comments

Comments
 (0)