Don't prevent deletion if a DB host is unreachable and it is a force delete; closes #2085
This commit is contained in:
parent
4a0627d182
commit
066ed5cdda
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Services\Servers;
|
namespace Pterodactyl\Services\Servers;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Pterodactyl\Models\Server;
|
use Pterodactyl\Models\Server;
|
||||||
use Illuminate\Database\ConnectionInterface;
|
use Illuminate\Database\ConnectionInterface;
|
||||||
|
@ -109,7 +110,15 @@ class ServerDeletionService
|
||||||
|
|
||||||
$this->connection->transaction(function () use ($server) {
|
$this->connection->transaction(function () use ($server) {
|
||||||
$this->databaseRepository->setColumns('id')->findWhere([['server_id', '=', $server->id]])->each(function ($item) {
|
$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);
|
$this->repository->delete($server->id);
|
||||||
|
|
Loading…
Reference in New Issue