mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-15 12:53:44 +02:00
Remove unnecessary API calls to daemon
This commit is contained in:
@@ -6,17 +6,11 @@ use Illuminate\Http\Response;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Services\Servers\SuspensionService;
|
||||
use Pterodactyl\Services\Servers\ReinstallServerService;
|
||||
use Pterodactyl\Services\Servers\ContainerRebuildService;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest;
|
||||
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
|
||||
|
||||
class ServerManagementController extends ApplicationApiController
|
||||
{
|
||||
/**
|
||||
* @var \Pterodactyl\Services\Servers\ContainerRebuildService
|
||||
*/
|
||||
private $rebuildService;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Services\Servers\ReinstallServerService
|
||||
*/
|
||||
@@ -30,18 +24,15 @@ class ServerManagementController extends ApplicationApiController
|
||||
/**
|
||||
* SuspensionController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Servers\ContainerRebuildService $rebuildService
|
||||
* @param \Pterodactyl\Services\Servers\ReinstallServerService $reinstallServerService
|
||||
* @param \Pterodactyl\Services\Servers\SuspensionService $suspensionService
|
||||
*/
|
||||
public function __construct(
|
||||
ContainerRebuildService $rebuildService,
|
||||
ReinstallServerService $reinstallServerService,
|
||||
SuspensionService $suspensionService
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
$this->rebuildService = $rebuildService;
|
||||
$this->reinstallServerService = $reinstallServerService;
|
||||
$this->suspensionService = $suspensionService;
|
||||
}
|
||||
@@ -53,9 +44,7 @@ class ServerManagementController extends ApplicationApiController
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function suspend(ServerWriteRequest $request, Server $server): Response
|
||||
{
|
||||
@@ -71,9 +60,7 @@ class ServerManagementController extends ApplicationApiController
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function unsuspend(ServerWriteRequest $request, Server $server): Response
|
||||
{
|
||||
@@ -99,20 +86,4 @@ class ServerManagementController extends ApplicationApiController
|
||||
|
||||
return $this->returnNoContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a server as needing its container rebuilt the next time it is started.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function rebuild(ServerWriteRequest $request, Server $server): Response
|
||||
{
|
||||
$this->rebuildService->handle($server);
|
||||
|
||||
return $this->returnNoContent();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user