Job, Import, Sync: fix restore w/o ID

This commit is contained in:
Thomas Gelf 2022-09-30 11:30:54 +02:00
parent 5ddb36e45a
commit 54c838666c
3 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);