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
|
<?php
|
||||||
|
|
||||||
use \ParagonIE\EasyDB\Exception;
|
|
||||||
|
|
||||||
class Application
|
class Application
|
||||||
{
|
{
|
||||||
private $database = [];
|
private $database = [];
|
||||||
|
@ -20,44 +17,39 @@ class Application
|
||||||
$this->database['hostname'] = $cConfigArray['core']['database']['hostname'];
|
$this->database['hostname'] = $cConfigArray['core']['database']['hostname'];
|
||||||
$this->database['dbname'] = $cConfigArray['core']['database']['dbname'];
|
$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()
|
protected function instDB()
|
||||||
{// ConstructorFailed
|
{
|
||||||
|
|
||||||
|
$dsn = "mysql:host=" . $this->database['hostname'] . "dbname=" . $this->database['dbname'];
|
||||||
|
$username = $this->database['username'];
|
||||||
|
$password = $this->database['password'];
|
||||||
|
|
||||||
try
|
echo $this->database['hostname'];
|
||||||
{
|
|
||||||
// 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))
|
$Conn = \ParagonIE\EasyDB\Factory::create($dsn, $username, $password);
|
||||||
{
|
|
||||||
throw new Exception("ERROR! There is no usable connection object.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
$this->db = $Conn;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Exists($Table, $IDRowColumnName, $SearchValue)
|
public function Exists($Table, $IDRowColumnName, $SearchValue)
|
||||||
|
|
Loading…
Reference in New Issue