Actually delete the backup in the DB

This commit is contained in:
Dane Everitt 2020-05-09 20:01:45 -07:00
parent 225ef2917a
commit 086abb2a55
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -87,15 +87,20 @@ class DeleteBackupService
* Deletes a backup from an S3 disk. * Deletes a backup from an S3 disk.
* *
* @param \Pterodactyl\Models\Backup $backup * @param \Pterodactyl\Models\Backup $backup
* @throws \Throwable
*/ */
protected function deleteFromS3(Backup $backup) protected function deleteFromS3(Backup $backup)
{ {
/** @var \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter */ $this->connection->transaction(function () use ($backup) {
$adapter = $this->manager->adapter(Backup::ADAPTER_AWS_S3); $this->repository->delete($backup->id);
$adapter->getClient()->deleteObject([ /** @var \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter */
'Bucket' => $adapter->getBucket(), $adapter = $this->manager->adapter(Backup::ADAPTER_AWS_S3);
'Key' => sprintf('%s/%s.tar.gz', $backup->server->uuid, $backup->uuid),
]); $adapter->getClient()->deleteObject([
'Bucket' => $adapter->getBucket(),
'Key' => sprintf('%s/%s.tar.gz', $backup->server->uuid, $backup->uuid),
]);
});
} }
} }