Update xml_cdr service

Use array_slice to make the code more efficient

Service is unable to create the directories. Make the failed directories with app_defaults when run from command line.

php /var/www/fusionpbx/core/upgrade/upgrade.php
chown -R www-data:www-data /var/log/freeswitch/xml_cdr
This commit is contained in:
FusionPBX
2025-08-16 11:54:51 -06:00
committed by GitHub
parent 324c007fd4
commit f641d32195
3 changed files with 32 additions and 19 deletions

View File

@@ -359,14 +359,8 @@
//load the string into an xml object
$xml = simplexml_load_string($xml_string, 'SimpleXMLElement', LIBXML_NOCDATA);
if ($xml === false) {
//failed to load the XML, move the XML file to the failed directory
if (!empty($xml_cdr_dir)) {
if (!file_exists($xml_cdr_dir.'/failed/invalid_xml')) {
if (!mkdir($xml_cdr_dir.'/failed/invalid_xml', 0660, true)) {
die('Failed to create '.$xml_cdr_dir.'/failed');
}
}
rename($xml_cdr_dir.'/'.$this->file, $xml_cdr_dir.'/failed/invalid_xml/'.$this->file);
}