some new things!

git-svn-id: http://www.observium.org/svn/observer/trunk@221 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2008-04-03 21:52:59 +00:00
parent 4e10de77a7
commit 70b36878be
7 changed files with 56 additions and 16 deletions
+27 -3
View File
@@ -33,10 +33,15 @@
mysql_query("INSERT INTO `interfaces` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('".$device['device_id']."','$ifIndex','$ifName')");
# Add Interface
echo("+");
} else {
# Interface Already Exists
echo(".");
} else {
mysql_query("UPDATE `interfaces` SET `deleted` = '0' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex' AND `deleted` = '1'");
if(mysql_affected_rows()) {
echo("*");
} else {
echo(".");
}
}
$int_exists[] = "$ifIndex";
} else {
# Ignored ifName
echo("X");
@@ -44,6 +49,25 @@
}
}
$sql = "SELECT * FROM `interfaces` WHERE `device_id` = '".$device['device_id']."' AND `deleted` = '0'";
$query = mysql_query($sql);
while ($test_if = mysql_fetch_array($query)) {
unset($exists);
$i = 0;
while ($i < count($int_exists) && !$exists) {
$this_if = $test_if['ifIndex'];
if ($int_exists[$i] == $this_if) { $exists = 1; }
$i++;
}
if(!$exists) {
echo("-");
mysql_query("UPDATE `interfaces` SET `deleted` = '1' WHERE interface_id = '" . $test_if['interface_id'] . "'");
}
}
unset($temp_exists);
echo("\n");
?>