added dedibuild to error and usage reporting

This commit is contained in:
kremsy
2017-03-26 13:58:23 +02:00
parent f2ab40a50f
commit d46eb59fb9
5 changed files with 150 additions and 142 deletions

View File

@ -27,7 +27,7 @@ class ErrorHandler {
* Private properties
*/
/** @var ManiaControl $maniaControl */
private $maniaControl = null;
private $maniaControl = null;
private $handlingError = null;
/**
@ -144,6 +144,8 @@ class ErrorHandler {
$report['ManiaControlVersion'] = ManiaControl::VERSION;
}
$report['DedicatedBuildVersion'] = $this->maniaControl->getDedicatedServerBuildVersion();
$json = json_encode(Formatter::utf8($report));
$info = base64_encode($json);
@ -235,7 +237,7 @@ class ErrorHandler {
$traceString = '';
$stepCount = 0;
foreach ($backtrace as $traceStep) {
$skipStep = $this->shouldSkipTraceStep($traceStep);
$skipStep = $this->shouldSkipTraceStep($traceStep);
$traceString .= '#' . $stepCount . ': ';
if (isset($traceStep['class'])) {
if (!$sourceClass && !$skipStep && !$this->isIgnoredSourceClass($traceStep['class'])) {
@ -329,7 +331,7 @@ class ErrorHandler {
} else if (is_array($arg)) {
$string .= 'array(' . $this->parseArgumentsArray($arg) . ')';
} else {
$type = gettype($arg);
$type = gettype($arg);
$string .= $type . '(';
if (is_string($arg)) {
$param = $arg;
@ -438,6 +440,8 @@ class ErrorHandler {
$report['ManiaControlVersion'] = ManiaControl::VERSION;
}
$report['DedicatedBuildVersion'] = $this->maniaControl->getDedicatedServerBuildVersion();
$errorReport = json_encode(Formatter::utf8($report));
$url = ManiaControl::URL_WEBSERVICE . 'errorreport';

View File

@ -183,6 +183,8 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
/** @var ModeScriptEventManager $modeScriptEventManager */
private $modeScriptEventManager = null;
private $dedicatedServerBuildVersion = "";
/**
* Construct a new ManiaControl instance
*/
@ -216,7 +218,6 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
$this->pluginManager = new PluginManager($this);
$this->updateManager = new UpdateManager($this);
$this->getErrorHandler()->init();
// Permissions
@ -565,6 +566,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
$this->requestQuitMessage = $message;
}
/**
* Run ManiaControl
*/
@ -576,9 +578,10 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
$this->connect();
// Check if the version of the server is high enough
$version = $this->getClient()->getVersion();
if ($version->build < self::MIN_DEDIVERSION) {
$this->quit("The Server has Version '{$version->build}', while at least '" . self::MIN_DEDIVERSION . "' is required!", true);
$version = $this->getClient()->getVersion();
$this->dedicatedServerBuildVersion = $version->build;
if ($this->dedicatedServerBuildVersion < self::MIN_DEDIVERSION) {
$this->quit("The Server has Version '{$this->dedicatedServerBuildVersion}', while at least '" . self::MIN_DEDIVERSION . "' is required!", true);
}
// Listen for shutdown
@ -651,6 +654,16 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
$this->getServer()->getScriptManager()->enableScriptCallbacks();
}
/**
* Get The Build Version of the Dedicated Server
*
* @return string
*/
public function getDedicatedServerBuildVersion() {
return $this->dedicatedServerBuildVersion;
}
/**
* Return the server
*

View File

@ -51,19 +51,21 @@ class UsageReporter implements TimerListener {
return;
}
$properties = array();
$properties['ManiaControlVersion'] = ManiaControl::VERSION;
$properties['OperatingSystem'] = php_uname();
$properties['PHPVersion'] = phpversion();
$properties['ServerLogin'] = $this->maniaControl->getServer()->login;
$properties['TitleId'] = $this->maniaControl->getServer()->titleId;
$properties['ServerName'] = Formatter::stripDirtyCodes($this->maniaControl->getClient()->getServerName());
$properties['UpdateChannel'] = $this->maniaControl->getUpdateManager()->getCurrentUpdateChannelSetting();
$properties = array();
$properties['ManiaControlVersion'] = ManiaControl::VERSION;
$properties['OperatingSystem'] = php_uname();
$properties['PHPVersion'] = phpversion();
$properties['ServerLogin'] = $this->maniaControl->getServer()->login;
$properties['TitleId'] = $this->maniaControl->getServer()->titleId;
$properties['ServerName'] = Formatter::stripDirtyCodes($this->maniaControl->getClient()->getServerName());
$properties['UpdateChannel'] = $this->maniaControl->getUpdateManager()->getCurrentUpdateChannelSetting();
$properties['DedicatedBuildVersion'] = $this->maniaControl->getDedicatedServerBuildVersion();
$properties['PlayerCount'] = $this->maniaControl->getPlayerManager()->getPlayerCount();
$properties['MemoryUsage'] = memory_get_usage();
$properties['MemoryPeakUsage'] = memory_get_peak_usage();
$maxPlayers = $this->maniaControl->getClient()->getMaxPlayers();
$properties['MaxPlayers'] = $maxPlayers['CurrentValue'];