From b71eacb07551d78df997fa2f7a60ba0198911f56 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 21 Aug 2025 18:28:27 -0600 Subject: [PATCH] Update failed directory permissions --- app/xml_cdr/app_defaults.php | 14 ---------- app/xml_cdr/resources/service/xml_cdr.php | 31 ++++++++++++++++++++--- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/app/xml_cdr/app_defaults.php b/app/xml_cdr/app_defaults.php index 993a91ce60..bc8994d58d 100644 --- a/app/xml_cdr/app_defaults.php +++ b/app/xml_cdr/app_defaults.php @@ -27,20 +27,6 @@ //make sure that prefix-a-leg is set to true in the xml_cdr.conf.xml file if ($domains_processed == 1) { - - //get the xml_cdr directory - $xml_cdr_dir = $settings->get('switch', 'log').'/xml_cdr'; - - //create the failed/size directory - if (!file_exists($xml_cdr_dir.'/failed/size')) { - mkdir($xml_cdr_dir.'/failed/size', 0660, true); - } - - //create the failed/invalid_xml directory - if (!file_exists($xml_cdr_dir.'/failed/invalid_xml')) { - mkdir($xml_cdr_dir.'/failed/invalid_xml', 0660, true); - } - /* $file_contents = file_get_contents($_SESSION['switch']['conf']['dir']."/autoload_configs/xml_cdr.conf.xml"); $file_contents_new = str_replace("param name=\"prefix-a-leg\" value=\"false\"/", "param name=\"prefix-a-leg\" value=\"true\"/", $file_contents); diff --git a/app/xml_cdr/resources/service/xml_cdr.php b/app/xml_cdr/resources/service/xml_cdr.php index 58c0c1a90a..cfa34ffaf1 100644 --- a/app/xml_cdr/resources/service/xml_cdr.php +++ b/app/xml_cdr/resources/service/xml_cdr.php @@ -110,12 +110,37 @@ file_put_contents($pid_file, getmypid()); } +//get the xml_cdr directory + $xml_cdr_dir = $settings->get('switch', 'log').'/xml_cdr'; + +//rename the directory + if (file_exists($xml_cdr_dir.'/failed/invalid_xml')) { + rename($xml_cdr_dir.'/failed/invalid_xml', $xml_cdr_dir.'/failed/xml'); + } + +//create the invalid xml directory + if (!file_exists($xml_cdr_dir.'/failed/xml')) { + mkdir($xml_cdr_dir.'/failed/xml', 0770, true); + } + +//create the invalid size directory + if (!file_exists($xml_cdr_dir.'/failed/size')) { + mkdir($xml_cdr_dir.'/failed/size', 0770, true); + } + +//create the invalid sql directory + if (!file_exists($xml_cdr_dir.'/failed/sql')) { + mkdir($xml_cdr_dir.'/failed/sql', 0770, true); + } + +//update permissions to correct systems with the wrong permissions + if (file_exists($xml_cdr_dir.'/failed')) { + exec('chmod 770 -R '.$xml_cdr_dir.'/failed'); + } + //import the call detail records from HTTP POST or file system $cdr = new xml_cdr; -//get the cdr record - $xml_cdr_dir = $settings->get('switch', 'log').'/xml_cdr'; - //service loop while (true) {