(See https://github.com/silverstripe/silverstripe-framework/issues/3792 for full details).
The driver for this change is solving the following problems we keep encountering in practice:
* changing root path for asset storage
* support Amazon S3 as a backend
* support backends for sites residing on multiple servers (clustered sites)
* have files versioned
* have files with workflow
* be able to model private files that do not appear in the Files & Images section
To solve these problems we propose to:
1. Create a backend-independent way of referring to files in the Framework.
2. "Degrade" files from entities in their own right (DataObjects) to model properties (DBFields).
3.Hide all file operations behind an interface.
Specifically, we would do so by introducing a new concept of a generalised file reference - a set of values (i.e. a tuple) uniquely pointing to a file regardless of the storage backend in use.
Then we would change the model representation of the files: instead of using the coarse-grained data objects such as File we would move to using the $db fields. For this a new DBField would be introduced, called FileReference.
The File and Folder would retain their APIs as much as possible, but be retrofitted to use the FileReference. They would now conceptually become an inseparable part of the Files & Images subsystem of the CMS.
UploadField would be updated to be able to work directly with the FileReferences, additionally to the existing has_one support.
Finally, we would remove all direct filesystem operations from the Framework and place them behind the new Asset Persistence Layer (APL) interface. This RFC does not define how an APL should work under the hood. Neither does it define the architecture nor interfaces of the storage backends. APL is tied to data stored by that APL, and changing the APL will cause data loss without a migration script.
AdminIngo Schommer (Admin, SilverStripe) commented
Here's an overview: https://www.silverstripe.org/blog/silverstripe-4-0-changes-to-files/
Related meetup talk mentioning the feature: https://www.silverstripe.org/blog/video-whats-new-in-silverstripe-4/
And a deep dive from a while ago: https://vimeo.com/118548773
And an experimental S3 integration: https://github.com/madmatt/silverstripe-s3
The RFC-1 was agreed to by the core committers. I'm going to update some of the information in this item to better communicate the summary of the RFC and set this to "planned".
I will also close the other item referring to basically the same thing so we have one card to represent the planned work as part of our roadmap (while still referencing the close items content for archiving purposes).
This is in some ways a duplicate of the (larger scoped) item http://silverstripe.uservoice.com/forums/251266-new-features/suggestions/6425928-files-should-be-stored-in-dataobject-fields
Michael Strong commented
Github ticket here to discuss: https://github.com/silverstripe/silverstripe-framework/issues/3562