When entitycache is enabled fields are being duplicated, due to the field_attach_load call in closedquestion_load.
Duplicate this issue by
- enabling closedquestion & entitycache.
- create a question.
- attach a file to it.
- save the question
- edit the question and save it again.
you should now have 2 file attachments to the node instead of 1, if you continue the edit/save step attachments will increase by a factor of 2, so 1, 2, 4, 8, 16 etc.
I am wondering if it is even the right place to attach the $node->question "field", I don't have an alternative to where this should happen instead of now.
Comment | File | Size | Author |
---|---|---|---|
#6 | 1415100.patch | 1.74 KB | jbrown |
#4 | 1415100.patch | 1.79 KB | jbrown |
#2 | closedquestion-not-compatible-with-entitycache-1415100-2.patch | 1.71 KB | lslinnet |
#1 | closedquestion-minor-code-tweaks-1415100-1.patch | 1.23 KB | lslinnet |
Comments
Comment #1
lslinnet CreditAttribution: lslinnet commentedLooking at the hook_load function i saw that some of the code could be optimized away.
So create a little patch for that.
Comment #2
lslinnet CreditAttribution: lslinnet commentedFound a way to fix it, moved the functionality from hook_load to hook_node_load which basically resolves the issue.
Haven't tested this when loading multiple nodes yet, so would love if someone had the time to do so.
Comment #3
lslinnet CreditAttribution: lslinnet commentedOhh forgot to change status
Comment #4
jbrown CreditAttribution: jbrown commentedOkay - this patch fixes the bug by loading the body field on a clone of the node. I incorporated the fix in #1 also.
This module really needs to be refactored to use entities properly.
Comment #5
lslinnet CreditAttribution: lslinnet commentedHey jbrown, have you taken a look at the solution provided in #2?
Comment #6
jbrown CreditAttribution: jbrown commentedOkay - improved upon the patch in #2. You can't use reset() like that because you get a strict warning.
Comment #7
HylkeVDS CreditAttribution: HylkeVDS commentedIt's very likely that the way loading is done is not entirely correct. I wrote that code against one of the first releases of D7.
The problem was that the automatic loading happened way to late in the process.
The loading of attached files might also have to happen sooner than default.
Comment #8
lslinnet CreditAttribution: lslinnet commentedI have tested and reviewed the rewritten solution from jbrown and it works.
Comment #9
lslinnet CreditAttribution: lslinnet commentedForgot to change status.
Comment #10
koosvdkolk CreditAttribution: koosvdkolk commentedWill apply patch of #6 a.s.a.p.
Comment #11
koosvdkolk CreditAttribution: koosvdkolk commentedThis should be fixed in the 7.x-2.x-dev i just pushed. Please review.
Comment #12
spazfoxI'm having compatibility issues with Closed Question 7.x-2.2 (which appears to include the patch from #6) and Entity Cache, as well, though my specific issue appears to be different from the one originally reported here. I can create a separate issue if that is preferable, but decided to post here since a compatibility issue between these two modules seems to remain.
When Entity Cache is enabled, the fields/body of my Closed Question nodes are often not rendered at all (the Submit and Reset buttons are rendered, however), and these error notices sometimes (but not always) appear: "Unknown node: inlineOption" and "Unknown node: mapping"
Disabling Entity Cache resolves the issue. Clearing all site caches or re-saving the node also resolves the issue, but only temporarily.
Let me know if there is any additional information or testing I can do to help troubleshoot this.
Comment #13
koosvdkolk CreditAttribution: koosvdkolk commentedCreated a bug report for Entity Cache: http://drupal.org/node/1971666
are probably caused by the Closed Question editor.