mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-02-21 18:36:31 +00:00
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
@@ -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();
|
||||
|
||||
@@ -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() {
|
||||
@@ -279,6 +278,15 @@ include "root.php";
|
||||
|
||||
public function create_config_lua() {
|
||||
$this->write_progress("\tCreating " . $this->config_lua);
|
||||
$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'");
|
||||
}
|
||||
}
|
||||
|
||||
global $db;
|
||||
//get the odbc information
|
||||
$sql = "select count(*) as num_rows from v_databases ";
|
||||
@@ -335,7 +343,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") {
|
||||
@@ -359,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";
|
||||
@@ -404,7 +414,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);
|
||||
|
||||
Reference in New Issue
Block a user