2011-04-27 17:41:35 +00:00
< ? php
echo ( " Port Stack: " );
$sql = " SELECT * FROM `ports_stack` WHERE `device_id` = ' " . $device [ 'device_id' ] . " ' " ;
2014-01-13 17:43:58 +00:00
foreach ( dbFetchRows ( $sql ) as $entry )
2011-04-27 17:41:35 +00:00
{
2012-05-16 13:25:50 +00:00
$stack_db_array [ $entry [ 'port_id_high' ]][ $entry [ 'port_id_low' ]][ 'ifStackStatus' ] = $entry [ 'ifStackStatus' ];
2011-04-27 17:41:35 +00:00
}
$stack_poll_array = snmpwalk_cache_twopart_oid ( $device , " ifStackStatus " , array ());
2012-05-16 13:25:50 +00:00
foreach ( $stack_poll_array as $port_id_high => $entry_high )
2011-04-27 17:41:35 +00:00
{
2012-05-16 13:25:50 +00:00
foreach ( $entry_high as $port_id_low => $entry_low )
2011-04-27 17:41:35 +00:00
{
$ifStackStatus = $entry_low [ 'ifStackStatus' ];
2012-05-16 13:25:50 +00:00
if ( isset ( $stack_db_array [ $port_id_high ][ $port_id_low ]))
2011-04-27 17:41:35 +00:00
{
2012-05-16 13:25:50 +00:00
if ( $stack_db_array [ $port_id_high ][ $port_id_low ][ 'ifStackStatus' ] == $ifStackStatus )
2011-04-27 17:41:35 +00:00
{
echo ( " . " );
} else {
2014-06-10 22:21:10 +01:00
dbUpdate ( array ( 'ifStackStatus' => $ifStackStatus ), 'ports_stack' , 'device_id=? AND port_id_high=? AND `port_id_low`=?' , array ( $device [ 'device_id' ], $port_id_high , $port_id_low ));
2011-04-27 17:41:35 +00:00
echo ( " U " );
2011-09-20 14:22:34 +00:00
if ( $debug ) { echo ( mysql_error ()); }
2011-04-27 17:41:35 +00:00
}
2012-05-16 13:25:50 +00:00
unset ( $stack_db_array [ $port_id_high ][ $port_id_low ]);
2011-04-27 17:41:35 +00:00
} else {
2014-06-10 22:21:10 +01:00
dbInsert ( array ( 'device_id' => $device [ 'device_id' ], 'port_id_high' => $port_id_high , 'port_id_low' => $port_id_low , 'ifStackStatus' => $ifStackStatus ), 'ports_stack' );
2011-04-27 17:41:35 +00:00
echo ( " + " );
2011-09-20 14:22:34 +00:00
if ( $debug ) { echo ( mysql_error ()); }
2011-04-27 17:41:35 +00:00
}
}
}
2012-05-16 13:25:50 +00:00
foreach ( $stack_db_array AS $port_id_high => $array )
2011-09-15 16:52:28 +00:00
{
2012-05-16 13:25:50 +00:00
foreach ( $array AS $port_id_low => $blah )
2011-09-15 16:52:28 +00:00
{
2012-05-16 13:25:50 +00:00
echo ( $device [ 'device_id' ] . " " . $port_id_low . " " . $port_id_high . " \n " );
dbDelete ( 'ports_stack' , " `device_id` = ? AND port_id_high = ? AND port_id_low = ? " , array ( $device [ 'device_id' ], $port_id_high , $port_id_low ));
2011-09-15 16:52:28 +00:00
echo ( " - " );
}
}
2011-05-03 21:46:25 +00:00
echo ( " \n " );
2011-04-27 17:41:35 +00:00
?>