/** * stops server and delete runtime hash * @param string $runtimeHash * @return array usually empty if command was successfull */ public function stopServer($runtimeHash) { $output = $this->issueCommand('stop', $runtimeHash); $this->serverRepo->removeRuntimeHash($runtimeHash); sleep(1); return $output; }
/** * @param string $url * @param string $version */ public function handleDownload($url, $version) { $filename = $this->gameUpdater->download($url, $this->path, $version); if ($this->immediateUse) { $this->serverRepo->setExecutable($this->serverId, $filename); } $this->getPresenter()->flashMessage('Staženo.', 'success'); if ($this->getPresenter()->isAjax()) { $this->getPresenter()->redrawControl(); } else { $this->getPresenter()->redirect('this'); } }
public function renderDefault() { $this->template->badPath = FALSE; try { $this->template->avJars = $this->gameUpdater->getAvailableJars($this->path); $this->template->maxJars = $this->configModel['update']['number'] <= count($this->template->avJars); } catch (UnexpectedValueException $e) { $this->flashMessage('Máte špatně nastavenou cestu!', 'error'); $this->template->badPath = TRUE; } $exec = $this->serverRepo->getRunParams($this->selectedServerId)->executable; $this->template->active = $this->gameUpdater->getVersionFromFileName($exec); }
public function handleRestoreBackup($file) { $executable = $this->serverRepo->getRunParams($this->selectedServerId)->executable; if ($this->backupModel->restore($this->path, $file, $this->runtimeHash, $executable)) { $this->flashMessage('Obnova úspěšná.', 'success'); } else { $this->flashMessage('Něco se nepovedlo :/ ' . $file, 'error'); } if ($this->isAjax()) { $this->redrawControl(); } else { $this->redirect('this'); } }
public function render() { $this->template->setFile(__DIR__ . '/ServerList.latte'); if ($this->user) { $this->template->servers = $this->serverRepo->findBy(array('user_id' => $this->user->id)); $this->template->userId = $this->user; $this->template->allowedToStop = $this->user->isAllowed('commands', 'edit'); $this->template->allowedToDelete = $this->user->isAllowed('delete', 'edit'); } else { $this->template->servers = $this->serverRepo->findAll(); $this->template->userId = FALSE; $this->template->allowedToStop = TRUE; $this->template->allowedToDelete = TRUE; } $this->template->servers->order('id'); $this->template->registerHelper('getVersion', '\\gameUpdateModel::getVersionFromFileName'); $this->template->render(); }