mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-18 22:33:44 +02:00
Add ServerTransferringException, use is_null
This commit is contained in:
@@ -7,6 +7,7 @@ use Pterodactyl\Models\Server;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Pterodactyl\Repositories\Wings\DaemonServerRepository;
|
||||
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
|
||||
use Pterodactyl\Exceptions\Http\Server\ServerTransferringException;
|
||||
|
||||
class SuspensionService
|
||||
{
|
||||
@@ -58,8 +59,8 @@ class SuspensionService
|
||||
}
|
||||
|
||||
// Check if the server is currently being transferred.
|
||||
if ($server->transfer !== null) {
|
||||
throw new ConflictHttpException('Server is currently being transferred');
|
||||
if (! is_null($server->transfer)) {
|
||||
throw new ServerTransferringException();
|
||||
}
|
||||
|
||||
$this->connection->transaction(function () use ($action, $server) {
|
||||
@@ -68,7 +69,7 @@ class SuspensionService
|
||||
]);
|
||||
|
||||
// Only send the suspension request to wings if the server is not currently being transferred.
|
||||
if ($server->transfer === null) {
|
||||
if (is_null($server->transfer)) {
|
||||
$this->daemonServerRepository->setServer($server)->suspend($action === self::ACTION_UNSUSPEND);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user