summaryrefslogtreecommitdiffstats
path: root/modules-available
diff options
context:
space:
mode:
authorSimon Rettberg2017-10-06 18:00:22 +0200
committerSimon Rettberg2017-10-06 18:00:22 +0200
commitda5fe90f4b8091b13abd5a5f3486dbadd528e214 (patch)
tree4f0cf130e463fed373184fef04c1f6d621c50ff4 /modules-available
parentDelete unused files (diff)
downloadslx-admin-da5fe90f4b8091b13abd5a5f3486dbadd528e214.tar.gz
slx-admin-da5fe90f4b8091b13abd5a5f3486dbadd528e214.tar.xz
slx-admin-da5fe90f4b8091b13abd5a5f3486dbadd528e214.zip
[runmode] Support returning associative array
Diffstat (limited to 'modules-available')
-rw-r--r--modules-available/runmode/inc/runmode.inc.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/modules-available/runmode/inc/runmode.inc.php b/modules-available/runmode/inc/runmode.inc.php
index 0f4994f4..bf20596b 100644
--- a/modules-available/runmode/inc/runmode.inc.php
+++ b/modules-available/runmode/inc/runmode.inc.php
@@ -64,7 +64,8 @@ class RunMode
/**
* @param string|\Module $module
- * @return array
+ * @param bool true = wrap in array where key is modeid
+ * @return array key=machineuuid, value={'machineuuid', 'modeid', 'modedata'}
*/
public static function getForModule($module, $groupByModeId = false)
{
@@ -91,9 +92,10 @@ class RunMode
* @param string|\Module $module
* @param string $modeId
* @param bool $detailed whether to return meta data about machine, not just machineuuid
- * @return array
+ * @param bool $assoc use machineuuid as array key
+ * @return array <key=machineuuid>, value={'machineuuid', 'modedata', <'hostname', 'clientip', 'macaddr', 'locationid'>}
*/
- public static function getForMode($module, $modeId, $detailed = false)
+ public static function getForMode($module, $modeId, $detailed = false, $assoc = false)
{
if (is_object($module)) {
$module = $module->getIdentifier();
@@ -114,7 +116,11 @@ class RunMode
if ($detailed && empty($row['hostname'])) {
$row['hostname'] = $row['clientip'];
}
- $ret[] = $row;
+ if ($assoc) {
+ $ret[$row['machineuuid']] = $row;
+ } else {
+ $ret[] = $row;
+ }
}
return $ret;
}