Needs review
Project:
UUID Features Integration
Version:
7.x-1.x-dev
Component:
uuid_node
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Dec 2010 at 00:50 UTC
Updated:
20 Sep 2011 at 10:53 UTC
Jump to comment: Most recent file
Comments
Comment #1
ezra-g commentedAt least
$node->changed = $time;is set in node.module as the node is saved.Perhaps we should:
a) prevent these fields from being exported altogether by unsetting them when rendering the export.
b) manually update the relevant database tables and clear caches after doing our node_save(). This feels awkward to me.
It seems likely that sites would want to preserve node created/updated time data. b) seems hackish to me but is there a better alternative?
For reference, the columns that store relevant data here include:
{node}.changed
{node_revisions}.revision_timestamp
Comment #2
ezra-g commentedI found that while a node was exported to show up on the frontpage and the export had $node->promote = 1, the node wasn't being promoted.
This is because we call node_object_prepare() which clobbers exported values with the default node options. It also clobbers the created time in the exported node.
This patch resolved that behavior by replicating most of the node_object_prepare() code, but checking whether values being set are already set in the node.
One situation where I haven't tested this is with nodes exported without created and updated times. There's no way to export nodes currently without this information - you'd have to manually edit the exported node object in code. Ideally, the node->created and updated times would automatically get set to the time of node submission, but we're no longer explicitly doing that here. In general node exported without created/updated time data seem like a pretty clear edge case.
Comment #3
ezra-g commentedAfter further testing, this isn't resolving the timestamp issue.
Comment #4
dkingofpa commentedWe are having the same problem with timestamps. Similarly, what if the actual content (title, body, etc) is modified on the site by an end user? We wouldn't necessarily want those changes to be reverted during an update of the site.
Comment #5
ezra-g commented@dkingofpa To avoid reverting the changes to exported nodes, you simply don't revert the component that defines them.
Comment #6
pearcec commentedEssentially this means you can't mix in content with other components when creating a feature. Further I think it means we should create a feature to get the default content in place. Then unset it so a person can revert other features on the site with some form of automation. Still investigating what the best process is.
Comment #7
ezra-g commentedThat's not accurate. Per #5, you simply don't revert the exported node component of a feature.
Comment #8
ezra-g commentedThis patch manually sets these values in the database.
This feels somewhat dirty to me but I'm not sure of a better approach.
Comment #9
ezra-g commentedUh, we need to specify the nid/vid ;).
Comment #10
ezra-g commentedRevised.
Comment #11
ezra-g commentedSetting component.
Comment #12
ryan_courtnage commentedI'm trying to reproduce this problem, but haven't been able to. I create & enable a Feature that contains a number a nodes in it. I then visit my Features admin page ... nothing appears as overridden. Am I missing a step?
Comment #13
ryan_courtnage commentedUPDATE: I am able to duplicate the problem. Export a feature with nodes on one system, then enable this feature on another system.
'changed', 'last_comment_timestamp' and 'revision_timestamp' do indeed cause the feature to be reported as overridden.
Rather than updating the database entries, couldn't we just simply exclude these timestamps from the export? The attached diff seems to work reasonably well. Do you see any problems with doing this?
Comment #14
ryan_courtnage commentedI've been using uuid_features on a daily basis. The patch in #13 is working well for us, but I now realize that there are other node properties that should be ignored. For example, the node_load() function will join the users table and insert the 'data' field from it into the node object. A user's data field can contain things like form_build_id = form-b18190f6a7716334a659c03c950e1c34. In other words, stuff that will almost always cause an override to be detected when managing a feature across multiple systems.
Rather than extend my patch in #13 to simply exclude the "data" property as well, I'm wondering if we should take another approach... It's impossible to anticipate everything that can end up in the node object, as any module can add to it. Most things probably make sense in an export, but there will always be exceptions (like 'changed', 'data', etc). Perhaps we should expose a settings page that allows an administrator to modify the list of property exclusions, which will be stored in a drupal variable ('uuid_features_ignored_node_properties'). The default exclusions can include 'changed', 'last_comment_timestamp', 'revision_timestamp', 'data'. Theoretically, if someone changed the exclusions from the default, they could use strongarm to ensure that it is exported into their feature along with their uuid_node content.
I'd be happy to work on this if others agree it is the right way to go. WDYT?
Comment #15
ryan_courtnage commentedNot sure why I didn't see this before, but uuid_features.module allows other modules to alter the export. This provides a great way for you to exclude timestamps and any other data that might be specific to the nodes in your feature.
So no patch required, just put something like the following in your feature module (or any other module for that matter):
Fine by me if this issue is closed (although ezra-g's original patch should be considered)...
Comment #16
smokris@ryan_courtnage: The OP's issue is that the nodes created by uuid_features don't inherit the timestamps from the nodes exported by uuid_features. Removing the timestamps from the export indeed fixes the issue with nodes incorrectly being marked "Overridden" in the Features control panel, but it doesn't solve the root problem of actually setting nodes' timestamps when recreating them.
@ezra-g: Your patch in #10 works for me so far, except that I think this line:
should maybe be this:
(so that it updates the "changed" column later on, not the "created" column).
I've attached a revised patch. Can we get this committed?
Comment #17
ezra-g commentedThanks for the re-roll. This is committed. Thanks! http://drupalcode.org/project/uuid_features.git/commit/6c4d31a
There's actually one semi-edge case where this didn't succeed at preventing the node timestamps from causing the node to appear as overridden, but I filed #1185004: Node timestamps appear overridden when importing site has different timezone than exporting site for that, since the patch here is an improvement and will work on many sites.
Comment #18
smokrisAwesome. Thanks, @ezra-g!
Comment #20
Johnny vd Laar commentedThe same issue also exists for the 7.x version but the same patch with slight modifications seems to apply to drupal 7 as well.