SilverStripe 4.2.2 - Delete Files Option in CMS


#1

Silverstripe Version:
4.2.2.

Question:
Is there a way to enable the old SS3 “Delete from files” option on the image/file upload field in the CMS or is that option permanently gone with the upgrade to SS4?

(I’m asking just in case I’ve somehow missed the option having read the API documentation for UploadField and come up short).

I’m trying to wonder how when my CMS users need to replace a PDF Brochure with a new one (and the old one should no longer be available) do I make an interface for them to actually properly delete the old PDF so that there is no trace of it and upload the new one. e.g. things like price lists where you don’t want old versions around. But the convenience of deleting an asset before you upload a new one was pretty darn cool for keeping the file system straight.


#2

If you check API Doc SilverStripe\Assets\AssetControlExtension | SilverStripe API

## Config options

keep_archived_assets bool When archiving versioned dataobjects, should assets be archived with them? If false, assets will be deleted when the dataobject is archived.

#3

Thanks for the helpful insight.

I’m not planning to version the particular DataObjects in question just yet but did turn versioned DOs on and experimented with it.

I’ve also added some manual code to some non versioned DOs to do it in code if the Image or Asset in question has a use count of 1 it will unpublish the asset when the DO is deleted.