Update app_defaults.php

Make the music on hold app defaults more better at loading the xml file if the music on hold table is empty.
This commit is contained in:
FusionPBX 2016-08-03 18:47:02 -06:00 committed by GitHub
parent 5d9558adfd
commit 3cc4964503
1 changed files with 85 additions and 84 deletions

View File

@ -26,10 +26,17 @@
if ($domains_processed == 1) {
//require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php";
//$moh = new switch_music_on_hold;
//$moh->xml();
//$moh->save();
//set the directory
$xml_dir = $_SESSION["switch"]["conf"]["dir"].'/autoload_configs';
$xml_file = $xml_dir."/local_stream.conf";
//rename the file
if (file_exist($xml_dir.'/local_stream.conf.xml')) {
rename($xml_dir.'/local_stream.conf.xml', $xml_dir.'/'.$xml_file);
}
if (file_exist($xml_dir.'/local_stream.conf.xml.noload')) {
rename($xml_dir.'/local_stream.conf.xml.noload', $xml_dir.'/'.$xml_file);
}
//add the music_on_hold list to the database
$sql = "select count(*) as num_rows from v_music_on_hold; ";
@ -39,9 +46,7 @@
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) {
//set the directory
$xml_dir = $_SESSION["switch"]["conf"]["dir"].'/autoload_configs';
$xml_file = $xml_dir."/local_stream.conf.xml";
//set the alternate directory
$xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/resources/templates/conf/autoload_configs/local_stream.conf';
//load the xml and save it into an array
@ -107,12 +112,8 @@
}
}
//rename the file
rename($xml_dir.'/local_stream.conf.xml', $xml_dir.'/local_stream.conf');
} //if num_rows
} //if prep_statement
}
?>