mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
Added an option to use the metaconsole table when fetching the agents
Former-commit-id: d21627018f662d27f5612bf69bddfd8d298437ca
This commit is contained in:
parent
ebaa3506de
commit
3332e41f41
@ -328,14 +328,21 @@ function agents_get_alerts_simple($id_agent=false, $filter='', $options=false, $
|
|||||||
*
|
*
|
||||||
* By default, it will return all the agents where the user has reading access.
|
* By default, it will return all the agents where the user has reading access.
|
||||||
*
|
*
|
||||||
* @param array filter options in an indexed array. See
|
* @param array $filter Filter options in an indexed array.
|
||||||
* db_format_array_where_clause_sql()
|
* See db_format_array_where_clause_sql().
|
||||||
* @param array Fields to get.
|
* @param array $fields DB fields to get.
|
||||||
* @param string Access needed in the agents groups.
|
* @param string $access ACL level needed in the agents groups.
|
||||||
* @param array $order The order of agents, by default is upward for field nombre.
|
* @param array $order The order of agents, by default is upward
|
||||||
* @param boolean $return Whether to return array with agents or false, or sql string statement
|
* for field nombre.
|
||||||
|
* @param boolean $return Whether to return array with agents or
|
||||||
|
* the sql string statement.
|
||||||
|
* @param boolean $disabled_agent Whether to return only the enabled agents
|
||||||
|
* or not.
|
||||||
|
* @param boolean $use_meta_table Whether to use the regular or the meta table
|
||||||
|
* to retrieve the agents.
|
||||||
*
|
*
|
||||||
* @return mixed An array with all alerts defined for an agent or false in case no allowed groups are specified.
|
* @return mixed An array with all alerts defined for an agent
|
||||||
|
* or false in case no allowed groups are specified.
|
||||||
*/
|
*/
|
||||||
function agents_get_agents(
|
function agents_get_agents(
|
||||||
$filter=false,
|
$filter=false,
|
||||||
@ -346,7 +353,8 @@ function agents_get_agents(
|
|||||||
'order' => 'ASC',
|
'order' => 'ASC',
|
||||||
],
|
],
|
||||||
$return=false,
|
$return=false,
|
||||||
$disabled_agent=0
|
$disabled_agent=0,
|
||||||
|
$use_meta_table=false
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -563,11 +571,15 @@ function agents_get_agents(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$table_name = ($use_meta_table === true) ? 'tmetaconsole_agent' : 'tagente';
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT DISTINCT %s
|
'SELECT DISTINCT %s
|
||||||
FROM tagente LEFT JOIN tagent_secondary_group ON tagent_secondary_group.id_agent=tagente.id_agente
|
FROM `%s` tagente
|
||||||
|
LEFT JOIN tagent_secondary_group
|
||||||
|
ON tagent_secondary_group.id_agent=tagente.id_agente
|
||||||
WHERE %s %s',
|
WHERE %s %s',
|
||||||
implode(',', $fields),
|
implode(',', $fields),
|
||||||
|
$table_name,
|
||||||
$where,
|
$where,
|
||||||
$order
|
$order
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user