summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}