From 086abb2a55d1b144de8d02b55814aca738957eca Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 9 May 2020 20:01:45 -0700 Subject: [PATCH] Actually delete the backup in the DB --- app/Services/Backups/DeleteBackupService.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/Services/Backups/DeleteBackupService.php b/app/Services/Backups/DeleteBackupService.php index 094b636cf..cdb61844b 100644 --- a/app/Services/Backups/DeleteBackupService.php +++ b/app/Services/Backups/DeleteBackupService.php @@ -87,15 +87,20 @@ class DeleteBackupService * Deletes a backup from an S3 disk. * * @param \Pterodactyl\Models\Backup $backup + * @throws \Throwable */ protected function deleteFromS3(Backup $backup) { - /** @var \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter */ - $adapter = $this->manager->adapter(Backup::ADAPTER_AWS_S3); + $this->connection->transaction(function () use ($backup) { + $this->repository->delete($backup->id); - $adapter->getClient()->deleteObject([ - 'Bucket' => $adapter->getBucket(), - 'Key' => sprintf('%s/%s.tar.gz', $backup->server->uuid, $backup->uuid), - ]); + /** @var \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter */ + $adapter = $this->manager->adapter(Backup::ADAPTER_AWS_S3); + + $adapter->getClient()->deleteObject([ + 'Bucket' => $adapter->getBucket(), + 'Key' => sprintf('%s/%s.tar.gz', $backup->server->uuid, $backup->uuid), + ]); + }); } }