daemonServerRepository = $daemonServerRepository; $this->database = $database; $this->repository = $repository; } /** * @param int|\Pterodactyl\Models\Server $server * * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function reinstall($server) { if (! $server instanceof Server) { $server = $this->repository->find($server); } $this->database->beginTransaction(); $this->repository->withoutFreshModel()->update($server->id, [ 'installed' => 0, ], true, true); try { $this->daemonServerRepository->setServer($server)->reinstall(); $this->database->commit(); } catch (RequestException $exception) { throw new DaemonConnectionException($exception); } } }