From 62a0f5f9c2ad6fb9562f8ee7dc5ef65b6f189e4b Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 20 Oct 2015 22:22:58 +0200 Subject: [PATCH] Sync: indentation --- library/Director/Import/Sync.php | 62 ++++++++++++++++---------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/library/Director/Import/Sync.php b/library/Director/Import/Sync.php index 614f2bb1..0a167d1d 100644 --- a/library/Director/Import/Sync.php +++ b/library/Director/Import/Sync.php @@ -194,40 +194,42 @@ class Sync } - $dba = $db->getDbAdapter(); - $dba->beginTransaction(); - foreach ($objects as $object) { - if ($object instanceof IcingaObject && $object->isTemplate()) { - if ($object->hasBeenModified()) { - throw new IcingaException( - 'Sync is not allowed to modify template "%s"', - $object->$objectKey - ); - } - - continue; + $dba = $db->getDbAdapter(); + $dba->beginTransaction(); + foreach ($objects as $object) { + if ($object instanceof IcingaObject && $object->isTemplate()) { + if ($object->hasBeenModified()) { + throw new IcingaException( + 'Sync is not allowed to modify template "%s"', + $object->$objectKey + ); } - 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(); - } - } -if (! $object->$objectKey) { -continue; -} - $object->store($db); + continue; } - $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 } }