Network map sql update + fix for duplicate links

This commit is contained in:
laf
2015-07-15 20:09:20 +01:00
parent 94e4a075fc
commit 4c39421787
2 changed files with 8 additions and 1 deletions

View File

@ -35,7 +35,7 @@ if (is_admin() === false && is_read() === false) {
$tmp_devices = array();
$tmp_ids = array();
$tmp_links = array();
$tmp_link_ids = array();
$ports = dbFetchRows("SELECT
`D1`.`device_id` AS `local_device_id`,
@ -161,6 +161,10 @@ foreach ($list as $items) {
}
$link_color = $config['map_legend'][$link_used];
$tmp_links[] = array('from'=>$items['local_device_id'],'to'=>$items['remote_device_id'],'label'=>shorten_interface_type($items['local_ifname']) . ' > ' . shorten_interface_type($items['remote_ifname']),'title'=>generate_port_link($local_port, "<img src='graph.php?type=port_bits&amp;id=".$items['local_port_id']."&amp;from=".$config['time']['day']."&amp;to=".$config['time']['now']."&amp;width=100&amp;height=20&amp;legend=no&amp;bg=".str_replace("#","", $row_colour)."'>",'',0,1),'width'=>$width,'color'=>$link_color);
if (!in_array($items['remote_port_id'],$tmp_link_ids)) {
$tmp_links[] = array('from'=>$items['local_device_id'],'to'=>$items['remote_device_id'],'label'=>shorten_interface_type($items['local_ifname']) . ' > ' . shorten_interface_type($items['remote_ifname']),'title'=>generate_port_link($local_port, "<img src='graph.php?type=port_bits&amp;id=".$items['local_port_id']."&amp;from=".$config['time']['day']."&amp;to=".$config['time']['now']."&amp;width=100&amp;height=20&amp;legend=no&amp;bg=".str_replace("#","", $row_colour)."'>",'',0,1),'width'=>$width,'color'=>$link_color);
}
array_push($tmp_link_ids,$items['local_port_id']);
}
$node_devices = $tmp_devices;

3
sql-schema/057.sql Normal file
View File

@ -0,0 +1,3 @@
ALTER TABLE `ipv4_mac` CHANGE `mac_address` `mac_address` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , CHANGE `ipv4_address` `ipv4_address` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
ALTER TABLE `ipv4_mac` ADD INDEX ( `port_id`), ADD INDEX (`mac_address` )
ALTER TABLE `ipv4_mac` DROP INDEX `interface_id`, DROP INDEX `interface_id_2`