Update install.php (#6699)

* Changed If statement to Switch Case. 
* Added Win option
* Created new Var $php_dir and $cache_location
This commit is contained in:
jrmcclean
2023-05-24 19:21:42 -04:00
committed by GitHub
parent 9f84d64981
commit 3b8b771c92

View File

@@ -33,7 +33,9 @@ if (!class_exists('install')) {
public function config() {
//set the default config file location
if (stristr(PHP_OS, 'BSD')) {
$os = strtoupper(substr(PHP_OS, 0, 3));
switch ($os) {
case "BSD":
$config_path = '/usr/local/etc/fusionpbx';
$config_file = $config_path.'/config.conf';
$document_root = '/usr/local/www/fusionpbx';
@@ -45,8 +47,10 @@ if (!class_exists('install')) {
$storage_dir = '/var/lib/freeswitch/storage';
$voicemail_dir = '/var/lib/freeswitch/storage/voicemail';
$scripts_dir = '/usr/share/freeswitch/scripts';
}
if (stristr(PHP_OS, 'Linux')) {
$php_dir = PHP_BINDIR;
$cache_location = '/var/cache/fusionpbx';
break;
case "LIN":
$config_path = '/etc/fusionpbx/';
$config_file = $config_path.'/config.conf';
$document_root = '/var/www/fusionpbx';
@@ -58,6 +62,25 @@ if (!class_exists('install')) {
$storage_dir = '/var/lib/freeswitch/storage';
$voicemail_dir = '/var/lib/freeswitch/storage/voicemail';
$scripts_dir = '/usr/share/freeswitch/scripts';
$php_dir = PHP_BINDIR;
$cache_location = '/var/cache/fusionpbx';
break;
case "WIN":
$config_path = $_SERVER["DOCUMENT_ROOT"].DIRECTORY_SEPARATOR.'resources';
$config_file = $config_path.DIRECTORY_SEPARATOR.'config.conf';
$config_file = $config_path.DIRECTORY_SEPARATOR.'config.conf';
$document_root = $_SERVER["DOCUMENT_ROOT"];
$conf_dir = $_SERVER['ProgramFiles'].DIRECTORY_SEPARATOR.'freeswitch'.DIRECTORY_SEPARATOR.'conf';
$sounds_dir = $_SERVER['ProgramFiles'].DIRECTORY_SEPARATOR.'freeswitch'.DIRECTORY_SEPARATOR.'sounds';
$database_dir = $_SERVER['ProgramFiles'].DIRECTORY_SEPARATOR.'freeswitch'.DIRECTORY_SEPARATOR.'db';
$recordings_dir = $_SERVER['ProgramFiles'].DIRECTORY_SEPARATOR.'freeswitch'.DIRECTORY_SEPARATOR.'recordings';
$storage_dir = $_SERVER['ProgramFiles'].DIRECTORY_SEPARATOR.'freeswitch'.DIRECTORY_SEPARATOR.'storage';
$voicemail_dir = $_SERVER['ProgramFiles'].DIRECTORY_SEPARATOR.'freeswitch'.DIRECTORY_SEPARATOR.'voicemail';
$scripts_dir = $_SERVER['ProgramFiles'].DIRECTORY_SEPARATOR.'freeswitch'.DIRECTORY_SEPARATOR.'scripts';
$php_dir = dirname(PHP_BINARY);
$cache_location = dirname($_SERVER['DOCUMENT_ROOT']).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'fusionpbx';
break;
}
//end the script if the config path is not set
@@ -98,12 +121,12 @@ if (!class_exists('install')) {
$conf .= "document.root = ".$document_root."\n";
$conf .= "project.path =\n";
$conf .= "temp.dir = /tmp\n";
$conf .= "php.dir = ".PHP_BINDIR."\n";
$conf .= "php.dir = ".$php_dir."\n";
$conf .= "php.bin = php\n";
$conf .= "\n";
$conf .= "#cache settings\n";
$conf .= "cache.method = file\n";
$conf .= "cache.location = /var/cache/fusionpbx\n";
$conf .= "cache.location = ".$cache_location."\n";
$conf .= "cache.settings = true\n";
$conf .= "\n";
$conf .= "#switch settings\n";