Change TFTP detection logic

Accept first hit
This commit is contained in:
steve-lad 2021-06-27 10:19:20 +02:00
parent d83c3ab93f
commit bab83c7e3e
No known key found for this signature in database
GPG key ID: 4D1D760BACDAFF81
2 changed files with 12 additions and 7 deletions

View file

@ -911,8 +911,13 @@ function checkTftpServer() {
// Need to set the new value here to pass to extconfigs below // Need to set the new value here to pass to extconfigs below
$settingsFromDb['tftp_path']['data'] = $tftpRootPath; $settingsFromDb['tftp_path']['data'] = $tftpRootPath;
} }
// Found sentinel file. Remove it and exit loop
if (file_exists($tempFile)) {
unlink($tempFile);
} }
// remove all sentinel file break;
}
// Did not find sentinel so remove and continue
if (file_exists($tempFile)) { if (file_exists($tempFile)) {
unlink($tempFile); unlink($tempFile);
} }

View file

@ -583,15 +583,15 @@ class xmlinterface
case 'softKeyFile': case 'softKeyFile':
case 'dialTemplate': // Доработать ! case 'dialTemplate': // Доработать !
$xml_ext_file = ''; $xml_ext_file = '';
$templet_path = (($dkey == 'softKeyFile') ? $dev_config['tftp_softkey_path'] : $dev_config['tftp_dialplan_path']); $template_path = (($dkey == 'softKeyFile') ? $dev_config['tftp_softkey_path'] : $dev_config['tftp_dialplan_path']);
$tmp_key = ($dkey == 'softKeyFile') ? 'softkeyset' : '_dialrules'; $tmp_key = ($dkey == 'softKeyFile') ? 'softkeyset' : '_dialrules';
if (!empty($dev_config[$tmp_key])) { if (!empty($dev_config[$tmp_key])) {
$xml_ext_file = (($dkey == 'softKeyFile') ? 'softkey' . $dev_config[$tmp_key] . '.xml' : $dev_config[$tmp_key] . '.xml'); $xml_ext_file = (($dkey == 'softKeyFile') ? 'softkey' . $dev_config[$tmp_key] . '.xml' : $dev_config[$tmp_key] . '.xml');
} }
if (empty($xml_ext_file) || !file_exists($templet_path . '/' . $xml_ext_file)) { if (empty($xml_ext_file) || !file_exists($template_path . '/' . $xml_ext_file)) {
$xml_ext_file = (($dkey == 'softKeyFile') ? 'softkeydefault.xml' : 'dialplan.xml'); $xml_ext_file = (($dkey == 'softKeyFile') ? 'softkeydefault.xml' : 'dialplan.xml');
} }
if (file_exists($templet_path . '/' . $xml_ext_file)) { if (file_exists($template_path . '/' . $xml_ext_file)) {
$xml_node->$dkey = $xml_ext_file; $xml_node->$dkey = $xml_ext_file;
} else { } else {
$xml_node->$dkey = null; $xml_node->$dkey = null;