Sync: indentation

This commit is contained in:
Thomas Gelf 2015-10-20 22:22:58 +02:00
parent fc5976b5f8
commit 62a0f5f9c2

View File

@ -194,40 +194,42 @@ class Sync
} }
$dba = $db->getDbAdapter(); $dba = $db->getDbAdapter();
$dba->beginTransaction(); $dba->beginTransaction();
foreach ($objects as $object) { foreach ($objects as $object) {
if ($object instanceof IcingaObject && $object->isTemplate()) { if ($object instanceof IcingaObject && $object->isTemplate()) {
if ($object->hasBeenModified()) { if ($object->hasBeenModified()) {
throw new IcingaException( throw new IcingaException(
'Sync is not allowed to modify template "%s"', 'Sync is not allowed to modify template "%s"',
$object->$objectKey $object->$objectKey
); );
}
continue;
} }
if ($object->hasBeenLoadedFromDb() && $rule->purge_existing === 'y') { continue;
$found = false;
foreach ($sources as $source) {
if (array_key_exists($object->$objectKey, $imported[$source->id])) {
$found = true;
break;
}
}
if (! $found) {
$object->delete();
}
}
if (! $object->$objectKey) {
continue;
}
$object->store($db);
} }
$dba->commit(); if ($object->hasBeenLoadedFromDb() && $rule->purge_existing === 'y') {
$found = false;
foreach ($sources as $source) {
if (array_key_exists($object->$objectKey, $imported[$source->id])) {
$found = true;
break;
}
}
if (! $found) {
$object->delete();
}
}
// TODO: This should be noticed or removed:
if (! $object->$objectKey) {
continue;
}
$object->store($db);
}
$dba->commit();
return 42; // We have no sync_run history table yet return 42; // We have no sync_run history table yet
} }
} }