@@ -30,22 +30,33 @@ class Application
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
$connection = \ParagonIE\EasyDB\Factory::create(
|
||||
// FIXME: Find hidden bug ($Conn is null)
|
||||
$Conn = \ParagonIE\EasyDB\Factory::create(
|
||||
'mysql:host=' . $this->database['hostname'] . ';dbname=' . $this->database['dbname'],
|
||||
$this->database['username'],
|
||||
$this->database['password']
|
||||
);
|
||||
|
||||
if (is_null($Conn))
|
||||
{
|
||||
throw new Exception("ERROR! There is no usable connection object.");
|
||||
}
|
||||
|
||||
}
|
||||
catch (ConstructorFailed $Ex)
|
||||
{
|
||||
header("HTTP/1.1 500 Internal Server Error");
|
||||
exit("An error has ocurred and therefore we are unable to fulfill your request for information. Sorry.");
|
||||
Analog::log("ALARM! Database connection failed! Message from Wrapper: " . $Ex->getMessage(), Analog::ALERT);
|
||||
|
||||
}
|
||||
catch (Exception $ConEx)
|
||||
{
|
||||
Analog::log("ALERT! Unstable DB connection", Analog::ALERT);
|
||||
}
|
||||
finally
|
||||
{
|
||||
return $connection;
|
||||
|
||||
Analog::log("Returning DB connection\n" . var_dump($Conn), Analog::DEBUG);
|
||||
return $Conn;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user