Browse Source

changed path handling for create_config_lua

thanks moteus for the hint
Matthew Vale 9 years ago
parent
commit
4c15a1518c

+ 2 - 2
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();

+ 4 - 4
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);