From 3e80fc104702b8fcc48a010792898755ef0e14c4 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Tue, 1 Dec 2015 16:40:36 +0000 Subject: [PATCH] improved message related to config_lua --- .../resources/classes/install_fusionpbx.php | 1 + .../resources/classes/install_switch.php | 26 ++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index c0a7c22d7b..4304b02091 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -77,6 +77,7 @@ include "root.php"; else { $this->config_php = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/config.php"; } + $this->config_php = normalize_path_for_os($this->config_php); } function write_debug($message) { diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 3d7558b88c..cd07d59600 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -31,6 +31,7 @@ include "root.php"; protected $domain_uuid; protected $domain_name; protected $detect_switch; + protected $config_lua; public $debug = false; @@ -48,6 +49,15 @@ include "root.php"; $this->domain_uuid = $domain_uuid; $this->domain = $domain_name; $this->detect_switch = $detect_switch; + if (is_dir("/etc/fusionpbx")){ + $config = "/etc/fusionpbx/config.lua"; + } elseif (is_dir("/usr/local/etc/fusionpbx")){ + $config = "/usr/local/etc/fusionpbx/config.lua"; + } + else { + $config = $_SESSION['switch']['scripts']['dir']."/resources/config.lua"; + } + $this->config_lua = normalize_path_for_os($this->config_lua); } //utility Functions @@ -266,8 +276,8 @@ include "root.php"; } function create_config_lua() { - $this->write_progress("\Creating config.lua"); - global $db; + $this->write_progress("\tCreating " . $this->config_lua); + global $db; //get the odbc information $sql = "select count(*) as num_rows from v_databases "; $sql .= "where database_driver = 'odbc' "; @@ -298,17 +308,9 @@ include "root.php"; } //config.lua - if (is_dir("/etc/fusionpbx")){ - $config = "/etc/fusionpbx/config.lua"; - } elseif (is_dir("/usr/local/etc/fusionpbx")){ - $config = "/usr/local/etc/fusionpbx/config.lua"; - } - else { - $config = $_SESSION['switch']['scripts']['dir']."/resources/config.lua"; - } - $fout = fopen($config,"w"); + $fout = fopen($this->config_lua,"w"); if(!$fout){ - throw new Exception("Failed to open '$config' for writing"); + throw new Exception("Failed to open '{$this->config_lua}' for writing"); } $tmp = "\n"; $tmp .= "--set the variables\n";