From 5e23824940ae97bb772ebaf8603a6b3da4609e26 Mon Sep 17 00:00:00 2001 From: frytimo Date: Fri, 24 Mar 2023 12:18:23 -0300 Subject: [PATCH] contacts app_defaults breaks PDO db (#6585) --- app/contacts/app_defaults.php | 3 --- resources/classes/schema.php | 14 ++++++-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/app/contacts/app_defaults.php b/app/contacts/app_defaults.php index b037cacee0..14bf5e83b1 100644 --- a/app/contacts/app_defaults.php +++ b/app/contacts/app_defaults.php @@ -4,7 +4,6 @@ if ($domains_processed == 1) { //populate new phone_label values, phone_type_* values $obj = new schema; - $obj->db = $db; $obj->db_type = $db_type; $obj->schema(); $field_exists = $obj->column_exists($db_name, 'v_contact_phones', 'phone_type'); //check if field exists @@ -62,7 +61,6 @@ if ($domains_processed == 1) { //populate primary email from deprecated field in v_contact table $obj = new schema; - $obj->db = $db; $obj->db_type = $db_type; $obj->schema(); $field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_email'); //check if field exists @@ -123,7 +121,6 @@ if ($domains_processed == 1) { //populate primary url from deprecated field in v_contact table $obj = new schema; - $obj->db = $db; $obj->db_type = $db_type; $obj->schema(); $field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_url'); //check if field exists diff --git a/resources/classes/schema.php b/resources/classes/schema.php index 33405ed7ae..dfc9f872fc 100644 --- a/resources/classes/schema.php +++ b/resources/classes/schema.php @@ -29,7 +29,7 @@ if (!class_exists('schema')) { class schema { //define variables - public $db; + private $db; public $apps; public $db_type; public $result; @@ -37,13 +37,11 @@ if (!class_exists('schema')) { //class constructor public function __construct() { - //connect to the database if not connected - if (!$this->db) { - require_once "resources/classes/database.php"; - $database = new database; - $database->connect(); - $this->db = $database->db; - } + //connect to the database + require_once "resources/classes/database.php"; + $database = new database; + $database->connect(); + $this->db = $database->db; //set the include path $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);