added dedibuild to error and usage reporting
This commit is contained in:
parent
f2ab40a50f
commit
d46eb59fb9
@ -11,7 +11,7 @@
|
||||
error_reporting(E_ALL);
|
||||
|
||||
// Run configuration
|
||||
define('DEV_MODE', true); // Development mode to not send error reports etc.
|
||||
define('DEV_MODE', false); // Development mode to not send error reports etc.
|
||||
define('LOG_NAME_USE_DATE', true); // Use current date as suffix for log file name in logs folder
|
||||
define('LOG_NAME_USE_PID', true); // Use current process id as suffix for log file name in logs folder
|
||||
|
||||
|
@ -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);
|
||||
|
||||
@ -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';
|
||||
|
@ -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
|
||||
*/
|
||||
@ -577,8 +579,9 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
|
||||
|
||||
// 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);
|
||||
$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
|
||||
*
|
||||
|
@ -59,11 +59,13 @@ class UsageReporter implements TimerListener {
|
||||
$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'];
|
||||
|
||||
|
@ -229,8 +229,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
* Open a Mx Karma Session
|
||||
*/
|
||||
private function mxKarmaOpenSession() {
|
||||
if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)
|
||||
) {
|
||||
if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -331,8 +330,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
* Fetch the mxKarmaVotes for the current map
|
||||
*/
|
||||
public function getMxKarmaVotes(Player $player = null) {
|
||||
if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)
|
||||
) {
|
||||
if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -370,9 +368,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
}
|
||||
|
||||
$content = json_encode($properties);
|
||||
$this->maniaControl->getFileReader()->postData(self::MX_KARMA_URL . self::MX_KARMA_GET_MAP_RATING . '?sessionKey=' . urlencode($this->mxKarma['session']->sessionKey), function ($json,
|
||||
$error) use
|
||||
(
|
||||
$this->maniaControl->getFileReader()->postData(self::MX_KARMA_URL . self::MX_KARMA_GET_MAP_RATING . '?sessionKey=' . urlencode($this->mxKarma['session']->sessionKey), function ($json, $error) use (
|
||||
&$player
|
||||
) {
|
||||
if ($error) {
|
||||
@ -487,8 +483,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
|
||||
$content = json_encode($properties);
|
||||
|
||||
$this->maniaControl->getFileReader()->postData(self::MX_KARMA_URL . self::MX_KARMA_SAVE_VOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey), function ($json,
|
||||
$error) {
|
||||
$this->maniaControl->getFileReader()->postData(self::MX_KARMA_URL . self::MX_KARMA_SAVE_VOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey), function ($json, $error) {
|
||||
if ($error) {
|
||||
$this->maniaControl->getErrorHandler()->triggerDebugNotice('mx karma error', $error);
|
||||
return;
|
||||
@ -754,13 +749,11 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
$karmaSettingName = self::buildKarmaSettingName($serverLogin);
|
||||
|
||||
switch ($setting->setting) {
|
||||
case $karmaSettingName:
|
||||
{
|
||||
case $karmaSettingName: {
|
||||
$this->mxKarmaOpenSession();
|
||||
break;
|
||||
}
|
||||
case self::SETTING_WIDGET_ENABLE:
|
||||
{
|
||||
case self::SETTING_WIDGET_ENABLE: {
|
||||
if ($setting->value) {
|
||||
$this->updateManialink = true;
|
||||
$this->handle1Second(time());
|
||||
@ -803,8 +796,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
$voteCount = $votes['count'];
|
||||
}
|
||||
|
||||
if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_ENABLE)
|
||||
) {
|
||||
if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_ENABLE)) {
|
||||
// Build karma manialink
|
||||
$this->buildManialink();
|
||||
|
||||
@ -968,13 +960,11 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
* @param Map $map
|
||||
*/
|
||||
public function importMxKarmaVotes(Map $map) {
|
||||
if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)
|
||||
) {
|
||||
if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_IMPORTING)
|
||||
) {
|
||||
if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_IMPORTING)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1039,8 +1029,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
* Save Mx Karma Votes at MapEnd
|
||||
*/
|
||||
public function sendMxKarmaVotes(Map $map) {
|
||||
if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)
|
||||
) {
|
||||
if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user