diff --git a/application/core/ErrorHandler.php b/application/core/ErrorHandler.php index fac4e541..5c07bd03 100644 --- a/application/core/ErrorHandler.php +++ b/application/core/ErrorHandler.php @@ -37,18 +37,25 @@ class ErrorHandler { $message .= "Trace: {$ex->getTraceAsString()}" . PHP_EOL; logMessage($message); - $error = array(); - $error["Type"] = "Exception"; - $error["Message"] = $message; - $error['ManiaControlVersion'] = ManiaControl::VERSION; - $error['OperatingSystem'] = php_uname(); - $error['PHPVersion'] = phpversion(); + $error["Type"] = "Exception"; + $error["Message"] = $message; + $error['OperatingSystem'] = php_uname(); + $error['PHPVersion'] = phpversion(); + if ($this->maniaControl->server != null) { $error['ServerLogin'] = $this->maniaControl->server->login; } else { $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); $info = base64_encode($json); @@ -86,18 +93,26 @@ class ErrorHandler { logMessage($message); if ($errorNumber != E_USER_ERROR && $errorNumber != E_USER_WARNING && $errorNumber != E_USER_NOTICE) { - $error = array(); - $error["Type"] = "Error"; - $error["Message"] = $message; - $error['ManiaControlVersion'] = ManiaControl::VERSION; - $error['OperatingSystem'] = php_uname(); - $error['PHPVersion'] = phpversion(); + $error = array(); + $error["Type"] = "Error"; + $error["Message"] = $message; + $error['OperatingSystem'] = php_uname(); + $error['PHPVersion'] = phpversion(); + if ($this->maniaControl->server != null) { $error['ServerLogin'] = $this->maniaControl->server->login; } else { $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); $info = base64_encode($json); diff --git a/application/core/Update/UpdateManager.php b/application/core/Update/UpdateManager.php index 0c938add..62355315 100644 --- a/application/core/Update/UpdateManager.php +++ b/application/core/Update/UpdateManager.php @@ -225,6 +225,15 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener return $fileContent; } + /** + * Get the CurrentBuildDate + * + * @return string + */ + public function getCurrentBuildDate() { + return $this->currentBuildDate; + } + /** * Set the Build Date of the local Nightly Build Version *