mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added:
Arithmetic support in rules Braces support in rules Changed wildcard character to '@'
This commit is contained in:
@@ -34,7 +34,7 @@ function GenSQL($rule) {
|
|||||||
if( strstr($opt,'%') && strstr($opt,'.') ) {
|
if( strstr($opt,'%') && strstr($opt,'.') ) {
|
||||||
$tmpp = explode(".",$opt,2);
|
$tmpp = explode(".",$opt,2);
|
||||||
$tmpp[0] = str_replace("%","",$tmpp[0]);
|
$tmpp[0] = str_replace("%","",$tmpp[0]);
|
||||||
$tables[] = mres($tmpp[0]);
|
$tables[] = mres(str_replace("(","",$tmpp[0]));
|
||||||
$rule = str_replace($opt,$tmpp[0].'.'.$tmpp[1],$rule);
|
$rule = str_replace($opt,$tmpp[0].'.'.$tmpp[1],$rule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ function GenSQL($rule) {
|
|||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sql = "SELECT * FROM ".implode(",",$tables)." WHERE (".$join."".$tables[0].".device_id = ?) && (".str_replace(array("*","!~","~"),array("%","NOT LIKE","LIKE"),$rule).")";
|
$sql = "SELECT * FROM ".implode(",",$tables)." WHERE (".$join."".str_replace("(","",$tables[0]).".device_id = ?) && (".str_replace(array("%","@","!~","~"),array("","%","NOT LIKE","LIKE"),$rule).")";
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user