[Tags performance] Fixed indexed agents_get_modules with no details

This commit is contained in:
fermin831 2018-10-02 15:30:19 +02:00
parent 8d5953ce50
commit f767474516

View File

@ -1169,8 +1169,10 @@ function agents_get_modules ($id_agent = null, $details = false,
} }
} }
$stored_details = $details;
if (empty ($details)) { if (empty ($details)) {
$details = "tagente_modulo.nombre"; $details = "tagente_modulo.nombre";
$stored_details = "nombre";
} }
else { else {
$details = (array)$details; $details = (array)$details;
@ -1215,12 +1217,12 @@ function agents_get_modules ($id_agent = null, $details = false,
$modules = array (); $modules = array ();
foreach ($result as $module) { foreach ($result as $module) {
if ($get_not_init_modules || modules_get_agentmodule_is_init($module['id_agente_modulo'])) { if ($get_not_init_modules || modules_get_agentmodule_is_init($module['id_agente_modulo'])) {
if (is_array ($details) || $details == '*') { if (is_array ($stored_details) || $stored_details == '*') {
//Just stack the information in array by ID //Just stack the information in array by ID
$modules[$module['id_agente_modulo']] = $module; $modules[$module['id_agente_modulo']] = $module;
} }
else { else {
$modules[$module['id_agente_modulo']] = $module[$details]; $modules[$module['id_agente_modulo']] = $module[$stored_details];
} }
} }
} }