If the extension or dialplan xml directories are disabled or don't exist don't add sub directories.

This commit is contained in:
Mark Crane
2012-07-08 11:26:37 +00:00
parent e44426ee1a
commit f2db211c44
4 changed files with 26 additions and 16 deletions

View File

@@ -48,23 +48,27 @@
}
//if the public directory doesn't exist then create it
if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public')) { mkdir($_SESSION['switch']['dialplan']['dir'].'/public',0777,true); }
if (strlen($_SESSION['switch']['dialplan']['dir']) > 0) {
if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public')) { mkdir($_SESSION['switch']['dialplan']['dir'].'/public',0777,true); }
}
//if multiple domains then make sure that the dialplan/public/domain_name.xml file exists
if (count($_SESSION["domains"]) > 1) {
//make sure the public directory and xml file exist
if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public'.$_SESSION['domains'][$domain_uuid]['domain_name'])) {
mkdir($_SESSION['switch']['dialplan']['dir'].'/public/'.$_SESSION['domains'][$domain_uuid]['domain_name'],0777,true);
}
$file = $_SESSION['switch']['dialplan']['dir']."/public/".$_SESSION['domains'][$domain_uuid]['domain_name'].".xml";
if (!file_exists($file)) {
$fout = fopen($file,"w");
$xml = "<include>\n";
$xml .= " <X-PRE-PROCESS cmd=\"include\" data=\"".$_SESSION['domains'][$domain_uuid]['domain_name']."/*.xml\"/>\n";
$xml .= "</include>\n";
fwrite($fout, $xml);
fclose($fout);
unset($xml,$file);
if (strlen($_SESSION['switch']['dialplan']['dir']) > 0) {
if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public'.$_SESSION['domains'][$domain_uuid]['domain_name'])) {
mkdir($_SESSION['switch']['dialplan']['dir'].'/public/'.$_SESSION['domains'][$domain_uuid]['domain_name'],0777,true);
}
$file = $_SESSION['switch']['dialplan']['dir']."/public/".$_SESSION['domains'][$domain_uuid]['domain_name'].".xml";
if (!file_exists($file)) {
$fout = fopen($file,"w");
$xml = "<include>\n";
$xml .= " <X-PRE-PROCESS cmd=\"include\" data=\"".$_SESSION['domains'][$domain_uuid]['domain_name']."/*.xml\"/>\n";
$xml .= "</include>\n";
fwrite($fout, $xml);
fclose($fout);
unset($xml,$file);
}
}
}

View File

@@ -25,6 +25,8 @@
*/
//if the extensions dir doesn't exist then create it
if (!is_dir($_SESSION['switch']['extensions']['dir'])) { mkdir($_SESSION['switch']['extensions']['dir'],0777,true); }
if (strlen($_SESSION['switch']['extensions']['dir']) > 0) {
if (!is_dir($_SESSION['switch']['extensions']['dir'])) { mkdir($_SESSION['switch']['extensions']['dir'],0777,true); }
}
?>

View File

@@ -25,6 +25,8 @@
*/
//if the recordings directory doesn't exist then create it
if (!is_readable($_SESSION['switch']['recordings']['dir'])) { mkdir($_SESSION['switch']['recordings']['dir'],0777,true); }
if (strlen($_SESSION['switch']['recordings']['dir']) > 0) {
if (!is_readable($_SESSION['switch']['recordings']['dir'])) { mkdir($_SESSION['switch']['recordings']['dir'],0777,true); }
}
?>

View File

@@ -27,7 +27,9 @@
if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
//if the resource scripts resource directory does not exist then create it
if (!is_dir($_SESSION['switch']['scripts']['dir']."/resources")) { mkdir($_SESSION['switch']['scripts']['dir']."/resources",0755,true); }
if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
if (!is_dir($_SESSION['switch']['scripts']['dir']."/resources")) { mkdir($_SESSION['switch']['scripts']['dir']."/resources",0755,true); }
}
//get odbc information
$sql = "select count(*) as num_rows from v_databases ";