In dealing with exporting nodequeues using features extra, I found a host of problems that seem to have cropped up recently due to the latest changes to the nodequeue module. There are also a couple of problems with how we are exporting the nodequeue information.
1) the nodequeues carry their qid with them on export. this is a problem since they will have a different qid on successive environments. Since the correct qid doesn't get applied on the new environment, unique constraint errors get thrown because the machine name is being inserted a 2nd time.
2) roles are being exported and imported based on RID and not a qualified name. this is a problem because roles will have the same name on successive environments, but not the same RID.
3) nodequeue rejects any roles that have the "manipulate any queue" permission. this causes the feature to always show overridden.
4) smartqueue adds some keys to the queue to show how many subqueues exist in the queue. this causes the feature to always show overridden.
Attached is a patch that fixes all 4 of these issues for the 7.x-1.x branch. It fixes issues 1&4 by stripping out the qid and subqueues keys on export.
issues 2 & is fixed by leveraging features' role exporting capability. any roles that have that permission are ignored. then the role name is used in the export value instead of the role id. when the queue is rebuilt the name is converted back to an ID to ensure that the proper id is used in all environments.
Comments
Comment #1
wizonesolutionsI'll review this when I get a chance, but if someone else could as well (@toleillo?) that would be great.
netw3rker, what's the status on Features integration directly in Nodequeue if you know? Is the maintainer reluctant to do so? As I've said elsewhere (#921872: Rewrite to use UUID, merge with UUID Features?), I think all this module's current functionality could be served by other modules in the long run. It was always a hack, basically.
Comment #2
netw3rker CreditAttribution: netw3rker commentedi was just reviewing that thread yesterday, they are still not in a stable state. Based on the way subqueues and queues relate to each other, my guess is it's going to be a while..
Comment #4
rory_o CreditAttribution: rory_o commentedFor our purposes this patch gets rid of the qid successfully which has been causing us problems for months so RTBC for me.
Here's a reroll of the patch with -p1 from the features_extra folder, which is standard
Comment #5
mattyohe CreditAttribution: mattyohe commentedBeen using #4's patch for awhile now, and I am curious if this can be reviewed and pushed out in a new dev?
Comment #6
DamienMcKennaThe patch in #4 works for me, RTBC. Thanks.
Comment #7
carn1x CreditAttribution: carn1x commentedPatch #4 gets my vote :)
Comment #8
pfrenssenThe patch was riddled with coding standards violations, here's a cleaner version :)
Comment #9
iSoLate CreditAttribution: iSoLate commentedPatch #8 works as a charm!
Comment #11
abhishek.kumar CreditAttribution: abhishek.kumar commentedIt would be better if Patch #4 gets reviewed and merged in dev branch.
Comment #12
pfrenssen#8: 1338000-8-features_extra-nodequeue_references.patch queued for re-testing.
Comment #14
kbasarab CreditAttribution: kbasarab commentedThis just rerolls #8.
Comment #15
DamienMcKennaRerolled but untested.
Comment #16
pfrenssenI suppose 'converted back to a rid at save time' should be 'converted back to a rid when reverted'?
Casting to an (int) is not the right way to check if a variable contains an integer, it would return a false positive if a role machine name would start with a number. Use is_int() instead.
Comment #17
pfrenssenUpdated the patch. I addressed everything from #16, except this part
My comment above was wrong, this object is not being unset. It is not clear to my 8AM brain why this code is necessary, a small comment would be nice :)
Leaving it to "needs work" for the moment.
Comment #18
abhishek.kumar CreditAttribution: abhishek.kumar commented#4: features_extra_nodequeue_reroll-1338000-3.patch queued for re-testing.
Comment #19
pfrenssen#17: 1338000-17-features_extra-nodequeue_references.patch queued for re-testing.
Comment #20
pfrenssenI have reviewed this again, and the part I was doubting in #17 seems very obvious to me now lol. This really needs some tests, but there are no tests for the nodequeue support yet. I'm going to create branch 1338000, commit this patch and start working on tests.
Comment #21
drupalninja99 CreditAttribution: drupalninja99 commented#17 works for me, thx!
Comment #22
moonray CreditAttribution: moonray commentedRerolled the patch for latest features_extra.
Comment #23
moonray CreditAttribution: moonray commentedIt seems nodequeue_load_queue_by_name is no longer availabel to nodequeue 7.x-3.x
Use nodequeue_load instead.
Comment #24
pfrenssen@moonray, there's an issue for that :) #1845752: Make fe_nodequeue work with nodequeue-7.x-3.x-dev
Comment #25
moonray CreditAttribution: moonray commentedShould have linked to that myself. Just thought I'd mention it in relation to this issue.
Comment #26
pfrenssenI have been writing tests and have hit a bug in Nodequeue. When a nodequeue has changed it is impossible to check later in the same page request if the feature is overridden. This is due to Nodequeue's use of static variables, as described in this issue: #1666556: Use drupal_static instead of static variable..
As the development of Nodequeue is moving rather slow lately I am going to implement variants of these functions in FE. This will allow us to move forward on this issue without having to wait on Nodequeue being patched.
Comment #27
pfrenssenThis has been fixed and merged into 7.x-1.x.
Commits:
Comment #28
pfrenssenRemoving tags