mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Reconstruct addHost() so it is easier to understand
Update addHost() to return either device_id or a string modify print_error(), print_message() to allow for $quiet variable Only call addHost() once in addhost.php, if the snmp version isn't set, addHost will cope Fix up snmp-scan.php and discovery-protocols.inc.php to detect when a device already exists change in ip_exists() to make it more readable
This commit is contained in:
@@ -80,9 +80,13 @@ function isCli() {
|
||||
}
|
||||
}
|
||||
|
||||
function print_error($text) {
|
||||
global $console_color;
|
||||
function print_error($text, $quiet = false) {
|
||||
if ($quiet) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isCli()) {
|
||||
global $console_color;
|
||||
print $console_color->convert("%r".$text."%n\n", false);
|
||||
}
|
||||
else {
|
||||
@@ -90,9 +94,14 @@ function print_error($text) {
|
||||
}
|
||||
}
|
||||
|
||||
function print_message($text) {
|
||||
function print_message($text, $quiet = false) {
|
||||
if ($quiet) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isCli()) {
|
||||
print Console_Color2::convert("%g".$text."%n\n", false);
|
||||
global $console_color;
|
||||
print $console_color->convert("%g".$text."%n\n", false);
|
||||
}
|
||||
else {
|
||||
echo('<div class="alert alert-success"><img src="images/16/tick.png" align="absmiddle"> '.$text.'</div>');
|
||||
|
Reference in New Issue
Block a user