FIx force deletion
This commit is contained in:
parent
446d5be62b
commit
c96bad4080
1 changed files with 5 additions and 12 deletions
|
@ -4,7 +4,6 @@ namespace Pterodactyl\Services\Servers;
|
|||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Pterodactyl\Models\Server;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Pterodactyl\Repositories\Eloquent\ServerRepository;
|
||||
use Pterodactyl\Repositories\Eloquent\DatabaseRepository;
|
||||
|
@ -100,17 +99,11 @@ class ServerDeletionService
|
|||
{
|
||||
try {
|
||||
$this->daemonServerRepository->setServer($server)->delete();
|
||||
} catch (RequestException $exception) {
|
||||
$response = $exception->getResponse();
|
||||
|
||||
if (is_null($response) || (! is_null($response) && $response->getStatusCode() !== 404)) {
|
||||
// If not forcing the deletion, throw an exception, otherwise just log it and
|
||||
// continue with server deletion process in the panel.
|
||||
if (! $this->force) {
|
||||
throw new DaemonConnectionException($exception);
|
||||
} else {
|
||||
$this->writer->warning($exception);
|
||||
}
|
||||
} catch (DaemonConnectionException $exception) {
|
||||
if ($this->force) {
|
||||
$this->writer->warning($exception);
|
||||
} else {
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue