Files

24 lines
667 B
PHP
Raw Permalink Normal View History

2026-10-08 17:40:00 -04:00
<?php
declare(strict_types=1);
namespace Pterodactyl\Actions\Servers;
use Pterodactyl\Contracts\Servers\TogglesServerInstallStatus;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\Server;
final readonly class ToggleServerInstallStatus implements TogglesServerInstallStatus
{
public function toggle(Server $server): void
{
if ($server->status === Server::STATUS_INSTALL_FAILED) {
throw new DisplayException(trans('admin/server.exceptions.marked_as_failed'));
}
$server->forceFill([
'status' => $server->isInstalled() ? Server::STATUS_INSTALLING : null,
])->saveOrFail();
}
}