A new feature for SilverStripe should be ...

Asset Abstraction

(See https://github.com/silverstripe/silverstripe-framework/issues/3792 for full details).

*Motivation*

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

*Proposal*

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.

92 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Michael StrongMichael Strong shared this idea  ·   ·  Admin →

    4 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base