Enable setting a custom config_file path

This commit is contained in:
FusionPBX 2023-08-14 21:18:10 -06:00 committed by GitHub
parent 8ceaa5ce01
commit 0fb78ee94e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -31,8 +31,13 @@
elseif (file_exists('/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