mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 17:25:26 +02:00
added cache to function agents_get_all_groups_agent
This commit is contained in:
parent
3e71513e4e
commit
24f7dbd420
@ -2678,6 +2678,9 @@ function agents_generate_name ($alias, $address = '') {
|
||||
* @return Array with the main and secondary groups
|
||||
*/
|
||||
function agents_get_all_groups_agent ($id_agent, $group = false) {
|
||||
// Cache the agent id groups
|
||||
static $cache = array();
|
||||
if (isset($cache[$id_agent])) return $cache[$id_agent];
|
||||
// Get the group if is not defined
|
||||
if ($group === false) $group = agents_get_agent_group($id_agent);
|
||||
|
||||
@ -2691,6 +2694,7 @@ function agents_get_all_groups_agent ($id_agent, $group = false) {
|
||||
|
||||
// Add a list of groups
|
||||
$secondary_groups['plain'][] = $group;
|
||||
$cache[$id_agent] = $secondary_groups['plain'];
|
||||
return $secondary_groups['plain'];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user