From cc3f8e9945c0a244698b0990b98429c8a392c832 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 11:19:09 +0000 Subject: [PATCH] changed path handling for create_config_lua thanks moteus for the hint --- core/install/resources/classes/install_fusionpbx.php | 4 ++-- core/install/resources/classes/install_switch.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 513581c628..cf1cee1076 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -856,7 +856,7 @@ include "root.php"; } protected function create_superuser() { - $this->write_progress("\tChecking if superuser exists '" . $this->global_settings->domain_name . "'"); + $this->write_progress("\tChecking if superuser exists '" . $this->admin_username . "'"); $sql = "select * from v_users "; $sql .= "where domain_uuid = '".$this->global_settings->domain_uuid()."' "; $sql .= "and username = '".$this->admin_username."' "; @@ -877,7 +877,7 @@ include "root.php"; $this->write_debug($sql); $this->dbh->exec(check_sql($sql)); }else{ - $this->write_progress("\t... creating super user '" . $this->admin_username . "'"); + $this->write_progress("\t... creating super user"); //add a user and then add the user to the superadmin group //prepare the values $this->admin_uuid = uuid(); diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index da76e40dd8..36db511cf4 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -278,9 +278,9 @@ include "root.php"; public function create_config_lua() { $this->write_progress("\tCreating " . $this->config_lua); - $dirs = array_pop(explode("/", normalize_path($this->config_lua))); - $path = normalize_path_to_os(join("/", $dirs)); - if($dirs[(sizeof($dirs)-1)] == 'resources' and !file_exists($path)){ + $path = dirname($this->config_lua); + $parent_dir = basename($path); + if($parent_dir == 'resources' and !file_exists($path)){ $this->write_progress("\t... creating missing '$path'"); if (!mkdir($path, 0755, true)) { throw new Exception("Failed to create the missing resources directory '$path'"); @@ -412,7 +412,7 @@ include "root.php"; $tmp .= " dofile(\"/etc/fusionpbx/local.lua\");\n"; $tmp .= " elseif (file_exists(\"/usr/local/etc/fusionpbx/local.lua\")) then\n"; $tmp .= " dofile(\"/usr/local/etc/fusionpbx/local.lua\");\n"; - $tmp .= " elseif (file_exists(script_dir..\"/resources/local.lua\")) then\n"; + $tmp .= " elseif (file_exists(scripts_dir..\"/resources/local.lua\")) then\n"; $tmp .= " require(\"resources.local\");\n"; $tmp .= " end\n"; fwrite($fout, $tmp);