Hi there,
I was troubleshooting an issue on one of my sites recently and realized that revisions were the culprit.
I had noticed that after attaching a file to a node (via the regular file field), that file never gets deleted from the server on my site. I remove it from the node, save that change, but I can see the file is still on the server.
This was causing major issues because it makes replacing files very difficult. When a user tries to attach a replacement/updated file, the file name has the "_0" or "_1" suffixed to it (since the original file is still on the server and that makes the name a duplicate). That means that the user then either has links pointing to the previous version of the file (which is still on the server, but is outdated) or the user would need to find all links to the file and edit each one to match the new file name/url. It's a total mess.
I really do understand why the decision would have been made for revisions to keep old files on the server (rather than just keeping versions of the node content), but if replacing files is impossible when revisions are enabled, could we consider implementing an option via configuration settings, per content type or maybe site-wide, to choose whether attached files are also versioned? I think it's important to be able to choose whether that behavior should extend to attached files since the "original file URL not matching the updated file" is not a problem versioned nodes have.
Does this make sense? Sometimes it's hard to explain things without showing... :-)
Otherwise, as it stands, it seems the options are:
- have revisions enabled for your node content *and* make it so files could never be deleted from your server on the user end (which, again, makes file replacements difficult, since a newly attached file that's a replacement with the same name gets a different url ("_0" or "_1" suffixed at the end) and have to update all links to point to new file) OR
- do not have revisions for files or node content.
It would be great to choose just to have revisioning on the node content and not attached files!
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedFeature requests need to be placed in the current developing version.
Comment #2
HongPong CreditAttribution: HongPong commentedThis is confusing to end users who expect files to disappear from the server when they are removed, if any 7.x contrib module would be available to get around this it would really help. (additionally it appears sites may delete files on cron rather than instantly.)
See related 6 & 7:
http://drupal.stackexchange.com/questions/47967/files-attached-to-nodes-...
http://stackoverflow.com/questions/8771001/deleting-a-file-from-a-node-i...
http://stackoverflow.com/questions/2101754/drupal-filefield-remove-file-...
Comment #3
ditcheva CreditAttribution: ditcheva commented@HongPong, I've also been told that for some the issue is that the documents just get 'marked' for deletion, but are not actually deleted until a cron run. However, when revisions are enabled, the issue is that they do not get deleted at all.... ever. I have documents that are months/years old now on my site, that have been replaced, despite hourly cron runs. And again -- the biggest issue with this is the conflicting urls and the need to modify each pointing link to the new documents when you re-upload if you don't want your links to be pointing to the outdated version. :-((((
Comment #3.0
ditcheva CreditAttribution: ditcheva commentedClarified language a little
Comment #4
afoster CreditAttribution: afoster commentedFor anyone looking into this issue if you add the node's revision ID (vid) into the path of the uploaded files this fixed the problem in my project.
Comment #5
jelo CreditAttribution: jelo commentedThis issue is related to this one: https://www.drupal.org/node/1999646
I actually proposed a different solution in the other thread that files belonging to revisions should by default be renamed and moved to a private file location. This would solve the issue reported by ditcheva with file name problems (which is one issue I have as well) plus the usability issue that users might accidentally use an updated file with a direct link, despite the current revision having a new file attached to it.
Comment #6
ditcheva CreditAttribution: ditcheva commentedI really like your approach, @jelo!
Comment #11
oknate