mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
refactor: Remove external uses of GenGroupSQL()
refactor: Remove external uses of GenGroupSQL()
This commit is contained in:
@ -40,14 +40,10 @@ $devices = array();
|
||||
|
||||
$where = "";
|
||||
if (is_numeric($vars['group'])) {
|
||||
$group_pattern = dbFetchCell('SELECT `pattern` FROM `device_groups` WHERE id = '.$vars['group']);
|
||||
$group_pattern = rtrim($group_pattern, '&&');
|
||||
$group_pattern = rtrim($group_pattern, '||');
|
||||
|
||||
$device_id_sql = GenGroupSQL($group_pattern);
|
||||
if ($device_id_sql) {
|
||||
$where .= " AND D1.device_id IN ($device_id_sql) OR D2.device_id IN ($device_id_sql)";
|
||||
}
|
||||
$where .= " AND D1.device_id IN (SELECT `device_id` FROM `device_group_device` WHERE `device_group_id` = ?)";
|
||||
$sql_array[] = $vars['group'];
|
||||
$where .= " OR D2.device_id IN (SELECT `device_id` FROM `device_group_device` WHERE `device_group_id` = ?)";
|
||||
$sql_array[] = $vars['group'];
|
||||
}
|
||||
|
||||
if (in_array('mac', $config['network_map_items'])) {
|
||||
|
@ -50,14 +50,8 @@ if (isset($_POST['min_severity'])) {
|
||||
}
|
||||
|
||||
if (is_numeric($_POST['group'])) {
|
||||
$group_pattern = dbFetchCell('SELECT `pattern` FROM `device_groups` WHERE id = '.$_POST['group']);
|
||||
$group_pattern = rtrim($group_pattern, '&&');
|
||||
$group_pattern = rtrim($group_pattern, '||');
|
||||
|
||||
$device_id_sql = GenGroupSQL($group_pattern);
|
||||
if ($device_id_sql) {
|
||||
$where .= " AND devices.device_id IN ($device_id_sql)";
|
||||
}
|
||||
$where .= " AND devices.device_id IN (SELECT `device_id` FROM `device_group_device` WHERE `device_group_id` = ?)";
|
||||
$param[] = $_POST['group'];
|
||||
}
|
||||
|
||||
if (!$show_recovered) {
|
||||
|
@ -74,7 +74,7 @@ function EditDeviceGroup($group_id, $name = null, $desc = null, $pattern = null)
|
||||
* Generate SQL from Group-Pattern
|
||||
* @param string $pattern Pattern to generate SQL for
|
||||
* @param string $search What to searchid for
|
||||
* @return string
|
||||
* @return string sql to perform the search
|
||||
*/
|
||||
function GenGroupSQL($pattern, $search = '', $extra = 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user