Exemplo n.º 1
0
 /**
  * This method will be called if this command is triggered
  *
  * @param ArgumentsContainer $arguments
  *
  * @return mixed
  */
 public function execute(ArgumentsContainer $arguments)
 {
     if (ServerHelper::isRunning()) {
         $this->outputDriver->send('[info]The server is running[/info]' . PHP_EOL);
         exit(0);
     } else {
         $this->outputDriver->send('[error]The server is not running[/error]' . PHP_EOL, [], true);
         exit(1);
     }
 }
Exemplo n.º 2
0
 /**
  * This method will be called if this command is triggered
  *
  * @param ArgumentsContainer $arguments
  *
  * @return mixed
  */
 public function execute(ArgumentsContainer $arguments)
 {
     if (!ServerHelper::isRunning()) {
         $this->outputDriver->send('[error]Server is not running[/error]' . PHP_EOL, [], true);
         exit(1);
     }
     $process = new Process(ServerHelper::getServerPID());
     if ($process->sendSignal(new Signal(Signal::KILL))) {
         $this->outputDriver->send('[success]Server will stop shortly[/success]' . PHP_EOL);
         exit(0);
     } else {
         $this->outputDriver->send('[error]The server is not responding[/error]' . PHP_EOL, [], true);
         exit(1);
     }
 }
Exemplo n.º 3
0
 /**
  * This method will be called if this command is triggered
  *
  * @param ArgumentsContainer $arguments
  *
  * @return mixed
  */
 public function execute(ArgumentsContainer $arguments)
 {
     if (!ServerHelper::isRunning()) {
         $this->outputDriver->send('[error]Server is not running[/error]' . PHP_EOL, [], true);
         exit(1);
     }
     $process = new Process(ServerHelper::getServerPID());
     if ($process->sendSignal(new Signal(Signal::KILL))) {
         sleep(1);
         Exec::viaPipe('bin/thinframe server start --daemon', KARMA_ROOT);
         $this->outputDriver->send('[info]The server will start shortly[/info]' . PHP_EOL);
         exit(0);
     } else {
         $this->outputDriver->send('[error]The server is not responding[/error]' . PHP_EOL, [], true);
         exit(1);
     }
 }
Exemplo n.º 4
0
 /**
  * This method will be called if this command is triggered
  *
  * @param ArgumentsContainer $arguments
  *
  * @return mixed
  */
 public function execute(ArgumentsContainer $arguments)
 {
     if ($arguments->getOption('daemon')) {
         if (!ServerHelper::isRunning()) {
             Exec::viaPipe('bin/thinframe server start > /dev/null 2>&1 &', KARMA_ROOT);
             sleep(2);
         }
         if (ServerHelper::isRunning()) {
             $this->outputDriver->send('[success]Server is listening at {host}:{port}[/success]' . PHP_EOL, ['host' => $this->server->getHost(), 'port' => $this->server->getPort()]);
             exit(0);
         } else {
             $this->outputDriver->send('[error]Failed to start server[/error]' . PHP_EOL, [], true);
             exit(1);
         }
     }
     $this->dispatcher->trigger(new SimpleEvent('thinframe.server.pre_start'));
     $this->outputDriver->send('[success]Server will start listening at {host}:{port}[/success]' . PHP_EOL, ['host' => $this->server->getHost(), 'port' => $this->server->getPort()]);
     ServerHelper::savePID();
     $this->server->start();
 }