Added version check to startup

This commit is contained in:
Max Klaversma 2014-04-14 12:18:44 +02:00 committed by Steffen Schröder
parent 2bbcbf1d72
commit 76d888c8b1

View File

@ -45,6 +45,7 @@ class ManiaControl implements CommandListener, TimerListener {
*/
const VERSION = '0.01';
const API_VERSION = '2013-04-16';
const MIN_DEDIVERSION = '2014-04-02_18_00';
const OS_UNIX = 'Unix';
const OS_WIN = 'Windows';
const CONNECT_TIMEOUT = 50;
@ -293,6 +294,12 @@ class ManiaControl implements CommandListener, TimerListener {
// Connect to server
$this->connect();
// Check if the version of the server is high enough
$version = $this->client->getVersion();
if($version->build < self::MIN_DEDIVERSION) {
trigger_error("The server has version ".$version->build.", while at least ".self::MIN_DEDIVERSION." is required!", E_USER_ERROR);
}
// OnInit callback
$this->callbackManager->triggerCallback(CallbackManager::CB_ONINIT);