IcingaObjectImports: Add check if modified and loaded from db

This commit is contained in:
Alexander Fuhr 2015-06-30 10:46:15 +02:00
parent 42e335bc36
commit fbbea8d486
1 changed files with 9 additions and 2 deletions

View File

@ -230,7 +230,14 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
$objectCol = $type . '_id'; $objectCol = $type . '_id';
$importCol = 'parent_' . $type . '_id'; $importCol = 'parent_' . $type . '_id';
$this->object->db->delete($this->getImportTableName(), $objectCol . ' = ' . $objectId); if (! $this->hasBeenModified()) {
return true;
}
if ($this->object->hasBeenLoadedFromDb()) {
$this->object->db->delete($this->getImportTableName(), $objectCol . ' = ' . $objectId);
}
$weight = 1; $weight = 1;
foreach ($this->imports as $import) { foreach ($this->imports as $import) {
@ -246,7 +253,7 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
$this->storedImports = $this->imports; $this->storedImports = $this->imports;
return $this; return true;
} }
protected function getImportClass() protected function getImportClass()