errorhandler improvement

This commit is contained in:
kremsy 2014-02-15 18:26:31 +01:00 committed by Steffen Schröder
parent 9d56ed209a
commit e1eeee1e4c
2 changed files with 36 additions and 12 deletions

View File

@ -37,18 +37,25 @@ class ErrorHandler {
$message .= "Trace: {$ex->getTraceAsString()}" . PHP_EOL; $message .= "Trace: {$ex->getTraceAsString()}" . PHP_EOL;
logMessage($message); logMessage($message);
$error = array();
$error["Type"] = "Exception"; $error["Type"] = "Exception";
$error["Message"] = $message; $error["Message"] = $message;
$error['ManiaControlVersion'] = ManiaControl::VERSION;
$error['OperatingSystem'] = php_uname(); $error['OperatingSystem'] = php_uname();
$error['PHPVersion'] = phpversion(); $error['PHPVersion'] = phpversion();
if ($this->maniaControl->server != null) { if ($this->maniaControl->server != null) {
$error['ServerLogin'] = $this->maniaControl->server->login; $error['ServerLogin'] = $this->maniaControl->server->login;
} else { } else {
$error['ServerLogin'] = null; $error['ServerLogin'] = null;
} }
if ($this->maniaControl->settingManager != null && $this->maniaControl->updateManager != null) {
$error['UpdateChannel'] = $this->maniaControl->settingManager->getSetting($this->maniaControl->updateManager, UpdateManager::SETTING_UPDATECHECK_CHANNEL);
$error['ManiaControlVersion'] = $this->maniaControl->updateManager->getCurrentBuildDate();
} else {
$error['UpdateChannel'] = null;
$error['ManiaControlVersion'] = ManiaControl::VERSION;
}
$json = json_encode($error); $json = json_encode($error);
$info = base64_encode($json); $info = base64_encode($json);
@ -89,15 +96,23 @@ class ErrorHandler {
$error = array(); $error = array();
$error["Type"] = "Error"; $error["Type"] = "Error";
$error["Message"] = $message; $error["Message"] = $message;
$error['ManiaControlVersion'] = ManiaControl::VERSION;
$error['OperatingSystem'] = php_uname(); $error['OperatingSystem'] = php_uname();
$error['PHPVersion'] = phpversion(); $error['PHPVersion'] = phpversion();
if ($this->maniaControl->server != null) { if ($this->maniaControl->server != null) {
$error['ServerLogin'] = $this->maniaControl->server->login; $error['ServerLogin'] = $this->maniaControl->server->login;
} else { } else {
$error['ServerLogin'] = null; $error['ServerLogin'] = null;
} }
if ($this->maniaControl->settingManager != null && $this->maniaControl->updateManager != null) {
$error['UpdateChannel'] = $this->maniaControl->settingManager->getSetting($this->maniaControl->updateManager, UpdateManager::SETTING_UPDATECHECK_CHANNEL);
$error['ManiaControlVersion'] = $this->maniaControl->updateManager->getCurrentBuildDate();
} else {
$error['UpdateChannel'] = null;
$error['ManiaControlVersion'] = ManiaControl::VERSION;
}
$json = json_encode($error); $json = json_encode($error);
$info = base64_encode($json); $info = base64_encode($json);

View File

@ -225,6 +225,15 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
return $fileContent; return $fileContent;
} }
/**
* Get the CurrentBuildDate
*
* @return string
*/
public function getCurrentBuildDate() {
return $this->currentBuildDate;
}
/** /**
* Set the Build Date of the local Nightly Build Version * Set the Build Date of the local Nightly Build Version
* *