setting for disabling automatic mc restart
This commit is contained in:
parent
d2813fe001
commit
75b1e2155a
@ -38,8 +38,6 @@ class MigrationHelper {
|
|||||||
$sourceClass = $this->getClass($sourceClass);
|
$sourceClass = $this->getClass($sourceClass);
|
||||||
$targetClass = $this->getClass($targetClass);
|
$targetClass = $this->getClass($targetClass);
|
||||||
|
|
||||||
var_dump($sourceClass, $targetClass);
|
|
||||||
|
|
||||||
$mysqli = $this->maniaControl->database->mysqli;
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
|
|
||||||
$query = "INSERT INTO `" . SettingManager::TABLE_SETTINGS . "` (`class`, `setting`, `type`, `value`, `default`)
|
$query = "INSERT INTO `" . SettingManager::TABLE_SETTINGS . "` (`class`, `setting`, `type`, `value`, `default`)
|
||||||
|
@ -4,6 +4,7 @@ namespace ManiaControl;
|
|||||||
|
|
||||||
use ManiaControl\Files\FileUtil;
|
use ManiaControl\Files\FileUtil;
|
||||||
use ManiaControl\Update\UpdateManager;
|
use ManiaControl\Update\UpdateManager;
|
||||||
|
use ManiaControl\Callbacks\Callbacks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error and Exception Manager Class
|
* Error and Exception Manager Class
|
||||||
@ -17,6 +18,7 @@ class ErrorHandler {
|
|||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const MC_DEBUG_NOTICE = "ManiaControl.DebugNotice";
|
const MC_DEBUG_NOTICE = "ManiaControl.DebugNotice";
|
||||||
|
const SETTING_RESTART_ON_EXCEPTION = 'Automatically restart on Exceptions';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Private Properties
|
* Private Properties
|
||||||
@ -33,6 +35,13 @@ class ErrorHandler {
|
|||||||
set_exception_handler(array(&$this, 'exceptionHandler'));
|
set_exception_handler(array(&$this, 'exceptionHandler'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize other Error Handler Features
|
||||||
|
*/
|
||||||
|
public function init() {
|
||||||
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_RESTART_ON_EXCEPTION, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ManiaControl ExceptionHandler
|
* ManiaControl ExceptionHandler
|
||||||
* ManiaControl Shuts down after exception
|
* ManiaControl Shuts down after exception
|
||||||
@ -62,8 +71,7 @@ class ErrorHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->maniaControl->settingManager && $this->maniaControl->updateManager) {
|
if ($this->maniaControl->settingManager && $this->maniaControl->updateManager) {
|
||||||
$error['UpdateChannel'] = $this->maniaControl->settingManager->getSetting($this->maniaControl->updateManager,
|
$error['UpdateChannel'] = $this->maniaControl->settingManager->getSetting($this->maniaControl->updateManager, UpdateManager::SETTING_UPDATECHECK_CHANNEL);
|
||||||
UpdateManager::SETTING_UPDATECHECK_CHANNEL);
|
|
||||||
$error['ManiaControlVersion'] = $this->maniaControl->updateManager->getCurrentBuildDate();
|
$error['ManiaControlVersion'] = $this->maniaControl->updateManager->getCurrentBuildDate();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -85,7 +93,9 @@ class ErrorHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->shouldRestart()) {
|
||||||
$this->maniaControl->restart();
|
$this->maniaControl->restart();
|
||||||
|
}
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,8 +114,7 @@ class ErrorHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$userError = ($errorNumber == E_USER_ERROR || $errorNumber == E_USER_WARNING || $errorNumber == E_USER_NOTICE ||
|
$userError = ($errorNumber == E_USER_ERROR || $errorNumber == E_USER_WARNING || $errorNumber == E_USER_NOTICE || $errorNumber == E_USER_DEPRECATED);
|
||||||
$errorNumber == E_USER_DEPRECATED);
|
|
||||||
|
|
||||||
// Log error
|
// Log error
|
||||||
$errorTag = $this->getErrorTag($errorNumber);
|
$errorTag = $this->getErrorTag($errorNumber);
|
||||||
@ -129,8 +138,7 @@ class ErrorHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->maniaControl->settingManager && $this->maniaControl->updateManager) {
|
if ($this->maniaControl->settingManager && $this->maniaControl->updateManager) {
|
||||||
$error['UpdateChannel'] = $this->maniaControl->settingManager->getSetting($this->maniaControl->updateManager,
|
$error['UpdateChannel'] = $this->maniaControl->settingManager->getSetting($this->maniaControl->updateManager, UpdateManager::SETTING_UPDATECHECK_CHANNEL);
|
||||||
UpdateManager::SETTING_UPDATECHECK_CHANNEL);
|
|
||||||
$error['ManiaControlVersion'] = $this->maniaControl->updateManager->getCurrentBuildDate();
|
$error['ManiaControlVersion'] = $this->maniaControl->updateManager->getCurrentBuildDate();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -208,6 +216,19 @@ class ErrorHandler {
|
|||||||
return "[PHP {$errorLevel}]";
|
return "[PHP {$errorLevel}]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if ManiaControl should restart automatically
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function shouldRestart() {
|
||||||
|
if (!$this->maniaControl || !$this->maniaControl->settingManager) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$setting = $this->maniaControl->settingManager->getSetting($this, self::SETTING_RESTART_ON_EXCEPTION, true);
|
||||||
|
return $setting;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the Debug Backtrace into a String for the Error Report
|
* Parse the Debug Backtrace into a String for the Error Report
|
||||||
*
|
*
|
||||||
|
@ -130,6 +130,8 @@ class ManiaControl implements CommandListener, TimerListener {
|
|||||||
|
|
||||||
//Check connection every 30 seconds
|
//Check connection every 30 seconds
|
||||||
$this->timerManager->registerTimerListening($this, 'checkConnection', 1000 * 30);
|
$this->timerManager->registerTimerListening($this, 'checkConnection', 1000 * 30);
|
||||||
|
|
||||||
|
$this->errorHandler->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user