Example #1
0
 public function thereIsTeamspeakInstance($instanceId, $name = 'Test', $server = 'test4@127.0.0.1', $port = 9887, $slots = 2, $flush = true)
 {
     $parts = explode('@', $server);
     $machine = $this->findOneBy('machine', array('username' => $parts[0]));
     $server = $this->findOneBy('teamspeak', array('machine' => $machine->getId()));
     if (null === ($instance = $this->getRepository('instance', 'teamspeak')->findOneBy(array('server' => $server->getId())))) {
         $instance = new TeamspeakServerInstance($server);
         $instance->setInstanceId($instanceId);
         $instance->setName($name);
         $instance->setPort($port);
         $instance->setMaxClients($slots);
         $instance->setAdminToken('test');
         $instance->setAutostart(true);
         $this->validate($server);
         $this->getEntityManager()->persist($server);
         if ($flush) {
             $this->getEntityManager()->flush();
         }
     }
     return $instance;
 }
Example #2
0
 public function getInstanceParams(TeamspeakServerInstance $instance)
 {
     $params = ['virtualserver_name' => $instance->getFullName(), 'virtualserver_maxclients' => $instance->getMaxClients(), 'virtualserver_autostart' => intval($instance->isAutostart()), 'virtualserver_port' => $instance->getPort(), 'virtualserver_password' => $instance->getPassword(), 'virtualserver_welcomemessage' => $instance->getBanner()];
     return array_merge($params, $this->getHostButtonParams($instance));
 }