From 220d15c523a89cd633d9719cbc8b214bc2c7cc55 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 27 Apr 2017 15:44:22 +0200 Subject: [PATCH] IcingaObjectFieldLoader: return early... ...and save CPU-cycles --- .../Director/Web/Form/IcingaObjectFieldLoader.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/library/Director/Web/Form/IcingaObjectFieldLoader.php b/library/Director/Web/Form/IcingaObjectFieldLoader.php index 64266a74..94da423e 100644 --- a/library/Director/Web/Form/IcingaObjectFieldLoader.php +++ b/library/Director/Web/Form/IcingaObjectFieldLoader.php @@ -240,14 +240,6 @@ class IcingaObjectFieldLoader $kill = array(); $columns = array(); $object = $this->object; - - $object->invalidateResolveCache(); - $vars = $object::fromPlainObject( - $object->toPlainObject(true), - $object->getConnection() - )->vars()->flatten(); - - $prefixedVars = (object) array(); if ($object instanceof IcingaHost) { $prefix = 'host.vars.'; } elseif ($object instanceof IcingaService) { @@ -256,6 +248,13 @@ class IcingaObjectFieldLoader return $elements; } + $object->invalidateResolveCache(); + $vars = $object::fromPlainObject( + $object->toPlainObject(true), + $object->getConnection() + )->vars()->flatten(); + + $prefixedVars = (object) array(); foreach ($vars as $k => $v) { $prefixedVars->{$prefix . $k} = $v; }