changed path handling for create_config_lua

thanks moteus for the hint
This commit is contained in:
Matthew Vale
2015-12-03 11:19:09 +00:00
parent 5149307d11
commit cc3f8e9945
2 changed files with 6 additions and 6 deletions

View File

@@ -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();

View File

@@ -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);