fixed shutdowns on errors

This commit is contained in:
Steffen Schröder 2014-08-05 02:08:11 +02:00
parent c0c78724d3
commit 68c9c4e555

View File

@ -67,35 +67,35 @@ class Database implements TimerListener {
private function loadConfig() { private function loadConfig() {
$databaseElements = $this->maniaControl->getConfig()->xpath('database'); $databaseElements = $this->maniaControl->getConfig()->xpath('database');
if (!$databaseElements) { if (!$databaseElements) {
Logger::logError('No Database configured!', E_USER_ERROR); $this->maniaControl->quit('No Database configured!', true);
} }
$databaseElement = $databaseElements[0]; $databaseElement = $databaseElements[0];
// Host // Host
$hostElements = $databaseElement->xpath('host'); $hostElements = $databaseElement->xpath('host');
if (!$hostElements) { if (!$hostElements) {
Logger::logError("Invalid database configuration (Host).", E_USER_ERROR); $this->maniaControl->quit("Invalid database configuration (Host).", true);
} }
$host = (string)$hostElements[0]; $host = (string)$hostElements[0];
// Port // Port
$portElements = $databaseElement->xpath('port'); $portElements = $databaseElement->xpath('port');
if (!$portElements) { if (!$portElements) {
Logger::logError("Invalid database configuration (Port).", E_USER_ERROR); $this->maniaControl->quit("Invalid database configuration (Port).", true);
} }
$port = (string)$portElements[0]; $port = (string)$portElements[0];
// User // User
$userElements = $databaseElement->xpath('user'); $userElements = $databaseElement->xpath('user');
if (!$userElements) { if (!$userElements) {
Logger::logError("Invalid database configuration (User).", E_USER_ERROR); $this->maniaControl->quit("Invalid database configuration (User).", true);
} }
$user = (string)$userElements[0]; $user = (string)$userElements[0];
// Pass // Pass
$passElements = $databaseElement->xpath('pass'); $passElements = $databaseElement->xpath('pass');
if (!$passElements) { if (!$passElements) {
Logger::logError("Invalid database configuration (Pass).", E_USER_ERROR); $this->maniaControl->quit("Invalid database configuration (Pass).", true);
} }
$pass = (string)$passElements[0]; $pass = (string)$passElements[0];
@ -105,7 +105,7 @@ class Database implements TimerListener {
$nameElements = $databaseElement->xpath('db_name'); $nameElements = $databaseElement->xpath('db_name');
} }
if (!$nameElements) { if (!$nameElements) {
Logger::logError("Invalid database configuration (Name).", E_USER_ERROR); $this->maniaControl->quit("Invalid database configuration (Name).", true);
} }
$name = (string)$nameElements[0]; $name = (string)$nameElements[0];