mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 16:54:06 +02:00
ImportExport: return number of imported objects
This commit is contained in:
parent
1ca41c5b10
commit
17321e4a5f
@ -103,19 +103,27 @@ class ImportExport
|
|||||||
|
|
||||||
public function unserializeImportSources($objects)
|
public function unserializeImportSources($objects)
|
||||||
{
|
{
|
||||||
$this->connection->runFailSafeTransaction(function () use ($objects) {
|
$count = 0;
|
||||||
|
$this->connection->runFailSafeTransaction(function () use ($objects, & $count) {
|
||||||
foreach ($objects as $object) {
|
foreach ($objects as $object) {
|
||||||
ImportSource::import($object, $this->connection)->store();
|
ImportSource::import($object, $this->connection)->store();
|
||||||
|
$count++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function unserializeSyncRules($objects)
|
public function unserializeSyncRules($objects)
|
||||||
{
|
{
|
||||||
$this->connection->runFailSafeTransaction(function () use ($objects) {
|
$count = 0;
|
||||||
|
$this->connection->runFailSafeTransaction(function () use ($objects, & $count) {
|
||||||
foreach ($objects as $object) {
|
foreach ($objects as $object) {
|
||||||
SyncRule::import($object, $this->connection)->store();
|
SyncRule::import($object, $this->connection)->store();
|
||||||
}
|
}
|
||||||
|
$count++;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return $count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user