I have a couple of patches that need to do processing after all nodes have been rebuilt.

The patches (#1041932: Export node translations and #1048470: Book export) add book and translations support which require node uuid references to be rebuilt. As there is no guarantee that nodes being referred to are rebuilt before referring nodes it has to be done after all the nodes have been rebuilt.

This patch adds the hook hook_uuid_node_features_rebuild_complete($nodes, $module) .

Any comments very welcome...

Comments

chaps2’s picture

Status: Active » Needs review
StatusFileSize
new730 bytes
ryan_courtnage’s picture

StatusFileSize
new557 bytes

Reroll attached.

Edit: this patch has a bug - see below for newer version

ryan_courtnage’s picture

StatusFileSize
new942 bytes

My last upload had a bug. Attached is the proper patch.

ryan_courtnage’s picture

StatusFileSize
new3.89 KB

Rerolling this patch has actually turned out to be more difficult that I thought. Implementations of the "rebuild_complete" hook can make changes to the nodes and call node_save (such as #1041932: Export node translations does). This causes a problem with nodes appearing as overridden due to timestamps - something that was fixed in #1008496: Node timestamps, options overridden and cause uuuid_node components to appear modified.

The attached patch moves #1008496's logic that updates node timestamps into it's own function. This makes uuid_node_features_rebuild() easier to read, and also allows it to handle the node timestamp updates *after* implementations of hook_uuid_node_features_rebuild_complete() are called.

Could someone please review and flag RTBC?

scottrigby’s picture

@ryan_courtnage haven't been able to fully test this, but the db_update() in _uuid_node_features_update_node_values() should wrap $table in double braces for database prefixes:

db_query("UPDATE {{$table}} SET $column = %d WHERE $where", $args);
scottrigby’s picture

Status: Needs review » Needs work
scottrigby’s picture

also Ryan, I'm using your patch in #4 in combo with #1048470-4: Book export, and almost everything is working… Except have you noticed a regression of #1008496: Node timestamps, options overridden and cause uuuid_node components to appear modified with this patch? I'm now seeing 'changed', 'date', 'revision_timestamp', and 'revision_uuid' in my features diff – not sure where that's coming from yet

ryan_courtnage’s picture

@scottrigby, regarding:


_uuid_node_features_update_node_values() should wrap $table in double braces for database prefixes

Not sure I've ever seen this done before. Why double braces?

ryan_courtnage’s picture

Status: Needs work » Needs review

@scottrigby, in response to #7, I am not having problems with timestamps in my features diff. Are you using my patch from #4 (uuid_features_rebuilt_hook-1049760-4.patch), unmodified?

The Book Export patch/comment you reference calls for the patch in comment #1 by chaps2. That patch (uuid_features-1049760.patch) will most certainly cause the timestamp problems you are seeing, as explained in my comment #4.

das-peter’s picture

Issue summary: View changes
Status: Needs review » Needs work

I've just introduced this or better a similar hook for #1048470-15: Book export
The current implementation doesn't deal with timestamps yet. I've first to get familiar with the issue,
However, this definitely needs a re-roll anyway, so back to needs work ;)