From c03b629e85a409951a7a8d7b4a4653b6d2e27497 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:21:03 +0100 Subject: [PATCH] fix: deletion of single backup --- .../Project/Database/BackupExecutions.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/Livewire/Project/Database/BackupExecutions.php b/app/Livewire/Project/Database/BackupExecutions.php index 9ed608ed0..526239eea 100644 --- a/app/Livewire/Project/Database/BackupExecutions.php +++ b/app/Livewire/Project/Database/BackupExecutions.php @@ -61,15 +61,19 @@ class BackupExecutions extends Component ? $execution->scheduledDatabaseBackup->database->service->destination->server : $execution->scheduledDatabaseBackup->database->destination->server; - deleteBackupsLocally($execution->filename, $server); + try { + deleteBackupsLocally($execution->filename, $server); - if ($this->delete_backup_s3 && $execution->scheduledDatabaseBackup->s3) { - deleteBackupsS3($execution->filename, $server, $execution->scheduledDatabaseBackup->s3); + if ($this->delete_backup_s3 && $execution->scheduledDatabaseBackup->s3) { + deleteBackupsS3($execution->filename, $execution->scheduledDatabaseBackup->s3); + } + + $execution->delete(); + $this->dispatch('success', 'Backup deleted.'); + $this->refreshBackupExecutions(); + } catch (\Exception $e) { + $this->dispatch('error', 'Failed to delete backup: '.$e->getMessage()); } - - $execution->delete(); - $this->dispatch('success', 'Backup deleted.'); - $this->refreshBackupExecutions(); } public function download_file($exeuctionId)