Being able to add revisions to both the media files and the fields is needed, after all this is content too.
It would also be very useful in many use cases, especially since reusing existing media files is a big part of what this module is all about. Since Media module is using a placeholder for the embedded media, revision support would be possible to do very smart. For example, default could be that when the original file is updated, then it is automatically pushed out to all places it is used.
However, options such as:
- Do not update this media object if original file changes
- Notify when original media is updated
Would then allow decisions how this will be handled for each place the media file is used.
Permissions will be needed for allowing roles to not create a new revision so that some roles have that possibility, other roles will always create new revision and lastly some roles might not create revisions.
This should also be easy to integrate with by workflow features such as the Workbench Moderation as well.
Comments
Comment #1
arthurf commentedI'm moving this to the file entity module because this requires both changes to how the file entity is implemented and to the core files managed table.
Comment #2
dave reidThis is something we'll have to do eventually but likely it will be a separate sub-module called file_revisions since we don't want this enabled for people by default. Marking as postponed but major.
Comment #3
dave reidComment #4
johnpitcairn commentedI've been thinking about how file revisioning might work from the user's perspective. In Drupal 6, I had been using a full content type - "file", "image" etc, forcing users to create a new instance of that content type and upload the file there, then separately referencing that content item from other nodes. I was not providing any kind of upload field within the referencing node edit form.
So I'm curious - in the context of a referencing entity edit form, what is meant by the "original file" and how that is "updated", from a user's perspective. Is the "original" the referencing entity where the file was originally uploaded, via the filefield widget, mediafield widget etc?
In the referencing entity edit form, if there is an upload widget, how do you distinguish between the user
A: replacing that file with some other unrelated file, or
B: uploading a new version of the file
If A, you want a new file entity, if B, you want a new file entity revision, right? And you possibly do want to update other references to the file entity for B, but definitely not for A.
My experience is that users will just upload/replace files in an unstructured way wherever they have an "upload" button available, and they won't think about whether the upload is a new version of the same file. It seems to me that to support file revisioning from the UI, it becomes desirable to separate the act of uploading a file from the act of referencing the file, which is the workflow I force on users in Drupal 6.
Perhaps this is best discussed from the perspective of the module which provides the upload/reference UI, if/when there is a module that supports file revisioning. Or perhaps file entity should be responsible for providing the default revisioned upload UI?
Possibly relevant is this Media module issue: #1398896: Decouple Add media page from media browser
Comment #5
tsvenson commentedWe need to have a lot of thinking going on about this as there are plenty of use cases where things can go wrong.
That's just three question examples this needs to address. If they aren't, then sites will experience unexpected results.
Comment #6
jenlamptonI'd love to get file revisions working w/ media too. I'll keep an eye out for something to test.
Comment #7
tsvenson commentedI've been thinking a bit more about this and the hard nut to crack is going to be managing different versions of the files. Mainly due to how they now are stored in the file system and how Drupal is using the file names.
I have an idea about this though that I think is a quite possible solution, one that also will work well with the way Drupal manages files already, including features such as the Image styles.
Please bare in mind I'm not a skilled developer, I just pick up things here and there and this is me basically talking loud :)
Oki, just a few ideas, but I think this could be one solution that shouldn't be to difficult to implement due to the way Media and File Entity works.
Other things this would open up for is making it easier to control who can see files and not. A document only certain people can download can then be downloaded directly from the locked storage and never be exposed in the public file system for example.
Comment #8
Nick Lewis commentedI've been working on a patch for epsacrop that enables "revision support" for file entities. #1497484: Unique Crops Per Node/ Revision The implementation is pretty ghetto right now. Essentially, I just clone and reattach file entities to the revision in hook_node_presave. This functionality probably belongs in a module of its own, but I'm strapped for time atm.
Comment #9
dave reidSo here's my thoughts on revisions. It's a good idea and something I knew eventually would be done. But until core has a better generic revision API, and until we're getting a large percent of the user base clamoring for it, it's probably not going to be appropriate to put into file_entity and I would encourage it to live in a separate project. Figuring out how it actually works for storing the actual files in the file system as well is a big thing too.
That said, if we need to fix up file_entity to support revisions in a way that will not block merging the module into d8, I'm for reviewing and getting those fixes in. But we continually have to be aware that this module is one we want to merge as-is into core. We can't add dependencies on Entity API or UUID if that functionality isn't going to be available or implemented in D8 core.
Overall I think we will find working on #1123570: Replace file while retaining field metadata much more useful to a wider audience of end-users until revisions becomes a better option for us to implement here.
Comment #10
tsvenson commentedI think the big question is if there will be enough time before Dec 1st to also get revision support ready for core? Risk is it end up being half-baked, especially considering that this is far more complex that text content stored in the database.
Just one such use case is how to handle reused files if the original is updated. In some cases that should propagate throughout all the places that files is used in, while in other cases it should be optional per use.
To get this right, revision support most likely needs to live and mature in contrib for Drupal 8. Of course that would require that it will be fairly easy to replace the core storage functionality...
Comment #11
arthurf commentedI think we have to be careful about derivatives here. Perhaps that's beyond the scope of this discussion. I'm not sure that that would be a blocker but I think there would need to be agreement between how we handle revisions and derivatives.
As per the reuse- in cases where a file is being reused but should retain the original data then it should be implemented as a new file, not a reuse. I'm completely unclear on what the UI for that is but I think the obvious use case is wysiwyg inserting- as tsvenson notes.
Perhaps when one goes to edit the file you have the option to replace all or the single instance- in the single instance it actually creates a new file?
Comment #12
steinmb commentedHow hard would it be to do revision only on text field attached to the file entity? The opposite to #1123570: Replace file while retaining field metadata that Dave mention. I know the ideal would be a revision of the entire file entity.
Comment #13
tsvenson commented@arthurf: When it comes to derivatives and what will happen when the file is updates is as I mentioned a pretty complex problem.
In some cases you want to control this from the file type. If you for example has a file type called Logos, then its likely that you want to automatically update the logo in all places it is used.
In other cases you need to leave that to the owner of the content it is being (re-)used in.
But then you also have the case when it comes to content revisions. If this is done right, then it will be possible to also show the correct version of the file for each revision the content has stored. Today that is not possible.
Then its also depends on what type of site it is. If its my personal blog, then I control everything. But if it is a site when members can share content, then that will have a completely different set of requirements.
So, besides revision and derivatives we will also have access control involved in this.
Then to top it up the custom file types that soon (hopefully) will make it into 2.x will add yet another dimension to this.
What would be extremely useful right now would be to try and figure out as many use cases as possible. It is something I plan to spend some time with between now and Barcelona, then go over it with other developers there.
Comment #14
reubenavery commented+1 for this.
A contrib module I found, sounds promising: https://drupal.org/project/file_entity_revisions
Edit: As of 20 September 2013, it is brand new. Needs a lot of work still, beware unless you are willing to get your hands dirty.
Comment #15
ericduran commentedI just released https://drupal.org/project/file_entity_revisions.
FYI: Before I started working on that module I spoke to Dave Reid on irc and spoke to him about this issue. I decided to go with a different module as per the recommendation on this thread and because we wanted to add a couple of extra features.
The module is very early but we already pushed it to multiple sites, seems to be working great.
In short this thread is now fixed.
I'm going to marked this as "Fixed" even thought it's technically not in the file_entity module. Maintainers: Change it to what ever you feel is appropriate.
As far as I'm aware there are no major issue with File Entity Revisions and it technically does very little :-)
For a full list of features please do check the project page.
Thanks.
Comment #16
klonos...this is just great! Let's give the new project a popularity boost in order to get more people testing it.
Comment #17
klonos...
Comment #18
dave reidAdded to https://drupal.org/project/file_entity
Comment #20
klonosThank you Dave.