feat: use new backup deletion functions

This commit is contained in:
peaklabs-dev
2025-01-13 16:38:16 +01:00
parent fb01aed6d5
commit a8b77b389a
3 changed files with 40 additions and 74 deletions

View File

@@ -18,9 +18,9 @@ class BackupExecutions extends Component
public $setDeletableBackup;
public $delete_backup_s3 = true;
public $delete_backup_s3 = false;
public $delete_backup_sftp = true;
public $delete_backup_sftp = false;
public function getListeners()
{
@@ -57,18 +57,14 @@ class BackupExecutions extends Component
return;
}
if ($execution->scheduledDatabaseBackup->database->getMorphClass() === \App\Models\ServiceDatabase::class) {
delete_backup_locally($execution->filename, $execution->scheduledDatabaseBackup->database->service->destination->server);
} else {
delete_backup_locally($execution->filename, $execution->scheduledDatabaseBackup->database->destination->server);
}
$server = $execution->scheduledDatabaseBackup->database->getMorphClass() === \App\Models\ServiceDatabase::class
? $execution->scheduledDatabaseBackup->database->service->destination->server
: $execution->scheduledDatabaseBackup->database->destination->server;
if ($this->delete_backup_s3) {
// Add logic to delete from S3
}
deleteBackupsLocally($execution->filename, $server);
if ($this->delete_backup_sftp) {
// Add logic to delete from SFTP
if ($this->delete_backup_s3 && $execution->scheduledDatabaseBackup->s3) {
deleteBackupsS3($execution->filename, $server, $execution->scheduledDatabaseBackup->s3);
}
$execution->delete();
@@ -143,7 +139,7 @@ class BackupExecutions extends Component
return view('livewire.project.database.backup-executions', [
'checkboxes' => [
['id' => 'delete_backup_s3', 'label' => 'Delete the selected backup permanently form S3 Storage'],
['id' => 'delete_backup_sftp', 'label' => 'Delete the selected backup permanently form SFTP Storage'],
// ['id' => 'delete_backup_sftp', 'label' => 'Delete the selected backup permanently form SFTP Storage'],
],
]);
}