Import: allow for differing imports w/o new rows

This commit is contained in:
Thomas Gelf 2015-07-22 13:13:00 +02:00
parent af021b06ac
commit 3dfec6b8bd
1 changed files with 21 additions and 20 deletions

View File

@ -76,30 +76,31 @@ class Import
$newRows = $this->newChecksums('imported_row', $rowSums); $newRows = $this->newChecksums('imported_row', $rowSums);
$newProperties = $this->newChecksums('imported_property', array_keys($props)); $newProperties = $this->newChecksums('imported_property', array_keys($props));
if (! empty($newProperties) || ! empty($newRows)) { $db->insert('imported_rowset', array('checksum' => $rowset));
foreach ($newProperties as $checksum) {
$db->insert('imported_property', $props[$checksum]);
}
$db->insert('imported_rowset', array('checksum' => $rowset)); foreach ($newProperties as $checksum) {
$db->insert('imported_property', $props[$checksum]);
}
foreach ($newRows as $checksum) { foreach ($newRows as $checksum) {
$db->insert('imported_row', $rows[$checksum]); $db->insert('imported_row', $rows[$checksum]);
$db->insert( foreach ($rowsProps[$checksum] as $propChecksum) {
'imported_rowset_row', $db->insert('imported_row_property', array(
array( 'row_checksum' => $checksum,
'rowset_checksum' => $rowset, 'property_checksum' => $propChecksum
'row_checksum' => $checksum ));
)
);
foreach ($rowsProps[$checksum] as $propChecksum) {
$db->insert('imported_row_property', array(
'row_checksum' => $checksum,
'property_checksum' => $propChecksum
));
}
} }
} }
foreach (array_keys($rows) as $checksum) {
$db->insert(
'imported_rowset_row',
array(
'rowset_checksum' => $rowset,
'row_checksum' => $checksum
)
);
}
} }
$db->insert( $db->insert(
'import_run', 'import_run',