error reporting
This commit is contained in:
parent
fd0790fc71
commit
0e118840fe
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
use ManiaControl\Files\FileUtil;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
|
use ManiaControl\UpdateManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error and Exception Manager Class
|
* Error and Exception Manager Class
|
||||||
@ -30,6 +32,25 @@ class ErrorHandler {
|
|||||||
public function exceptionHandler(\Exception $ex) {
|
public function exceptionHandler(\Exception $ex) {
|
||||||
$message = "[ManiaControl EXCEPTION]: {$ex->getMessage()} Trace: {$ex->getTraceAsString()}!";
|
$message = "[ManiaControl EXCEPTION]: {$ex->getMessage()} Trace: {$ex->getTraceAsString()}!";
|
||||||
logMessage($message);
|
logMessage($message);
|
||||||
|
|
||||||
|
$error = array();
|
||||||
|
$error["Type"] = "Exception";
|
||||||
|
$error["Message"] = $message;
|
||||||
|
$error['ManiaControlVersion'] = ManiaControl::VERSION;
|
||||||
|
$error['OperatingSystem'] = php_uname();
|
||||||
|
$error['PHPVersion'] = phpversion();
|
||||||
|
$error['SeverLogin'] = null;
|
||||||
|
|
||||||
|
$json = json_encode($error);
|
||||||
|
$info = base64_encode($json);
|
||||||
|
|
||||||
|
$url = UpdateManager::URL_WEBSERVICE . "errorreport?error=" . $info;
|
||||||
|
$success = FileUtil::loadFile($url);
|
||||||
|
|
||||||
|
if (!json_decode($success)) {
|
||||||
|
logMessage("Exception-Report failed");
|
||||||
|
}
|
||||||
|
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +73,25 @@ class ErrorHandler {
|
|||||||
$message = "{$errorTag}: {$errorString} in File '{$errorFile}' on Line {$errorLine}!";
|
$message = "{$errorTag}: {$errorString} in File '{$errorFile}' on Line {$errorLine}!";
|
||||||
logMessage($message);
|
logMessage($message);
|
||||||
if ($errorNumber == E_ERROR || $errorNumber == E_USER_ERROR) {
|
if ($errorNumber == E_ERROR || $errorNumber == E_USER_ERROR) {
|
||||||
|
|
||||||
|
$error = array();
|
||||||
|
$error["Type"] = "Error";
|
||||||
|
$error["Message"] = $message;
|
||||||
|
$error['ManiaControlVersion'] = ManiaControl::VERSION;
|
||||||
|
$error['OperatingSystem'] = php_uname();
|
||||||
|
$error['PHPVersion'] = phpversion();
|
||||||
|
$error['SeverLogin'] = $this->maniaControl->server->login;
|
||||||
|
|
||||||
|
$json = json_encode($error);
|
||||||
|
$info = base64_encode($json);
|
||||||
|
|
||||||
|
$url = UpdateManager::URL_WEBSERVICE . "errorreport?error=" . $info;
|
||||||
|
$success = FileUtil::loadFile($url);
|
||||||
|
|
||||||
|
if (!json_decode($success)) {
|
||||||
|
logMessage("Error-Report failed");
|
||||||
|
}
|
||||||
|
|
||||||
logMessage('Stopping execution...');
|
logMessage('Stopping execution...');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace ManiaControl\ManiaExchange;
|
namespace ManiaControl\ManiaExchange;
|
||||||
|
|
||||||
|
use ManiaControl\Formatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mania Exchange Map Info Object
|
* Mania Exchange Map Info Object
|
||||||
*
|
*
|
||||||
@ -11,7 +13,7 @@ namespace ManiaControl\ManiaExchange;
|
|||||||
class MXMapInfo {
|
class MXMapInfo {
|
||||||
public $prefix, $id, $uid, $name, $userid, $author, $uploaded, $updated, $type, $maptype;
|
public $prefix, $id, $uid, $name, $userid, $author, $uploaded, $updated, $type, $maptype;
|
||||||
public $titlepack, $style, $envir, $mood, $dispcost, $lightmap, $modname, $exever;
|
public $titlepack, $style, $envir, $mood, $dispcost, $lightmap, $modname, $exever;
|
||||||
public $exebld, $routes, $length, $unlimiter, $laps, $diffic, $lbrating, $trkvalue;
|
public $exebld, $routes, $length, $unlimiter, $laps, $difficulty, $lbrating, $trkvalue;
|
||||||
public $replaytyp, $replayid, $replaycnt, $acomment, $awards, $comments, $rating;
|
public $replaytyp, $replayid, $replaycnt, $acomment, $awards, $comments, $rating;
|
||||||
public $ratingex, $ratingcnt, $pageurl, $replayurl, $imageurl, $thumburl, $dloadurl;
|
public $ratingex, $ratingcnt, $pageurl, $replayurl, $imageurl, $thumburl, $dloadurl;
|
||||||
|
|
||||||
@ -37,7 +39,11 @@ class MXMapInfo {
|
|||||||
$this->id = $mx->MapID;
|
$this->id = $mx->MapID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($mx->GbxMapName) || $mx->GbxMapName == '') {
|
||||||
$this->name = $mx->Name;
|
$this->name = $mx->Name;
|
||||||
|
} else {
|
||||||
|
$this->name = Formatter::stripDirtyCodes($mx->GbxMapName);
|
||||||
|
}
|
||||||
|
|
||||||
$this->uid = isset($mx->MapUID) ? $mx->MapUID : '';
|
$this->uid = isset($mx->MapUID) ? $mx->MapUID : '';
|
||||||
$this->userid = $mx->UserID;
|
$this->userid = $mx->UserID;
|
||||||
@ -59,7 +65,7 @@ class MXMapInfo {
|
|||||||
$this->length = isset($mx->LengthName) ? $mx->LengthName : '';
|
$this->length = isset($mx->LengthName) ? $mx->LengthName : '';
|
||||||
$this->unlimiter = isset($mx->UnlimiterRequired) ? $mx->UnlimiterRequired : false;
|
$this->unlimiter = isset($mx->UnlimiterRequired) ? $mx->UnlimiterRequired : false;
|
||||||
$this->laps = isset($mx->Laps) ? $mx->Laps : 0;
|
$this->laps = isset($mx->Laps) ? $mx->Laps : 0;
|
||||||
$this->diffic = $mx->DifficultyName;
|
$this->difficulty = $mx->DifficultyName;
|
||||||
$this->lbrating = isset($mx->LBRating) ? $mx->LBRating : 0;
|
$this->lbrating = isset($mx->LBRating) ? $mx->LBRating : 0;
|
||||||
$this->trkvalue = isset($mx->TrackValue) ? $mx->TrackValue : 0;
|
$this->trkvalue = isset($mx->TrackValue) ? $mx->TrackValue : 0;
|
||||||
$this->replaytyp = isset($mx->ReplayTypeName) ? $mx->ReplayTypeName : '';
|
$this->replaytyp = isset($mx->ReplayTypeName) ? $mx->ReplayTypeName : '';
|
||||||
|
Loading…
Reference in New Issue
Block a user