Change the class method getxml to get_xml

- Count the primary key in the SQL statement. Slightly more efficient.
- Updated $dir to $xml_dir
- Add an extra line feed
- Change spaces to tabs
- Remove the method return
This commit is contained in:
FusionPBX
2025-12-08 08:23:12 -07:00
committed by GitHub
parent e2ac2b3272
commit 0e7ec5baa2
2 changed files with 14 additions and 12 deletions

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2017 Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -26,22 +26,23 @@
if ($domains_processed == 1) { if ($domains_processed == 1) {
//add the variables to the database //add the variables to the database
$sql = "select count(*) from v_number_translations "; $sql = "select count(number_translation_uuid) from v_number_translations ";
$num_rows = $database->select($sql, null, 'column'); $num_rows = $database->select($sql, null, 'column');
unset($sql); unset($sql);
if ($num_rows == 0) { if ($num_rows == 0) {
//get the array of xml files //get the array of xml files
$dir = dirname(__DIR__, 2) . "/app/number_translations/resources/switch/conf/number_translation"; $xml_dir = dirname(__DIR__, 2) . "/app/number_translations/resources/switch/conf/number_translation";
//number_translation class
//number_translation class
$number_translation = new number_translations; $number_translation = new number_translations;
//process the xml files //process the xml files
$xml_list = array_diff(scandir($dir), array('..', '.')); $xml_list = array_diff(scandir($xml_dir), array('..', '.'));
foreach ($xml_list as $xml_file) { foreach ($xml_list as $xml_file) {
//get and parse the xml //get and parse the xml
$file_content = file_get_contents($dir . '/' . $xml_file); $file_content = file_get_contents($xml_dir . '/' . $xml_file);
$number_translation->getxml($file_content); $number_translation->get_xml($file_content);
$number_translation->import(); $number_translation->import();
} }

View File

@@ -88,13 +88,14 @@ class number_translations {
} }
/** /**
*
* Load properly private property xml * Load properly private property xml
* @param string $file_content content of template files. *
* @param string $xml content of template files.
*
* @return void
*/ */
public function getxml($file_content) { public function get_xml($xml) {
$this->xml = $file_content; $this->xml = $xml;
return $this->xml;
} }
/** /**