From d5016a107b34e622ca39ac7a14ba4b3223e70e93 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 10 Dec 2020 20:19:54 -0700 Subject: [PATCH] Delete xml_cdr_import_update.php --- app/xml_cdr/xml_cdr_import_update.php | 157 -------------------------- 1 file changed, 157 deletions(-) delete mode 100644 app/xml_cdr/xml_cdr_import_update.php diff --git a/app/xml_cdr/xml_cdr_import_update.php b/app/xml_cdr/xml_cdr_import_update.php deleted file mode 100644 index b308b64604..0000000000 --- a/app/xml_cdr/xml_cdr_import_update.php +++ /dev/null @@ -1,157 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -//check the permission - if(defined('STDIN')) { - $document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]); - preg_match("/^(.*)\/mod\/.*$/", $document_root, $matches); - $document_root = $matches[1]; - set_include_path($document_root); - require_once "resources/require.php"; - $_SERVER["DOCUMENT_ROOT"] = $document_root; - } - else { - echo "access denied"; - exit; - } - -//determine where the xml cdr will be archived - $sql = "select * from v_vars "; - $sql .= "where domain_uuid = '1' "; - $sql .= "and var_name = 'xml_cdr_archive' "; - $row = $db->query($sql)->fetch(); - $var_value = trim($row["var_value"]); - switch ($var_value) { - case "dir": - $xml_cdr_archive = 'dir'; - break; - case "db": - $xml_cdr_archive = 'db'; - break; - case "none": - $xml_cdr_archive = 'none'; - break; - default: - $xml_cdr_archive = 'dir'; - break; - } - -//get the list of installed apps from the core and mod directories - if ($xml_cdr_archive == "db") { - //get the xml cdr list - $sql = "select xml_cdr, uuid from v_xml_cdr "; - $sql .= "where waitsec is null "; - //$sql .= "limit 5000 "; - //start the transaction - $db->beginTransaction(); - //loop through the results - $x = 0; - foreach ($db->query($sql,PDO::FETCH_ASSOC) as $row) { - //get the values from the db - $uuid = $row['uuid']; - $xml_string = $row['xml_cdr']; - //save each set of records and begin a new transaction - if ($x > 5000) { - //save the transaction - $db->commit(); - //start the transaction - $db->beginTransaction(); - //reset the count - $x = 0; - } - //parse the xml to get the call detail record info - try { - $xml = simplexml_load_string($xml_string); - } - catch(Exception $e) { - echo $e->getMessage(); - } - //get the values from the xml and set at variables - $uuid = urldecode($xml->variables->uuid); - $waitsec = urldecode($xml->variables->waitsec); - //update the database - if (strlen($waitsec) > 0) { - $sql = "update v_xml_cdr "; - $sql .= "set waitsec = '$waitsec' "; - $sql .= "where uuid = '$uuid' "; - echo $sql."\n"; - $db->exec($sql); - $x++; - } - } - //save the transaction - $db->commit(); - //echo finished - echo "completed\n"; - } - if ($xml_cdr_archive == "dir") { - $xml_cdr_list = glob($_SESSION['switch']['log']['dir']."/xml_cdr/archive/*/*/*/*.xml"); - echo "count: ".count($xml_cdr_list)."\n"; - //print_r($xml_cdr_list); - $x = 0; - //start the transaction - $db->beginTransaction(); - //loop through the xml cdr records - foreach ($xml_cdr_list as $xml_cdr) { - //save each set of records and begin a new transaction - if ($x > 5000) { - //save the transaction - $db->commit(); - //start the transaction - $db->beginTransaction(); - //reset the count - $x = 0; - } - //get the xml cdr string - $xml_string = file_get_contents($xml_cdr); - //parse the xml to get the call detail record info - try { - $xml = simplexml_load_string($xml_string); - } - catch(Exception $e) { - echo $e->getMessage(); - } - //get the values from the xml and set at variables - $uuid = urldecode($xml->variables->uuid); - $waitsec = urldecode($xml->variables->waitsec); - //update the database - //if ($num_rows == "0" && strlen($waitsec) > 0) { - if (strlen($waitsec) > 0) { - $sql = "update v_xml_cdr "; - $sql .= "set waitsec = '$waitsec' "; - $sql .= "where uuid = '$uuid' "; - echo $sql."\n"; - $db->exec($sql); - $x++; - } - } - //save the transaction - $db->commit(); - //echo finished - echo "completed\n"; - } - -?>