Example #1
0
 public function commandFormSubmitted(Nette\Application\UI\Form $form)
 {
     $command = $form->getValues()->command;
     $this->serverCmd->issueCommand($command, $this->runtimeHash);
     //TODO make it less ugly and more reliable
     usleep(500000);
     if ($this->isAjax()) {
         $this->redrawControl();
     } else {
         $this->redirect('this');
     }
 }
Example #2
0
 /**
  * Internal. Backup running server
  * @param string $path
  * @param string $hash runtimeHash
  * @param string $filename
  * @return boolean
  */
 private function backupRunning($path, $hash, $filename)
 {
     try {
         $phar = new PharData($path . 'backups/' . $filename . '.zip');
         $this->serverCmd->issueCommand('save-all', $hash);
         $this->serverCmd->issueCommand('save-off', $hash);
         $phar->buildFromDirectory($path . 'world/');
         $this->serverCmd->issueCommand('save-on', $hash);
         return TRUE;
     } catch (UnexpectedValueException $e) {
         echo $e->getMessage();
         return FALSE;
     }
 }
Example #3
0
 /**
  * @param string $command 'op' | 'deop'
  * @param int $userId
  * @param string $runhash
  */
 private function callCommand($command, $userId, $runhash)
 {
     $mcname = $this->userRepo->findById($userId)->fetch()->mcname;
     $this->serverComm->issueCommand($command . ' ' . $mcname, $runhash);
 }