Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
See attached picture. Using comment_driven and driven_api 6.x-1.x-dev as of today, filefields seem to show ALL files being removed, and new revision files being added. Thus, many files are shown both removed and added, though they were not changed.
Comment | File | Size | Author |
---|---|---|---|
#10 | 2010-08-02_865388_filefield_ignore_data[unix].patch | 1.26 KB | arhak |
#7 | comment.png | 143.53 KB | jthomasbailey |
#7 | diff_values.png | 47.15 KB | jthomasbailey |
#7 | diff_values2.png | 283.76 KB | jthomasbailey |
cdrivenfilefieldissue.png | 35.68 KB | obrienmd |
Comments
Comment #1
obrienmd CreditAttribution: obrienmd commentedEven if no changes are made (no files added or removed), all field files are shown as removed and added on the comment's diff report.
Comment #2
Dane Powell CreditAttribution: Dane Powell commentedI did a devel backtrace, and found that the "old" versions of the files, as seen below, have an additional "data" parameter that the new ones don't, that leads driven to think that they've changed.
Comment #3
arhak CreditAttribution: arhak commented@#2 oh my!
that's what comment_driven_inspect is intended for
please, use it
perhaps those (data, destination, description, etc) should be ignored when comparing
but I didn't got enough much feedback at the time #727546-4: Supporting FileField fields
(now I don't have much time)
Comment #4
arhak CreditAttribution: arhak commentedBTW, while you are at it, let me warn you about pending #851118: compatibility with filefield_paths combined with imagefield
which is also related, since FileField's extensions might bring more properties in
Comment #5
jthomasbailey CreditAttribution: jthomasbailey commentedSubscribing, this adds Image Fields to every comment whether or not a change was made. Pretty much makes it incompatible with FileField. Happy to help test patches whenever you get around to it.
Comment #6
arhak CreditAttribution: arhak commented#5 you can start enabling comment_driven_inspect and posting back its dump
also state whether you're using other filefield-related modules
Comment #7
jthomasbailey CreditAttribution: jthomasbailey commentedAlong with filefield and imagefield I was using imagefield tokens, filefield sources and filefield paths but I turned those three off and the problem persisted.
Here you go, I hope these work for you:
Comment #8
jthomasbailey CreditAttribution: jthomasbailey commentedI noticed there was some extra stuff in the diff_values because of the FileField Sources module, so here's the dump of the one I tested with that module turned off:
Comment #9
obrienmd CreditAttribution: obrienmd commentedSo, hobgobbler is seeing the same thing as Dane P did, ie that the 'data' parameter is causing the issue... Anyone have a clue why that parameter changes?
Comment #10
arhak CreditAttribution: arhak commentedit's ok to ignore data when comparing
actually, it is between the ones I thought should be discarded from start
it might not be the only one
(in addition other filefield-related modules might add more irrelevant keys)
Comment #11
arhak CreditAttribution: arhak commented#7 second screenshot shows
filefield_remote
keydo you know which module introduces it? (if so, please open a separated issue for it)
BTW, in the 1st screenshot: is the tooltip's image broken due to non-clean URLs?
#2 where is
destination
key coming from?Comment #12
jthomasbailey CreditAttribution: jthomasbailey commentedPatch works... but does not work with Filefield Sources enabled (that's where the filefield_remote was coming from).
I'd hate to have to get rid of that, it lets you upload an image from a URL which is really handy. Is it possible to tell Driven to just ignore "'filefield_remote' => array ( 'url' => '', 'transfer' => 'Transfer', ),"?
I have no idea why the tooltip's image was broken, I have clean URLs enabled.
Comment #13
arhak CreditAttribution: arhak commentedyes, of course,
but I shouldn't mix up different issues
I need to identify where each property comes from, and if it is indeed dispensable
we are dealing here with vanilla filefield
there are also filefield-related modules that add more properties or interfere with data handling (for instance #851118: compatibility with filefield_paths combined with imagefield)
it would be better if each of them get their separated issue
Comment #14
obrienmd CreditAttribution: obrienmd commentedArhak, patch in #10 works great for me against driven latest -dev. Thanks! Agreed on keeping different issues separate, even for a single base field type.
Comment #15
jthomasbailey CreditAttribution: jthomasbailey commentedJust wanted to say thanks for the fast patches.
Comment #16
arhak CreditAttribution: arhak commented@#12 #872726: Compatibility with FileField Sources
Comment #17
obrienmd CreditAttribution: obrienmd commentedWill you be committing this to -dev soon, arhak?
Comment #18
arhak CreditAttribution: arhak commentedit'll be 2010-08-03_872726_support_filefield_sources_also_865388[unix].patch instead (which already have both, this and filefield_sources #872726: Compatibility with FileField Sources)
PS: right now I have no CVS (temporary firewalled)
could you (O'Brien) or Dane commit that one for me?
Comment #19
obrienmd CreditAttribution: obrienmd commentedArhak, don't you have to add me to this module for me to commit? If/when you do, I'd be happy to commit this patch. I'm already added on comment_driven.
Comment #20
arhak CreditAttribution: arhak commentedright (I thought you were set already, but that was for cdriven)
now both of you have granted access for Driven API as well, go ahead
Comment #21
Dane Powell CreditAttribution: Dane Powell commentedTagging to keep track of issues related to the mailhandler-2.x/notifications-4.x workflow
Comment #22
obrienmd CreditAttribution: obrienmd commentedCommitted patch from #18, -dev should automatically re-roll now, unless my CVS tagging was incorrect (which is a possibility).
Comment #23
arhak CreditAttribution: arhak commentedit seems you missed first chunck
comparing the patch at #18 against your commit
there is no need to tag anything (dev is the HEAD)
Comment #24
arhak CreditAttribution: arhak commented@#23 ops, my mistake, the two chunks of the patch are on the same spot,
(now I saw it when diff-ing)
everything seems ok
thanks obrienmd
Comment #25
obrienmd CreditAttribution: obrienmd commentedThanks for the quick check, arhak.
Comment #26
obrienmd CreditAttribution: obrienmd commentedTurns out I can still reproduce this when comment previews are turned on, and I use driven to change a filefield, then preview and submit a comment. I am aware that previews are not well-supported in driven (IIRC), but I think I've been able to reproduce this other times today, I'm just trying to figure out exactly how :)
Comment #27
obrienmd CreditAttribution: obrienmd commentedReproduced this again with mailflow system today. Need to figure out exactly how to trigger it, but there's definitely still an issue. Dane, any thoughts on somewhere this could be happening, given your work with both mailflow and cdriven?
Comment #28
obrienmd CreditAttribution: obrienmd commentedOK, here's how I was able to reproduce this today (using versions of modules / patches as noted in http://drupal.org/node/1045918):
1) Setup [http://drupal.org/node/1045918] on content type, set mail attachments to append to a filefield as per instructions.
2) Add a new node, subscribe to node.
3) Add a comment in Drupal, user is notified.
4) User replies via e-mail w/ no attachments.
5) Feed runs, imports comment.
6) In that comment, driven shows "Filefieldtitle (my actual filefield title): >> " (this is probably unclear, but driven is basically showing that field changing from no files to no files).
Comment #29
obrienmd CreditAttribution: obrienmd commentedIf I add the following steps:
7) In Drupal, edit the node and add a file.
8) User gets notification of update, e-mails back.
9) Feeds runs, imports comment.
10) In that comment, no stray "Filefieldtitle: >> " shows up.
So, having a value to that filefield causes the stray message to go away.
Comment #30
arhak CreditAttribution: arhak commentedwithout the dumped data (from comment_driven_inspect) it is impossible to take a guess
PS: nevertheless, don't assume false hopes, currently I'm not working on this module, just driving its issue queue,
I'm convinced that this module needs to be rewritten already, preferably with more than a single developer to avoid falling into core mistakes that brought the undesirable misbehaviors
Comment #31
Dane Powell CreditAttribution: Dane Powell commentedI'm able to reproduce this following #28, I'll investigate.
Comment #32
obrienmd CreditAttribution: obrienmd commentedThanks, Dane. I've been swamped the last few days, haven't had a chance to do more inspection.
Comment #33
Dane Powell CreditAttribution: Dane Powell commentedThe immediate cause is how a null field value is handled. My filefield is named field_xyz. When the existing version of the node is loaded by comment_driven_nodeapi_nodeapi (so that it can be compared to the updated version), this field appears as
$node->field_xyz[0] = NULL
. But in the node that's actually getting passed (the updated version), the field appears asI'm not sure if this discrepancy is due to this patch or something else. I've got meetings to go to right now so I won't be able to pursue this further until later, maybe tomorrow.
Comment #34
Dane Powell CreditAttribution: Dane Powell commentedThat's clearly the source of the problem, but I'm not really sure what to do about it. What I do know:
This problem is unique from the OP, as it deals with hook_nodeapi rather than the traditional FAPI handling (so perhaps a new issue is warranted).
It doesn't occur for other types of fields (i.e. if you create a text field, make it driven, then follow steps in #28, the text field doesn't show up as being changed).
I suspect the problem is with the retrieval of the existing version of the node - I say this because with text fields (which work fine), null values are represented by
$node->field_abc[0] = array(value => NULL,)
- in other words, the attributes of the field are null, but the field itself is not null. With Filefields, the field itself is null ($node->field_xyz[0] = NULL
), which implies that Filefield is breaking from CCK standards.Thus, a simple fix might (haven't tried this yet) be to alter filefield_field_load from
to
However, I'm a little confused, because I don't think there should BE a 'load' operation for hook_field, according to the documentation in content.module:
Sorry for the rambling post- in a nutshell, I suspect the problem here is with FileField, not Comment Driven.
Comment #35
Dane Powell CreditAttribution: Dane Powell commentedI'm really stumped... while what I said in 34 is true, if you look at the diffs produced by driven_inspect_diff_nodes based on the old and new filefields, you see that the old and new filefields differ in a slightly different way: the old looks like
array(fid => 0, list => 1, data => 1,)
while the new looks likearray(fid => NULL, list => NULL, data => NULL,)
. The former looks like the format produced by filefield_widget(); I don't know where the latter comes from.I'm sorry, but I'm just not sure I'm the best person to deal with this- Driven and CCK are both massively complex modules that I clearly don't completely understand.
Arhak, do you have any idea what's going on here based on this evidence?
Comment #36
arhak CreditAttribution: arhak commentedfrom a quick peek to filefield_field.inc
according to patch @#10
my note regarding this was
I don't seem to grasp the whole internals of CCK contribs either,
I'm missing a coherent... guidance
right now I have no time/intention to dig into it
nevertheless, I trust cdriven is a valid proposal from its approach being similar to what triggered #942310: Field form cannot be attached more than once,
just needs some love from the right gurus (like those involved in #939836: combofield / fieldentity / field-collection / embeddables),
but they seem to be enough busy #977898: Filefield upload widget broken in combofield
Comment #37
Dane Powell CreditAttribution: Dane Powell commentedI've found a "fix". Change line ~136 of filefield_field.inc to
$items[$delta] = array('fid' => NULL, 'list' => NULL, 'data' => NULL,);
. I filed an issue in the Filefield queue: #1132622: Inconsistent handling of null (empty) filefieldsComment #38
arhak CreditAttribution: arhak commented@#37 did you tried unset($items[$delta]) instead?
Comment #39
Dane Powell CreditAttribution: Dane Powell commentedGood guess arhak,
unset($items[$delta])
does fix the error as well. What's the significance of that in your mind? Is that a better solution?Comment #40
arhak CreditAttribution: arhak commentedunset
is closer to nullifying an array's keyaccording to CCK, is_empty should work with your proposal, but that could unleash a cascade of other misbehaviours (would there be another potential bugs around it?, what about third party modules already relying on it?)
offering a closer option to what is currently settled will give you a better shot to get the fix in,
and
unset
is guaranteed not to break, because of AJAX add_more implementation (which considers the disappearance of deltas, if I recall correctly)note that, I think your proposal "should" be valid, but it could break something else (depending on whether the remaining code honors CCK specs) consider mostly third party modules
Comment #41
arhak CreditAttribution: arhak commented@#40 PS: note in driven_cck.diff.inc, comment at line 216, followed by a workaround for the same misbehavior on other CCK modules
perhaps, cdriven could handle this filefield inconsistency with a similar workaround
(which BTW, I haven't checked why it isn't being handled right at that spot, that would require some debugging)
Comment #42
arhak CreditAttribution: arhak commented@#41 perhaps it isn't being handled there (in the workaround) due to filefield assigning a direct NULL instead of using content_set_empty?
Comment #43
Dane Powell CreditAttribution: Dane Powell commentedI agree that unset seems like a cleaner solution then. All I know beyond that is that Filefield seems to behave differently from other CCK modules, and they should all really get their ducks in a row when it comes to handling nulls. Realistically, though, no-one may ever respond to the Filefield issue, in which case we'll need to implement a workaround here.
Comment #44
Dane Powell CreditAttribution: Dane Powell commentedI went with a slightly different solution, simply calling content_set_empty on the items array, as you can see in the corresponding Filefield issue: #1132622: Inconsistent handling of null (empty) filefields. Please try that out and let me know if it works. I've also included the patch in the makefile at the howto page: Setting up an email-driven workflow (you'll need to wait a few minutes for alpha6 of the mailflow stack to roll)
Comment #45
Dane Powell CreditAttribution: Dane Powell commentedIt's been a while since I've looked at this, but it seems like there's really nothing to fix in Driven- this is simply waiting on #1132622: Inconsistent handling of null (empty) filefields
Comment #46
Feet CreditAttribution: Feet commentedHi guys,
Using this (still :) and have just applied patch at #10, it works great and I'm wondering if I can rebuild diff_values in the db or have some other workaround so past comments don't show the same file being removed and added.
Apologies for commenting on an old issue, just wondering if this might be a real easy answer from someone.
Really appreciated if anyone has any suggestions.
Thanks
Comment #47
arhak CreditAttribution: arhak as a volunteer commented@#46
Oh my! really?! After all these years?!
Wasn't it committed already? (see obrienmd @#22)
Phew! Who knows if there would be an easy way to rebuild it. I suspect there might be a way, but who would dig into it?
I rather recommend finding a workaround.
Wasn't there an option named
live_render
or something like it?Have you tried it already?
Rebuilding past
diff_values
is an interesting but unrelated issue.I think this discussion deserves its own ticket, from where you can link to this issue as precedent or trigger. IMO...