From 9bc96195c1702e831899496b8da17a87f222f0e3 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 09:52:53 +0000 Subject: [PATCH 1/9] corrected references to scripts --- core/install/resources/classes/install_switch.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index bc4036fdc2..3e34071dae 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -46,8 +46,8 @@ include "root.php"; $this->config_lua = "/etc/fusionpbx/config.lua"; }elseif (is_dir("/usr/local/etc/fusionpbx")){ $this->config_lua = "/usr/local/etc/fusionpbx/config.lua"; - }elseif(strlen($this->global_settings->script_dir) > 0) { - $this->config_lua = $this->global_settings->script_dir."/resources/config.lua"; + }elseif(strlen($this->global_settings->switch_script_dir()) > 0) { + $this->config_lua = $this->global_settings->switch_script_dir()."/resources/config.lua"; }else{ throw new Exception("Could not work out where to put the config.lua"); } @@ -193,7 +193,6 @@ include "root.php"; function upgrade() { $this->copy_scripts(); $this->create_config_lua(); - $this->restart_switch(); } protected function copy_conf() { @@ -335,7 +334,7 @@ include "root.php"; $tmp .= normalize_path_to_os(" voicemail_dir = [[".$this->global_settings->switch_voicemail_vdir()."]];\n"); } if (strlen($this->global_settings->switch_script_dir()) > 0) { - $tmp .= normalize_path_to_os(" script_dir = [[".$this->global_settings->switch_script_dir()."]];\n"); + $tmp .= normalize_path_to_os(" scripts_dir = [[".$this->global_settings->switch_script_dir()."]];\n"); } $tmp .= normalize_path_to_os(" php_dir = [[".PHP_BINDIR."]];\n"); if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") { From f3f24c40858f1c931ebe44caacbd4154fcdc266d Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 10:40:54 +0000 Subject: [PATCH 2/9] add caveat when the config.lua is inside scripts\resources due to app_defaults running before install_switch create_config_lua cannot create it's config if the detected folder is scripts\resources\ this solves this by adding a caveat to create it's parent folder when it is called resources --- core/install/resources/classes/install_switch.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 3e34071dae..2df6ac189f 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -278,6 +278,14 @@ include "root.php"; public function create_config_lua() { $this->write_progress("\tCreating " . $this->config_lua); + $dirs = array_pop(explode("/", normalize_path($config_path))); + $path = normalize_path_to_os(join("/", $dirs)); + if($dirs[(sizeof($dirs)-1)] == 'resources' and !file_exists($path)){ + if (!mkdir($path, 0755, true)) { + throw new Exception("Failed to create the missing resources directory '$path'"); + } + } + global $db; //get the odbc information $sql = "select count(*) as num_rows from v_databases "; From 5149307d1120e4a9190a2555f59c7b2cb19812ba Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 10:49:38 +0000 Subject: [PATCH 3/9] corrected path retrieval for test added missing () when reporting domain name --- core/install/resources/classes/install_fusionpbx.php | 4 ++-- core/install/resources/classes/install_switch.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index a2dd714b1a..513581c628 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -551,9 +551,9 @@ include "root.php"; } protected function create_domain() { - $this->write_progress("\tChecking if domain exists '" . $this->global_settings->domain_name . "'"); + $this->write_progress("\tChecking if domain exists '" . $this->global_settings->domain_name() . "'"); $sql = "select * from v_domains "; - $sql .= "where domain_name = '".$this->global_settings->domain_name."' "; + $sql .= "where domain_name = '".$this->global_settings->domain_name()."' "; $sql .= "limit 1"; $this->write_debug($sql); $prep_statement = $this->dbh->prepare(check_sql($sql)); diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 2df6ac189f..da76e40dd8 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -278,9 +278,10 @@ include "root.php"; public function create_config_lua() { $this->write_progress("\tCreating " . $this->config_lua); - $dirs = array_pop(explode("/", normalize_path($config_path))); + $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)){ + $this->write_progress("\t... creating missing '$path'"); if (!mkdir($path, 0755, true)) { throw new Exception("Failed to create the missing resources directory '$path'"); } From cc3f8e9945c0a244698b0990b98429c8a392c832 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 11:19:09 +0000 Subject: [PATCH 4/9] 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); From 68cd03d598e1d31887455a288f3e22267b36ba00 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 11:36:29 +0000 Subject: [PATCH 5/9] added workaround for lua not resolving localhost --- core/install/resources/classes/install_switch.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 36db511cf4..dd64ee1d60 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -367,8 +367,10 @@ include "root.php"; $tmp .= " database[\"switch\"] = \"odbc://freeswitch:".$dsn_username.":".$dsn_password."\";\n"; } elseif ($this->global_settings->db_type() == "pgsql") { - $tmp .= " database[\"system\"] = \"pgsql://hostaddr=".$this->global_settings->db_host()." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n"; - $tmp .= " database[\"switch\"] = \"pgsql://hostaddr=".$this->global_settings->db_host()." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n"; + $lua_db_host = $this->global_settings->db_host(); + if($lua_db_host == 'localhost') { $lua_db_host = '127.0.0.1'; } // lua cannot resolve localhost + $tmp .= " database[\"system\"] = \"pgsql://hostaddr=".$lua_db_host." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n"; + $tmp .= " database[\"switch\"] = \"pgsql://hostaddr=".$lua_db_host." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n"; } elseif ($this->global_settings->db_type() == "sqlite") { $tmp .= " database[\"system\"] = \"sqlite://".$this->global_settings->db_path()."/".$this->global_settings->db_name()."\";\n"; From e036c88c99184236f895a3e8c076f9a29b31a7b7 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 11:55:40 +0000 Subject: [PATCH 6/9] fixed storage of domain_count --- core/install/resources/classes/global_settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/install/resources/classes/global_settings.php b/core/install/resources/classes/global_settings.php index eb1cbfd2ef..b93bc371fb 100644 --- a/core/install/resources/classes/global_settings.php +++ b/core/install/resources/classes/global_settings.php @@ -163,7 +163,7 @@ require_once "root.php"; $this->_domain_uuid = $_SESSION['domain_uuid']; // collect misc info - $this->domain_count = count($_SESSION["domains"]); + $this->_domain_count = count($_SESSION["domains"]); // collect db_info global $db_type, $db_path, $db_host, $db_port, $db_name, $db_username, $db_password; From 875f0a62622a76e6310037cfde796439302508c6 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 13:36:43 +0000 Subject: [PATCH 7/9] added save_switch_xml during install --- core/install/index.php | 4 ---- core/install/resources/classes/install_switch.php | 1 + themes/enhanced/app_defaults.php | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/core/install/index.php b/core/install/index.php index 1eb6efc8c9..36d012f0f7 100644 --- a/core/install/index.php +++ b/core/install/index.php @@ -78,10 +78,6 @@ if (!if_group("superadmin")) { echo "\n"; echo "\n"; - echo "

"; - - echo "

WiP

"; - //include the footer require_once "resources/footer.php"; ?> \ No newline at end of file diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index dd64ee1d60..3af53476c8 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -186,6 +186,7 @@ include "root.php"; $this->copy_conf(); $this->copy_scripts(); $this->create_config_lua(); + save_switch_xml(); $this->restart_switch(); $this->write_progress("Install completed for switch"); } diff --git a/themes/enhanced/app_defaults.php b/themes/enhanced/app_defaults.php index 333fb6efca..5080029782 100644 --- a/themes/enhanced/app_defaults.php +++ b/themes/enhanced/app_defaults.php @@ -287,7 +287,7 @@ if ($domains_processed == 1) { $array[$x]['default_setting_category'] = 'theme'; $array[$x]['default_setting_subcategory'] = 'background_color'; $array[$x]['default_setting_name'] = 'array'; - $array[$x]['default_setting_value'] = '#ffffff'; + $array[$x]['default_setting_value'] = '#6c89b5'; $array[$x]['default_setting_enabled'] = 'true'; $array[$x]['default_setting_order'] = '0'; $array[$x]['default_setting_description'] = 'Set a background (HTML compatible) color.'; @@ -295,7 +295,7 @@ if ($domains_processed == 1) { $array[$x]['default_setting_category'] = 'theme'; $array[$x]['default_setting_subcategory'] = 'background_color'; $array[$x]['default_setting_name'] = 'array'; - $array[$x]['default_setting_value'] = '#e7ebf1'; + $array[$x]['default_setting_value'] = '#144794'; $array[$x]['default_setting_order'] = '1'; $array[$x]['default_setting_enabled'] = 'true'; $array[$x]['default_setting_description'] = 'Set a secondary background (HTML compatible) color, for a gradient effect.'; From 7ce32f11d4da1cf6c661296969f2bbd16bcf8bd4 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 14:25:33 +0000 Subject: [PATCH 8/9] corrected function name --- core/install/resources/classes/install_switch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 27efa25e3c..bdf9a2c48b 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -188,7 +188,7 @@ include "root.php"; $this->write_progress("Install phase 1 completed for switch"); } - function install_phase_1() { + function install_phase_2() { $this->write_progress("Install phase 2 started for switch"); $this->create_config_lua(); $this->restart_switch(); From 47ff30bce07efc10b074aae3d526e673218186d8 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 15:42:52 +0000 Subject: [PATCH 9/9] fix to the external IPv6 --- .../templates/conf/sip_profiles/external-ipv6.xml.noload | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/templates/conf/sip_profiles/external-ipv6.xml.noload b/resources/templates/conf/sip_profiles/external-ipv6.xml.noload index 4a4b4028ee..b980a94d1b 100644 --- a/resources/templates/conf/sip_profiles/external-ipv6.xml.noload +++ b/resources/templates/conf/sip_profiles/external-ipv6.xml.noload @@ -58,8 +58,8 @@ - - + +