Skip to content

Commit 066ed5c

Browse files
committed
Don't prevent deletion if a DB host is unreachable and it is a force delete; closes pterodactyl#2085
1 parent 4a0627d commit 066ed5c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/Services/Servers/ServerDeletionService.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Pterodactyl\Services\Servers;
44

5+
use Exception;
56
use Psr\Log\LoggerInterface;
67
use Pterodactyl\Models\Server;
78
use Illuminate\Database\ConnectionInterface;
@@ -109,7 +110,15 @@ public function handle(Server $server)
109110

110111
$this->connection->transaction(function () use ($server) {
111112
$this->databaseRepository->setColumns('id')->findWhere([['server_id', '=', $server->id]])->each(function ($item) {
112-
$this->databaseManagementService->delete($item->id);
113+
try {
114+
$this->databaseManagementService->delete($item->id);
115+
} catch (Exception $exception) {
116+
if ($this->force) {
117+
$this->writer->warning($exception);
118+
} else {
119+
throw $exception;
120+
}
121+
}
113122
});
114123

115124
$this->repository->delete($server->id);

0 commit comments

Comments
 (0)