Remove file on error

This commit is contained in:
fogelito
2023-09-07 18:01:53 +03:00
parent a7c6674a83
commit 1319731790
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ _APP_CONNECTIONS_CACHE=redis_fra1_01=redis://redis:6379
_APP_CONNECTIONS_QUEUE=redis_fra1_01=redis://redis:6379
_APP_CONNECTIONS_PUBSUB=redis_fra1_01=redis://redis:6379
_APP_CONNECTIONS_STORAGE=local://localhost
_APP_CONNECTIONS_BACKUPS_STORAGE=dospaces://ACCESS:SECRET@default/backups-v1?region=fra1
_APP_CONNECTIONS_BACKUPS_STORAGE=dospaces://DO006P96DUQVNMLTB8TP:QwxTmU1JfjWsuHecNGiDDvp1UNrMhgCnk5rvJ2FIpm0@default/backups-v1?region=fra1
_APP_STORAGE_ANTIVIRUS=disabled
_APP_STORAGE_ANTIVIRUS_HOST=clamav
_APP_STORAGE_ANTIVIRUS_PORT=3310
+4 -4
View File
@@ -16,11 +16,10 @@ use Utopia\Validator\Text;
class Backup extends Action
{
public const BACKUPS_PATH = '/backups';
//public const BACKUP_INTERVAL_SECONDS = 60 * 60 * 4; // 4 hours;
public const BACKUP_INTERVAL_SECONDS = 100;
public const BACKUP_INTERVAL_SECONDS = 60 * 60 * 4; // 4 hours;
public const COMPRESS_ALGORITHM = 'zstd'; // https://www.percona.com/blog/get-your-backup-to-half-of-its-size-introducing-zstd-support-in-percona-xtrabackup/
public const CLEANUP_LOCAL_FILES_SECONDS = 60 * 60 * 24 * 1; // 2 days?
public const CLEANUP_CLOUD_FILES_SECONDS = 60 * 60 * 24 * 1; // 14 days?;
public const CLEANUP_LOCAL_FILES_SECONDS = 60 * 60 * 24 * 7; // 2 days?
public const CLEANUP_CLOUD_FILES_SECONDS = 60 * 60 * 24 * 14; // 14 days?;
public const UPLOAD_CHUNK_SIZE = 5 * 1024 * 1024; // Must be greater than 5MB;
protected string $filename;
protected ?DSN $dsn = null;
@@ -184,6 +183,7 @@ class Backup extends Action
$stderr = shell_exec('tail -1 ' . $log);
if (!str_contains($stderr, 'completed OK!')) {
unlink($file);
throw new Exception('Backup failed: ' . $stderr);
}