mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
allow port deletion to hopefully work a bit better, due to missing base dir
git-svn-id: http://www.observium.org/svn/observer/trunk@1974 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -237,6 +237,8 @@ function renamehost($id, $new)
|
||||
|
||||
function delete_port($int_id)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` AS P, `devices` AS D WHERE P.interface_id = '".$int_id."' AND D.device_id = P.device_id"));
|
||||
mysql_query("DELETE from `adjacencies` WHERE `interface_id` = '$int_id'");
|
||||
mysql_query("DELETE from `links` WHERE `local_interface_id` = '$int_id'");
|
||||
@@ -254,6 +256,7 @@ function delete_port($int_id)
|
||||
function delete_device($id)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$host = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '$id'"), 0);
|
||||
mysql_query("DELETE FROM `devices` WHERE `device_id` = '$id'");
|
||||
$int_query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '$id'");
|
||||
@@ -264,6 +267,7 @@ function delete_device($id)
|
||||
delete_port($int_id);
|
||||
$ret .= "Removed interface $int_id ($int_if)\n";
|
||||
}
|
||||
|
||||
mysql_query("DELETE FROM `entPhysical` WHERE `device_id` = '$id'");
|
||||
mysql_query("DELETE FROM `devices_attribs` WHERE `device_id` = '$id'");
|
||||
mysql_query("DELETE FROM `devices_perms` WHERE `device_id` = '$id'");
|
||||
@@ -282,6 +286,7 @@ function delete_device($id)
|
||||
mysql_query("DELETE FROM `current` WHERE `device_id` = '$id'");
|
||||
mysql_query("DELETE FROM `sensors` WHERE `device_id` = '$id'");
|
||||
shell_exec("rm -rf ".trim($config['rrd_dir'])."/$host");
|
||||
|
||||
$ret = "Removed Device $host\n";
|
||||
return $ret;
|
||||
}
|
||||
@@ -289,6 +294,7 @@ function delete_device($id)
|
||||
function addHost($host, $community, $snmpver, $port = 161, $transport = 'udp')
|
||||
{
|
||||
global $config;
|
||||
|
||||
list($hostshort) = explode(".", $host);
|
||||
if (isDomainResolves($host))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user