Closed (fixed)
Project:
Migrate
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
23 Nov 2009 at 18:28 UTC
Updated:
29 Dec 2009 at 21:40 UTC
I was setting $node->created in my prepare hook and was banging my head trying to see why it was not getting saved. It turns out that node_migrate_prepare_node() unconditionally sets it to time() unless you set a magic $node->date property. There is no need for this setting to time() in migrate.module - node_save() does this for you already. Also, $node->should be namespaced as $node->migrate_date IMO.
While I was there, I noticed similar handling for node.changed but AFAICT, core does not let the caller specify node.changed at all. This looks like dead code to me, or it requires a core patch that we should make available.
Comments
Comment #1
moshe weitzman commentedComment #2
mikeryanOn the changed issue, node_migrate_import_node gets around that by setting it after node_save(). Although, looking now at the code it should make sure it only does that if a changed value was provided in migration...
Comment #3
mikeryanFixed. No more 'date' pseudo-field, created and changed are left empty if not explicitly set, and changed is only overridden after node_save if it had been explicitly set.