Don't prevent deletion if a DB host is unreachable and it is a force delete; closes #2085

This commit is contained in:
Dane Everitt 2020-06-23 20:26:48 -07:00
parent 4a0627d182
commit 066ed5cdda
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
1 changed files with 10 additions and 1 deletions

View File

@ -2,6 +2,7 @@
namespace Pterodactyl\Services\Servers;
use Exception;
use Psr\Log\LoggerInterface;
use Pterodactyl\Models\Server;
use Illuminate\Database\ConnectionInterface;
@ -109,7 +110,15 @@ class ServerDeletionService
$this->connection->transaction(function () use ($server) {
$this->databaseRepository->setColumns('id')->findWhere([['server_id', '=', $server->id]])->each(function ($item) {
$this->databaseManagementService->delete($item->id);
try {
$this->databaseManagementService->delete($item->id);
} catch (Exception $exception) {
if ($this->force) {
$this->writer->warning($exception);
} else {
throw $exception;
}
}
});
$this->repository->delete($server->id);