mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added Debug-Info if required.
This commit is contained in:
@ -236,7 +236,7 @@ function renamehost($id, $new, $source = 'console')
|
||||
|
||||
function delete_device($id)
|
||||
{
|
||||
global $config;
|
||||
global $config, $debug;
|
||||
$ret = '';
|
||||
|
||||
$host = dbFetchCell("SELECT hostname FROM devices WHERE device_id = ?", array($id));
|
||||
@ -252,13 +252,17 @@ function delete_device($id)
|
||||
$fields = array('device_id','host');
|
||||
foreach( $fields as $field ) {
|
||||
foreach( dbFetch("SELECT table_name FROM information_schema.columns WHERE table_schema = ? AND column_name = ?",array($config['db_name'],$field)) as $table ) {
|
||||
dbDelete($table, "`$field` = ?", array($id));
|
||||
$table = $table['table_name'];
|
||||
$entries = (int) dbDelete($table, "`$field` = ?", array($id));
|
||||
if( $entries > 0 && $debug === true ) {
|
||||
$ret .= "$field@$table = #$entries\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shell_exec("rm -rf ".trim($config['rrd_dir'])."/$host");
|
||||
|
||||
$ret = "Removed device $host";
|
||||
$ret .= "Removed device $host\n";
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user