mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
Job, Import, Sync: fix restore w/o ID
This commit is contained in:
parent
5ddb36e45a
commit
54c838666c
@ -123,7 +123,7 @@ class DirectorJob extends DbObjectWithSettings implements ExportInterface, Insta
|
||||
}
|
||||
|
||||
return (
|
||||
strtotime($this->get('ts_last_attempt')) + $this->get('run_interval') * 2
|
||||
strtotime((int) $this->get('ts_last_attempt')) + $this->get('run_interval') * 2
|
||||
) < time();
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ class DirectorJob extends DbObjectWithSettings implements ExportInterface, Insta
|
||||
}
|
||||
$name = $properties[$keyCol];
|
||||
|
||||
if ($replace && static::existsWithNameAndId($name, $id, $db)) {
|
||||
if ($replace && $id && static::existsWithNameAndId($name, $id, $db)) {
|
||||
$object = static::loadWithAutoIncId($id, $db);
|
||||
} elseif ($replace && static::exists($name, $db)) {
|
||||
$object = static::load($name, $db);
|
||||
|
@ -92,7 +92,7 @@ class ImportSource extends DbObjectWithSettings implements ExportInterface
|
||||
}
|
||||
$name = $properties['source_name'];
|
||||
|
||||
if ($replace && static::existsWithNameAndId($name, $id, $db)) {
|
||||
if ($replace && $id && static::existsWithNameAndId($name, $id, $db)) {
|
||||
$object = static::loadWithAutoIncId($id, $db);
|
||||
} elseif ($replace && static::exists($name, $db)) {
|
||||
$object = static::load($name, $db);
|
||||
|
@ -294,7 +294,7 @@ class SyncRule extends DbObject implements ExportInterface
|
||||
}
|
||||
$name = $properties['rule_name'];
|
||||
|
||||
if ($replace && static::existsWithNameAndId($name, $id, $db)) {
|
||||
if ($replace && $id && static::existsWithNameAndId($name, $id, $db)) {
|
||||
$object = static::loadWithAutoIncId($id, $db);
|
||||
} elseif ($replace && static::exists($name, $db)) {
|
||||
$object = static::load($name, $db);
|
||||
|
Loading…
x
Reference in New Issue
Block a user