Project:Import / Export API
Version:5.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Node Revisions are not getting imported when there is no change in Revision's Title. Though they are getting exported properly.
To see the bug.
1. Create a node say Page.
2. Press Edit and change the body without changing Title.
3. Export XML.
4. Delete the created page node.
5. Import the XML

Now one can see there is only one version in node_revisions table and second version is lost.

Reason:
As per our analysis "title" field is set alt_key_for vid in importexportapi_forum.inc definition file. Because of this "title" would have to be unique in node_revisions table.

It means Revision with same title but different content can not be imported because of importexportapi_db_put.inc 's condition around line 30.

f ($is_insert && !empty($unique_fields)) {
$unique_fields_sql = 'SELECT * FROM '. $into .' WHERE '. implode(' OR ', $unique_fields['sql']);
$result = db_fetch_object(db_query($unique_fields_sql, $unique_fields['values']));

if (!empty($result)) {
$do_query = FALSE;
// Don't bother processing any more fields - we're not going to
// execute the query at all.
break;
}
}

Submitting patch for this. Please review.

AttachmentSize
node_revisions_bug.patch410 bytes

Comments

#1

alt_key_for fiel is defined in "importexportapi_node.inc" not in importexportapi_forum.inc

Sorry for typo.

Nitin

nobody click here