FIx force deletion

This commit is contained in:
Dane Everitt 2019-12-22 15:08:11 -08:00
parent 446d5be62b
commit c96bad4080
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -4,7 +4,6 @@ namespace Pterodactyl\Services\Servers;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Database\ConnectionInterface; use Illuminate\Database\ConnectionInterface;
use Pterodactyl\Repositories\Eloquent\ServerRepository; use Pterodactyl\Repositories\Eloquent\ServerRepository;
use Pterodactyl\Repositories\Eloquent\DatabaseRepository; use Pterodactyl\Repositories\Eloquent\DatabaseRepository;
@ -100,17 +99,11 @@ class ServerDeletionService
{ {
try { try {
$this->daemonServerRepository->setServer($server)->delete(); $this->daemonServerRepository->setServer($server)->delete();
} catch (RequestException $exception) { } catch (DaemonConnectionException $exception) {
$response = $exception->getResponse(); if ($this->force) {
$this->writer->warning($exception);
if (is_null($response) || (! is_null($response) && $response->getStatusCode() !== 404)) { } else {
// If not forcing the deletion, throw an exception, otherwise just log it and throw $exception;
// continue with server deletion process in the panel.
if (! $this->force) {
throw new DaemonConnectionException($exception);
} else {
$this->writer->warning($exception);
}
} }
} }