mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-26 07:14:59 +02:00
IcingaObjectFieldLoader: return early...
...and save CPU-cycles
This commit is contained in:
parent
6de258730b
commit
220d15c523
@ -240,14 +240,6 @@ class IcingaObjectFieldLoader
|
|||||||
$kill = array();
|
$kill = array();
|
||||||
$columns = array();
|
$columns = array();
|
||||||
$object = $this->object;
|
$object = $this->object;
|
||||||
|
|
||||||
$object->invalidateResolveCache();
|
|
||||||
$vars = $object::fromPlainObject(
|
|
||||||
$object->toPlainObject(true),
|
|
||||||
$object->getConnection()
|
|
||||||
)->vars()->flatten();
|
|
||||||
|
|
||||||
$prefixedVars = (object) array();
|
|
||||||
if ($object instanceof IcingaHost) {
|
if ($object instanceof IcingaHost) {
|
||||||
$prefix = 'host.vars.';
|
$prefix = 'host.vars.';
|
||||||
} elseif ($object instanceof IcingaService) {
|
} elseif ($object instanceof IcingaService) {
|
||||||
@ -256,6 +248,13 @@ class IcingaObjectFieldLoader
|
|||||||
return $elements;
|
return $elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$object->invalidateResolveCache();
|
||||||
|
$vars = $object::fromPlainObject(
|
||||||
|
$object->toPlainObject(true),
|
||||||
|
$object->getConnection()
|
||||||
|
)->vars()->flatten();
|
||||||
|
|
||||||
|
$prefixedVars = (object) array();
|
||||||
foreach ($vars as $k => $v) {
|
foreach ($vars as $k => $v) {
|
||||||
$prefixedVars->{$prefix . $k} = $v;
|
$prefixedVars->{$prefix . $k} = $v;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user