Revert changes
This commit is contained in:
parent
50f811e5ec
commit
d30748f47a
1392
php_errors.log
1392
php_errors.log
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,4 @@
|
|||
<?php
|
||||
|
||||
use \ParagonIE\EasyDB\Exception;
|
||||
|
||||
class Application
|
||||
{
|
||||
private $database = [];
|
||||
|
@ -20,44 +17,39 @@ class Application
|
|||
$this->database['hostname'] = $cConfigArray['core']['database']['hostname'];
|
||||
$this->database['dbname'] = $cConfigArray['core']['database']['dbname'];
|
||||
|
||||
$this->db = $this->instDB();
|
||||
|
||||
$this->instDB();
|
||||
}
|
||||
|
||||
private function isHostAlive($domain)
|
||||
{
|
||||
$starttime = microtime(true);
|
||||
$file = fsockopen ($domain, 80, $errno, $errstr, 10);
|
||||
$stoptime = microtime(true);
|
||||
$status = 0;
|
||||
|
||||
if (!$file) $status = -1; // Site is down
|
||||
else
|
||||
{
|
||||
fclose($file);
|
||||
$status = ($stoptime - $starttime) * 1000;
|
||||
$status = floor($status);
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
protected function instDB()
|
||||
{// ConstructorFailed
|
||||
{
|
||||
|
||||
$dsn = "mysql:host=" . $this->database['hostname'] . "dbname=" . $this->database['dbname'];
|
||||
$username = $this->database['username'];
|
||||
$password = $this->database['password'];
|
||||
|
||||
try
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
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
|
||||
{
|
||||
|
||||
Analog::log("Returning DB connection\n" . var_dump($Conn), Analog::DEBUG);
|
||||
return $Conn;
|
||||
}
|
||||
echo $this->database['hostname'];
|
||||
|
||||
$Conn = \ParagonIE\EasyDB\Factory::create($dsn, $username, $password);
|
||||
|
||||
$this->db = $Conn;
|
||||
|
||||
}
|
||||
|
||||
public function Exists($Table, $IDRowColumnName, $SearchValue)
|
||||
|
|
Loading…
Reference in New Issue