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['OperatingSystem'] = php_uname();
$error['ManiaControlVersion'] = ManiaControl::VERSION; $error['PHPVersion'] = phpversion();
$error['OperatingSystem'] = php_uname();
$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);
@ -86,18 +93,26 @@ class ErrorHandler {
logMessage($message); logMessage($message);
if ($errorNumber != E_USER_ERROR && $errorNumber != E_USER_WARNING && $errorNumber != E_USER_NOTICE) { if ($errorNumber != E_USER_ERROR && $errorNumber != E_USER_WARNING && $errorNumber != E_USER_NOTICE) {
$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
* *