mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-26 11:02:31 +01:00
cbcf62086f
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
36 lines
869 B
PHP
36 lines
869 B
PHP
<?php
|
|
|
|
namespace Pterodactyl\Services\Servers;
|
|
|
|
use Pterodactyl\Models\Server;
|
|
use Illuminate\Database\ConnectionInterface;
|
|
use Pterodactyl\Repositories\Wings\DaemonServerRepository;
|
|
|
|
class ReinstallServerService
|
|
{
|
|
/**
|
|
* ReinstallService constructor.
|
|
*/
|
|
public function __construct(
|
|
private ConnectionInterface $connection,
|
|
private DaemonServerRepository $daemonServerRepository
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* Reinstall a server on the remote daemon.
|
|
*
|
|
* @throws \Throwable
|
|
*/
|
|
public function handle(Server $server): Server
|
|
{
|
|
return $this->connection->transaction(function () use ($server) {
|
|
$server->fill(['status' => Server::STATUS_INSTALLING])->save();
|
|
|
|
$this->daemonServerRepository->setServer($server)->reinstall();
|
|
|
|
return $server->refresh();
|
|
});
|
|
}
|
|
}
|