Fix a problem loading sip profiles when /etc/fusionpbx directory exists for a non package install.

This commit is contained in:
Mark Crane 2014-10-29 07:13:42 +00:00
parent 40366ffd8b
commit f55e277026
1 changed files with 12 additions and 12 deletions

View File

@ -27,28 +27,28 @@
//if the number of rows is 0 then read the sip profile xml into the database //if the number of rows is 0 then read the sip profile xml into the database
if ($domains_processed == 1) { if ($domains_processed == 1) {
//define the variables //define the variables
$custom = '';
$source = ''; $source = '';
$destination = '';
//check if the directory exists and set the paths //check if the directory exists and set the paths
if (file_exists('/etc/fusionpbx')) { if (file_exists('/etc/fusionpbx/resources/templates/conf')) {
//linux //linux
$custom = '/etc/fusionpbx/resources/templates/conf/sip_profiles';
$source = '/usr/share/examples/fusionpbx/resources/templates/conf/sip_profiles'; $source = '/usr/share/examples/fusionpbx/resources/templates/conf/sip_profiles';
$destination = '/etc/fusionpbx/resources/templates/conf/sip_profiles';
} }
if (file_exists('/usr/local/etc/fusionpbx')) { if (file_exists('/usr/local/etc/fusionpbx/resources/templates/conf')) {
//bsd //bsd
$custom = '/usr/local/etc/fusionpbx/resources/templates/conf/sip_profiles';
$source = '/usr/local/share/fusionpbx/resources/templates/conf/sip_profiles'; $source = '/usr/local/share/fusionpbx/resources/templates/conf/sip_profiles';
$destination = '/usr/local/etc/fusionpbx/resources/templates/conf/sip_profiles';
} }
//copy the conf sip profiles to the /etc/fusionpbx/resources/templates/conf directory //copy the conf sip profiles to the /etc/fusionpbx/resources/templates/conf directory
if (strlen($custom) > 0 && strlen($source) > 0) { if (strlen($source) > 0 && strlen($destination) > 0) {
if (!file_exists($custom)) { if (!file_exists($destination)) {
if (file_exists($source)) { if (file_exists($source)) {
//add the directory structure //add the directory structure
mkdir($custom,0777,true); mkdir($destination,0777,true);
//copy from source to custom //copy from source to destination
$obj = new install; $obj = new install;
$obj->recursive_copy($source,$custom); $obj->recursive_copy($source,$destination);
} }
} }
} }
@ -60,10 +60,10 @@
$prep_statement->execute(); $prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC); $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) { if ($row['num_rows'] == 0) {
if (file_exists('/etc/fusionpbx')) { if (file_exists('/etc/fusionpbx/resources/templates/conf/sip_profiles')) {
$sip_profile_dir = '/etc/fusionpbx/resources/templates/conf/sip_profiles/*.xml'; $sip_profile_dir = '/etc/fusionpbx/resources/templates/conf/sip_profiles/*.xml';
} }
elseif (file_exists('/usr/local/etc/fusionpbx')) { elseif (file_exists('/usr/local/etc/fusionpbx/resources/templates/conf/sip_profiles')) {
$sip_profile_dir = '/usr/local/etc/fusionpbx/resources/templates/conf/sip_profiles/*.xml'; $sip_profile_dir = '/usr/local/etc/fusionpbx/resources/templates/conf/sip_profiles/*.xml';
} }
else { else {