From a0e3cd12686762992e6a901a65f3398a80f0235c Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 22 Oct 2022 18:16:52 -0600 Subject: [PATCH] Use is_writable on the config directory - If the directory is writable and config.php exists then use it to write the config.conf file. - Otherwise provide a message on the commands to run to create the config.conf file. --- core/install/install.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/core/install/install.php b/core/install/install.php index c498d9d26d..9b801ecba1 100644 --- a/core/install/install.php +++ b/core/install/install.php @@ -90,15 +90,15 @@ if (!$config_exists) { if (file_exists("/usr/local/etc/fusionpbx/config.php")) { //bsd - $config_php = "/usr/local/etc/fusionpbx/config.php"; + $config_path = "/usr/local/etc/fusionpbx"; } elseif (file_exists("/etc/fusionpbx/config.php")) { //linux - $config_php = "/etc/fusionpbx/config.php"; + $config_path = "/etc/fusionpbx"; } - if (isset($config_php)) { + if (isset($config_path) && is_writable($config_path)) { //include the config.php file - include $config_php; + include $config_path.'/config.php'; //build the config file $install = new install; @@ -113,6 +113,14 @@ header("Location: /"); exit; } + else { + //config directory is not writable run commands as root + echo "Please run the following commands as root.
\n"; + echo "cd ".$document_root."
\n"; + echo "php ".$document_root."/core/upgrade/upgrade.php
\n"; + unset($config_path); + exit; + } } //process and save the data