mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix device group queries again (#10000)
This commit is contained in:
@@ -106,9 +106,10 @@ function GenGroupSQL($pattern, $search = '', $extra = 0)
|
||||
|
||||
$pattern = rtrim($pattern, '&|');
|
||||
|
||||
if (!in_array('devices', $tables) && dbFetchCell('SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_NAME = ? && COLUMN_NAME = ?', array($tables[0],'device_id')) != 1) {
|
||||
if ($tables[0] != 'devices' && dbFetchCell('SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_NAME = ? && COLUMN_NAME = ?', array($tables[0],'device_id')) != 1) {
|
||||
//Our first table has no valid glue, prepend the 'devices' table to it!
|
||||
array_unshift($tables, 'devices');
|
||||
$tables = array_unique($tables); // remove devices from later in the array if it exists
|
||||
}
|
||||
$x = sizeof($tables)-1;
|
||||
$i = 0;
|
||||
|
Reference in New Issue
Block a user