Browse Source

Enable setting a custom config_file path

FusionPBX 2 năm trước cách đây
mục cha
commit
55c8b6282b
1 tập tin đã thay đổi với 7 bổ sung2 xóa
  1. 7 2
      resources/require.php

+ 7 - 2
resources/require.php

@@ -31,8 +31,13 @@
 	elseif (file_exists('/etc/fusionpbx/config.conf')) {
 	elseif (file_exists('/etc/fusionpbx/config.conf')) {
 		$config_file = '/etc/fusionpbx/config.conf';
 		$config_file = '/etc/fusionpbx/config.conf';
 	}
 	}
-	elseif (file_exists(__DIR__ . '/config.conf')) {
-		$config_file = __DIR__ . '/config.conf';
+	elseif (file_exists(__DIR__ . '/config.php')) {
+		//set a custom config_file variable after the config.php has been validated
+		$file_content = file_get_contents(__DIR__ . '/config.php');
+		$pattern = '/^<\?php\s+\$config_file\s+=\s+[\'"](.+?)[\'"];\s+\?>$/';
+		if (preg_match($pattern, $file_content, $matches)) {
+			$config_file = $matches[1];
+		}
 	}
 	}
 
 
 //parse the config.conf file
 //parse the config.conf file