fix: issues with recent discovery refactor (#7437)

fix find_port_id() deleting all variables when device_id was given
improve find_port_id() to find ports where only a number is given
fix orphan deletion count
fix insert and update of links with strings where int are required
This commit is contained in:
Tony Murray
2017-10-06 08:53:16 -05:00
committed by GitHub
parent a2b9342f05
commit f92449e637
2 changed files with 24 additions and 11 deletions

View File

@@ -235,7 +235,8 @@ foreach (dbFetchRows($sql, array($device['device_id'])) as $test) {
}
// remove orphaned links
$deleted = dbQuery('DELETE `l` FROM `links` `l` LEFT JOIN `devices` `d` ON `d`.`device_id` = `l`.`local_device_id` WHERE `d`.`device_id` IS NULL');
$del_result = dbQuery('DELETE `l` FROM `links` `l` LEFT JOIN `devices` `d` ON `d`.`device_id` = `l`.`local_device_id` WHERE `d`.`device_id` IS NULL');
$deleted = mysqli_affected_rows($del_result);
echo str_repeat('-', $deleted);
d_echo(" $deleted orphaned links deleted\n");
@@ -244,5 +245,7 @@ unset(
$sql,
$fdp_array,
$cdp_array,
$lldp_array
$lldp_array,
$del_result,
$deleted
);