format test

This commit is contained in:
kremsy 2014-01-27 17:29:48 +01:00 committed by Steffen Schröder
parent 6850804d61
commit 4c6a8862d8

View File

@ -14,10 +14,10 @@ use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager; use ManiaControl\Players\PlayerManager;
use ManiaControl\Plugins\PluginManager; use ManiaControl\Plugins\PluginManager;
use ManiaControl\Server\Server; use ManiaControl\Server\Server;
use ManiaControl\Settings\SettingManager;
use ManiaControl\Statistics\StatisticManager; use ManiaControl\Statistics\StatisticManager;
use Maniaplanet\DedicatedServer\Connection; use Maniaplanet\DedicatedServer\Connection;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception; use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
use ManiaControl\Settings\SettingManager;
require_once __DIR__ . '/Maniaplanet/DedicatedServer/Connection.php'; require_once __DIR__ . '/Maniaplanet/DedicatedServer/Connection.php';
require_once __DIR__ . '/GbxDataFetcher/gbxdatafetcher.inc.php'; require_once __DIR__ . '/GbxDataFetcher/gbxdatafetcher.inc.php';
@ -50,9 +50,7 @@ class ManiaControl implements CommandListener {
public $chat = null; public $chat = null;
public $config = null; public $config = null;
public $configurator = null; public $configurator = null;
/** /** @var Connection $client */
* @var Connection $client
*/
public $client = null; public $client = null;
public $commandManager = null; public $commandManager = null;
public $database = null; public $database = null;
@ -232,8 +230,7 @@ class ManiaControl implements CommandListener {
if($this->getOS(self::OS_UNIX)) { if($this->getOS(self::OS_UNIX)) {
$command = 'sh ' . escapeshellarg(ManiaControlDir . '/ManiaControl.sh') . ' > /dev/null &'; $command = 'sh ' . escapeshellarg(ManiaControlDir . '/ManiaControl.sh') . ' > /dev/null &';
exec($command); exec($command);
} } else {
else {
$command = escapeshellarg(ManiaControlDir . "\ManiaControl.bat"); $command = escapeshellarg(ManiaControlDir . "\ManiaControl.bat");
system($command); // TODO, windows stucks here as long controller is running system($command); // TODO, windows stucks here as long controller is running
} }
@ -317,16 +314,14 @@ class ManiaControl implements CommandListener {
try { try {
$this->client = Connection::factory($host, $port, self::CONNECT_TIMEOUT, $login, $pass); $this->client = Connection::factory($host, $port, self::CONNECT_TIMEOUT, $login, $pass);
} } catch(Exception $e) {
catch (Exception $e) {
trigger_error("Couldn't authenticate on server with user '{$login}'! " . $e->getMessage(), E_USER_ERROR); trigger_error("Couldn't authenticate on server with user '{$login}'! " . $e->getMessage(), E_USER_ERROR);
} }
// Enable callback system // Enable callback system
try { try {
$this->client->enableCallbacks(true); $this->client->enableCallbacks(true);
} } catch(Exception $e) {
catch (Exception $e) {
trigger_error("Couldn't enable callbacks! " . $e->getMessage(), E_USER_ERROR); trigger_error("Couldn't enable callbacks! " . $e->getMessage(), E_USER_ERROR);
} }
@ -354,8 +349,7 @@ class ManiaControl implements CommandListener {
try { try {
$scriptSettings = $this->client->getModeScriptSettings(); $scriptSettings = $this->client->getModeScriptSettings();
} } catch(Exception $e) {
catch (Exception $e) {
trigger_error("Couldn't get mode script settings. " . $e->getMessage()); trigger_error("Couldn't get mode script settings. " . $e->getMessage());
return; return;
} }
@ -367,8 +361,7 @@ class ManiaControl implements CommandListener {
$scriptSettings['S_UseScriptCallbacks'] = true; $scriptSettings['S_UseScriptCallbacks'] = true;
try { try {
$this->client->setModeScriptSettings($scriptSettings); $this->client->setModeScriptSettings($scriptSettings);
} } catch(Exception $e) {
catch (Exception $e) {
trigger_error("Couldn't set mode script settings to enable script callbacks. " . $e->getMessage()); trigger_error("Couldn't set mode script settings to enable script callbacks. " . $e->getMessage());
return; return;
} }