Update domains.php

This commit is contained in:
FusionPBX 2016-09-10 17:33:47 -06:00 committed by GitHub
parent bc057ac1f5
commit 60c9477d2f
1 changed files with 20 additions and 10 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2014
Portions created by the Initial Developer are Copyright (C) 2008-2016
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -33,17 +33,19 @@ if (!class_exists('domains')) {
//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;
}
}
public function set() {
//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;
}
//set the PDO error mode
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@ -202,7 +204,15 @@ if (!class_exists('domains')) {
public function upgrade() {
//get the db variables
//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;
}
//get the variables
$config = new config;
$config_exists = $config->exists();
$config_path = $config->find();
@ -357,4 +367,4 @@ if (!class_exists('domains')) {
}
}
?>
?>