Ejemplo n.º 1
0
 private function isServerAlive()
 {
     if ($this->runtimeHash != "" and $this->context->serverCommander->isServerRunning($this->runtimeHash) === FALSE) {
         $this->flashMessage('Server died :\'(', 'error');
         $this->runtimeHash = NULL;
         $this->serverRepo->setRuntimeHash($this->selectedServerId, '');
     }
 }
Ejemplo n.º 2
0
 public function handleStartServer()
 {
     //check if running
     if ($this->runtimeHash != NULL) {
         $this->flashMessage('Server is already running! Or it looks to be like that. :/', 'error');
     } else {
         //generte runtime hash
         $this->runtimeHash = $this->serverRepo->generateRuntimeHash();
         $this->serverRepo->setRuntimeHash($this->selectedServerId, $this->runtimeHash);
         //set correct values from settings
         $params = $this->serverRepo->getRunParams($this->selectedServerId);
         $out = $this->serverCmd->startServer($params->path, $params->executable, $this->runtimeHash);
         if ($out === array()) {
             $this->flashMessage('Server naběhl. Adresa pro připojení: ' . $this->hostIp . ':' . $params->port, 'success');
         } else {
             $this->flashMessage(implode(" \n", $out), 'error');
         }
     }
     $this->redirect('this');
 }