From 9cb577f44f1c53ab0e1877db11d437487dcb976e Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 3 Apr 2016 08:39:47 -0600 Subject: [PATCH] Update install freeswitch commented out copy scripts and create config lua as they handled in other code. Update install fusionpbx adding switch directories and creating groups handled in other code. When testing is completed will be removed from the code. --- .../resources/classes/install_fusionpbx.php | 79 ++++++++++--------- .../resources/classes/install_switch.php | 15 ++-- 2 files changed, 50 insertions(+), 44 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 663e38c93d..b6fa6779ba 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -663,7 +663,7 @@ include "root.php"; $tmp[$x]['subcategory'] = 'template'; $tmp[$x]['enabled'] = 'true'; $x++; - +/* //switch settings $tmp[$x]['name'] = 'dir'; $tmp[$x]['value'] = $switch_bin_dir; @@ -767,7 +767,7 @@ include "root.php"; $tmp[$x]['subcategory'] = 'dialplan'; $tmp[$x]['enabled'] = 'false'; $x++; - +*/ //server settings $tmp[$x]['name'] = 'dir'; $tmp[$x]['value'] = $this->global_settings->switch_temp_dir(); @@ -824,6 +824,7 @@ include "root.php"; $x++; } +/* //add the groups $x = 0; $tmp[$x]['group_name'] = 'superadmin'; @@ -895,6 +896,7 @@ include "root.php"; } } $this->dbh->commit(); +*/ } } @@ -919,41 +921,42 @@ include "root.php"; $sql .= "where USER_uuid = '".$this->admin_uuid."' "; $this->write_debug($sql); $this->dbh->exec(check_sql($sql)); - }else{ - $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(); - $contact_uuid = uuid(); - //set a sessiong variable - $_SESSION["user_uuid"] = $user_uuid; - //salt used with the password to create a one way hash - //add the user account - $sql = "insert into v_users "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "user_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "username, "; - $sql .= "password, "; - $sql .= "salt, "; - $sql .= "add_date, "; - $sql .= "add_user "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$this->global_settings->domain_uuid()."', "; - $sql .= "'".$this->admin_uuid."', "; - $sql .= "'$contact_uuid', "; - $sql .= "'".$this->admin_username."', "; - $sql .= "'".md5($salt.$this->admin_password)."', "; - $sql .= "'$salt', "; - $sql .= "now(), "; - $sql .= "'".$this->admin_username."' "; - $sql .= ");"; - $this->write_debug( $sql."\n"); - $this->dbh->exec(check_sql($sql)); - unset($sql); + } else { + //message + $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(); + $contact_uuid = uuid(); + //set a sessiong variable + $_SESSION["user_uuid"] = $user_uuid; + //salt used with the password to create a one way hash + //add the user account + $sql = "insert into v_users "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "user_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "username, "; + $sql .= "password, "; + $sql .= "salt, "; + $sql .= "add_date, "; + $sql .= "add_user "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$this->global_settings->domain_uuid()."', "; + $sql .= "'".$this->admin_uuid."', "; + $sql .= "'$contact_uuid', "; + $sql .= "'".$this->admin_username."', "; + $sql .= "'".md5($salt.$this->admin_password)."', "; + $sql .= "'$salt', "; + $sql .= "now(), "; + $sql .= "'".$this->admin_username."' "; + $sql .= ");"; + $this->write_debug( $sql."\n"); + $this->dbh->exec(check_sql($sql)); + unset($sql); } $this->write_progress("\tChecking if superuser contact exists"); $sql = "select count(*) from v_contacts "; @@ -996,7 +999,7 @@ include "root.php"; $prep_statement->execute(); $row = $prep_statement->fetch(PDO::FETCH_ASSOC); if ($row['count'] == 0) { - //add the user to the superadmin group + //add the user to the superadmin group $sql = "insert into v_group_users "; $sql .= "("; $sql .= "group_user_uuid, "; diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 0167ea9187..298d3a9b54 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -29,7 +29,7 @@ include "root.php"; class install_switch { protected $global_settings; - protected $config_lua; + //protected $config_lua; protected $dbh; public $debug = false; @@ -43,6 +43,7 @@ include "root.php"; throw new Exception('The parameter $global_settings must be a global_settings object (or a subclass of)'); } $this->global_settings = $global_settings; +/* if (is_dir("/etc/fusionpbx")){ $this->config_lua = "/etc/fusionpbx/config.lua"; }elseif (is_dir("/usr/local/etc/fusionpbx")){ @@ -53,6 +54,7 @@ include "root.php"; throw new Exception("Could not work out where to put the config.lua"); } $this->config_lua = normalize_path($this->config_lua); +*/ } //utility Functions @@ -89,20 +91,20 @@ include "root.php"; function install_phase_1() { $this->write_progress("Install phase 1 started for switch"); $this->copy_conf(); - $this->copy_scripts(); + //$this->copy_scripts(); $this->write_progress("Install phase 1 completed for switch"); } function install_phase_2() { $this->write_progress("Install phase 2 started for switch"); - $this->create_config_lua(); + //$this->create_config_lua(); $this->restart_switch(); $this->write_progress("Install phase 2 completed for switch"); } function upgrade() { - $this->copy_scripts(); - $this->create_config_lua(); + //$this->copy_scripts(); + //$this->create_config_lua(); } protected function copy_conf() { @@ -190,6 +192,7 @@ include "root.php"; } } +/* public function create_config_lua() { //define the database connection as global global $db; @@ -346,7 +349,7 @@ include "root.php"; unset($tmp); fclose($fout); } - +*/ protected function restart_switch() { $esl = new event_socket; if(!$esl->connect($this->global_settings->switch_event_host(), $this->global_settings->switch_event_port(), $this->global_settings->switch_event_password())) {