IcingaObject: log former related set state
This commit is contained in:
parent
c9a7c9d085
commit
29b1253bea
|
@ -113,6 +113,35 @@ class ExtensibleSet
|
|||
return $plain;
|
||||
}
|
||||
|
||||
public function getPlainUnmodifiedObject()
|
||||
{
|
||||
if ($this->fromDb === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$old = $this->fromDb;
|
||||
|
||||
if ($old['override'] !== null) {
|
||||
if (empty($old['blacklist']) && empty($old['extend'])) {
|
||||
return $old['override'];
|
||||
}
|
||||
}
|
||||
|
||||
$plain = (object) array();
|
||||
|
||||
if ($old['override'] !== null) {
|
||||
$plain->override = $old['override'];
|
||||
}
|
||||
if (! empty($old['extend'])) {
|
||||
$plain->extend = $old['extend'];
|
||||
}
|
||||
if (! empty($old['blacklist'])) {
|
||||
$plain->blacklist = $old['blacklist'];
|
||||
}
|
||||
|
||||
return $plain;
|
||||
}
|
||||
|
||||
public function hasBeenLoadedFromDb()
|
||||
{
|
||||
return $this->fromDb !== null;
|
||||
|
|
|
@ -1290,6 +1290,13 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
|
||||
foreach ($this->relatedSets() as $property => $set) {
|
||||
if ($resolved) {
|
||||
if ($this->supportsImports()) {
|
||||
$set = clone($set);
|
||||
foreach ($this->importedObjects() as $parent) {
|
||||
$set->inheritFrom($parent->getRelatedSet($property));
|
||||
}
|
||||
}
|
||||
|
||||
$values = $set->getResolvedValues();
|
||||
if (empty($values)) {
|
||||
if (!$skipDefaults) {
|
||||
|
@ -1377,6 +1384,11 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
}
|
||||
}
|
||||
|
||||
foreach ($this->relatedSets() as $property => $set) {
|
||||
if ($set->isEmpty()) { continue; }
|
||||
$props[$property] = $set->getPlainUnmodifiedObject();
|
||||
}
|
||||
|
||||
return $props;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue