Forráskód Böngészése

Use the new config class in the domains and schema classes.

markjcrane 9 éve
szülő
commit
289208e4f0
3 módosított fájl, 43 hozzáadás és 14 törlés
  1. 15 11
      resources/classes/config.php
  2. 14 1
      resources/classes/domains.php
  3. 14 2
      resources/classes/schema.php

+ 15 - 11
resources/classes/config.php

@@ -67,17 +67,21 @@ class config {
 	 * @var string $config_path - full path to the config.php file
 	 */
 	public function find() {
-		if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
-			$this->config_path = $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php";
-		} elseif (file_exists("/etc/fusionpbx/config.php")) {
-			$this->config_path = "/etc/fusionpbx/config.php";
-		} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
-			$this->config_path = "/usr/local/etc/fusionpbx/config.php";
-		}
-		else {
-			$this->config_path = '';
-		}
-		return $this->config_path;
+		//get the PROJECT PATH
+			include "root.php";
+		// find the file
+			if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+				$this->config_path = $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php";
+			} elseif (file_exists("/etc/fusionpbx/config.php")) {
+				$this->config_path = "/etc/fusionpbx/config.php";
+			} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
+				$this->config_path = "/usr/local/etc/fusionpbx/config.php";
+			}
+			else {
+				$this->config_path = '';
+			}
+		//return the path
+			return $this->config_path;
 	}
 
 	/**

+ 14 - 1
resources/classes/domains.php

@@ -215,7 +215,20 @@
 		public function upgrade() {
 
 			//set the global variable
-				global $db, $db_type, $db_name, $db_username, $db_password, $db_host, $db_path, $db_port;
+				global $db;
+
+			//get the db variables
+				$config = new config;
+				$config_exists = $config->exists();
+				$config_path = $config->find();
+				$config->get();
+				$db_type = $config->db_type;
+				$db_name = $config->db_name;
+				$db_username = $config->db_username;
+				$db_password = $config->db_password;
+				$db_host = $config->db_host;
+				$db_path = $config->db_path;
+				$db_port = $config->db_port;
 
 			//get the PROJECT PATH
 				include "root.php";

+ 14 - 2
resources/classes/schema.php

@@ -448,8 +448,20 @@ include "root.php";
 			public function schema ($format) {
 
 				//set the global variable
-					global $db, $db_type, $db_name, $db_username, $db_password;
-					global $db_host, $db_path, $db_port, $upgrade_data_types, $text;
+					global $db, $upgrade_data_types, $text;
+
+				//get the db variables
+					$config = new config;
+					$config_exists = $config->exists();
+					$config_path = $config->find();
+					$config->get();
+					$db_type = $config->db_type;
+					$db_name = $config->db_name;
+					$db_username = $config->db_username;
+					$db_password = $config->db_password;
+					$db_host = $config->db_host;
+					$db_path = $config->db_path;
+					$db_port = $config->db_port;
 
 				//get the PROJECT PATH
 					include "root.php";