Update the database class to find the require.php
This commit is contained in:
@@ -392,22 +392,15 @@
|
|||||||
public function connect() {
|
public function connect() {
|
||||||
|
|
||||||
//includes files
|
//includes files
|
||||||
//require dirname(__DIR__, 2) . "/resources/require.php";
|
require dirname(__DIR__, 2) . "/resources/require.php";
|
||||||
|
|
||||||
//set the include path
|
|
||||||
$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
|
|
||||||
set_include_path(parse_ini_file($conf[0])['document.root']);
|
|
||||||
|
|
||||||
//parset the config.conf file
|
|
||||||
$conf = parse_ini_file($conf[0]);
|
|
||||||
|
|
||||||
//get the database connection settings
|
//get the database connection settings
|
||||||
$db_type = $conf['database.0.type'];
|
//$db_type = $conf['database.0.type'];
|
||||||
$db_host = $conf['database.0.host'];
|
//$db_host = $conf['database.0.host'];
|
||||||
$db_port = $conf['database.0.port'];
|
//$db_port = $conf['database.0.port'];
|
||||||
$db_name = $conf['database.0.name'];
|
//$db_name = $conf['database.0.name'];
|
||||||
$db_username = $conf['database.0.username'];
|
//$db_username = $conf['database.0.username'];
|
||||||
$db_password = $conf['database.0.password'];
|
//$db_password = $conf['database.0.password'];
|
||||||
|
|
||||||
//debug info
|
//debug info
|
||||||
//echo "db type:".$db_type."\n";
|
//echo "db type:".$db_type."\n";
|
||||||
@@ -645,6 +638,13 @@
|
|||||||
$this->connect();
|
$this->connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if unable to connect to the database
|
||||||
|
if (!$this->db) {
|
||||||
|
echo "Connection Failed<br />\n";
|
||||||
|
echo "line number ".__line__."<br />\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
//query table store to see if the table exists
|
//query table store to see if the table exists
|
||||||
$sql = "";
|
$sql = "";
|
||||||
if ($this->type == "sqlite") {
|
if ($this->type == "sqlite") {
|
||||||
@@ -1477,11 +1477,20 @@
|
|||||||
$this->connect();
|
$this->connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//unable to connect to the database
|
||||||
|
if (!$this->db) {
|
||||||
|
echo "Connection Failed<br />\n";
|
||||||
|
echo "line number ".__line__."<br />\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
//set the error mode
|
//set the error mode
|
||||||
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
if ($this->db) {
|
||||||
|
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
}
|
||||||
|
|
||||||
//reduce prepared statement latency
|
//reduce prepared statement latency
|
||||||
if (defined('PDO::PGSQL_ATTR_DISABLE_PREPARES')) {
|
if ($this->db && defined('PDO::PGSQL_ATTR_DISABLE_PREPARES')) {
|
||||||
$this->db->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true);
|
$this->db->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@
|
|||||||
require_once "resources/php.php";
|
require_once "resources/php.php";
|
||||||
require_once "resources/functions.php";
|
require_once "resources/functions.php";
|
||||||
if (is_array($conf) && count($conf) > 0) {
|
if (is_array($conf) && count($conf) > 0) {
|
||||||
require "resources/pdo.php";
|
require_once "resources/pdo.php";
|
||||||
require_once "resources/cidr.php";
|
require_once "resources/cidr.php";
|
||||||
if (file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/resources/switch.php")) {
|
if (file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/resources/switch.php")) {
|
||||||
require_once "resources/switch.php";
|
require_once "resources/switch.php";
|
||||||
|
|||||||
Reference in New Issue
Block a user