catch transport exception on restart-shutdown

This commit is contained in:
Steffen Schröder 2014-08-25 15:10:46 +02:00
parent 7046335893
commit bdf503d7fc

View File

@ -167,18 +167,6 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
$this->getTimerManager()->registerTimerListening($this, 'checkConnection', 1000 * 30); $this->getTimerManager()->registerTimerListening($this, 'checkConnection', 1000 * 30);
} }
/**
* Print a message to console and log
*
* @param string $message
* @param bool $stripCodes
* @deprecated
* @see Logger::log()
*/
public function log($message, $stripCodes = false) {
Logger::log($message, $stripCodes);
}
/** /**
* Load the Config XML-File * Load the Config XML-File
*/ */
@ -208,12 +196,21 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
} }
/** /**
* Return the actions menu * Return the client
* *
* @return ActionsMenu * @return Connection
*/ */
public function getActionsMenu() { public function getClient() {
return $this->actionsMenu; return $this->client;
}
/**
* Return the error handler
*
* @return ErrorHandler
*/
public function getErrorHandler() {
return $this->errorHandler;
} }
/** /**
@ -226,21 +223,42 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
} }
/** /**
* Return the callback manager * Return the command manager
* *
* @return CallbackManager * @return CommandManager
*/ */
public function getCallbackManager() { public function getCommandManager() {
return $this->callbackManager; return $this->commandManager;
} }
/** /**
* Return the chat * Return the timer manager
* *
* @return Chat * @return TimerManager
*/ */
public function getChat() { public function getTimerManager() {
return $this->chat; return $this->timerManager;
}
/**
* Print a message to console and log
*
* @param string $message
* @param bool $stripCodes
* @deprecated
* @see Logger::log()
*/
public function log($message, $stripCodes = false) {
Logger::log($message, $stripCodes);
}
/**
* Return the actions menu
*
* @return ActionsMenu
*/
public function getActionsMenu() {
return $this->actionsMenu;
} }
/** /**
@ -261,24 +279,6 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
return $this->configurator; return $this->configurator;
} }
/**
* Return the client
*
* @return Connection
*/
public function getClient() {
return $this->client;
}
/**
* Return the command manager
*
* @return CommandManager
*/
public function getCommandManager() {
return $this->commandManager;
}
/** /**
* Return the database * Return the database
* *
@ -315,24 +315,6 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
return $this->playerManager; return $this->playerManager;
} }
/**
* Return the plugin manager
*
* @return PluginManager
*/
public function getPluginManager() {
return $this->pluginManager;
}
/**
* Return the server
*
* @return Server
*/
public function getServer() {
return $this->server;
}
/** /**
* Return the setting manager * Return the setting manager
* *
@ -351,42 +333,6 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
return $this->statisticManager; return $this->statisticManager;
} }
/**
* Return the update manager
*
* @return UpdateManager
*/
public function getUpdateManager() {
return $this->updateManager;
}
/**
* Return the error handler
*
* @return ErrorHandler
*/
public function getErrorHandler() {
return $this->errorHandler;
}
/**
* Return the timer manager
*
* @return TimerManager
*/
public function getTimerManager() {
return $this->timerManager;
}
/**
* Return the file reader
*
* @return AsynchronousFileReader
*/
public function getFileReader() {
return $this->fileReader;
}
/** /**
* Return the bill manager * Return the bill manager
* *
@ -417,6 +363,15 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
$this->getChat()->sendInformation($message, $player); $this->getChat()->sendInformation($message, $player);
} }
/**
* Return the chat
*
* @return Chat
*/
public function getChat() {
return $this->chat;
}
/** /**
* Handle Restart AdminCommand * Handle Restart AdminCommand
* *
@ -445,13 +400,12 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
if ($message) { if ($message) {
Logger::log($message); Logger::log($message);
} }
$this->getChat()->sendInformation('Restarting ManiaControl...'); try {
Logger::log('Restarting ManiaControl!'); $this->getChat()->sendInformation('Restarting ManiaControl...');
// Hide widgets
if ($this->getClient()) {
$this->getClient()->sendHideManialinkPage(); $this->getClient()->sendHideManialinkPage();
} catch (TransportException $exception) {
} }
Logger::log('Restarting ManiaControl!');
// Start new instance // Start new instance
SystemUtil::restart(); SystemUtil::restart();
@ -460,6 +414,15 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
$this->quit('Quitting ManiaControl to restart.'); $this->quit('Quitting ManiaControl to restart.');
} }
/**
* Return the callback manager
*
* @return CallbackManager
*/
public function getCallbackManager() {
return $this->callbackManager;
}
/** /**
* Handle Shutdown Command * Handle Shutdown Command
* *
@ -568,6 +531,33 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
$this->getServer()->getScriptManager()->enableScriptCallbacks(); $this->getServer()->getScriptManager()->enableScriptCallbacks();
} }
/**
* Return the server
*
* @return Server
*/
public function getServer() {
return $this->server;
}
/**
* Return the plugin manager
*
* @return PluginManager
*/
public function getPluginManager() {
return $this->pluginManager;
}
/**
* Return the update manager
*
* @return UpdateManager
*/
public function getUpdateManager() {
return $this->updateManager;
}
/** /**
* Perform the Main Loop * Perform the Main Loop
*/ */
@ -596,6 +586,15 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
} }
} }
/**
* Return the file reader
*
* @return AsynchronousFileReader
*/
public function getFileReader() {
return $this->fileReader;
}
/** /**
* Handle Server Stop Callback * Handle Server Stop Callback
*/ */