Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

DataObjects


Go to End


417 Views

Avatar
JonoM

Community Member, 130 Posts

5 May 2015 at 3:26pm

Edited: 05/05/2015 3:26pm

Making a module for this is on my To-Do-One-Day list. It's fairly tricky/risky problem - for each file you have to ask:

  • Is the file referenced from any HTMLText instances?
  • Does the file belong to any has_one relationships?
  • Does the file belong to any has_many relationships?
  • Does the file belong to any many_many relationships?
  • If a folder - is it empty?
  • Is the file URL referenced externally, e.g. on a separate website or inside a PDF? (In this case it should be marked as Protected somehow)

I have a task I use on one site that can do some of this but it doesn't support has_many or many_many at this stage.

Thinking the eventual module will generate a list of unused files that need to be reviewed, but make it quick to mark all or many for deletion, and also allow you to mark individual files as 'protected' so they're not picked out as candidates for deletion in future reports.

If anyone else is interested in this module idea leave a note and if there's lots of interest I might work on it sooner. I'll update this post if and when it's available. Even better if someone else builds it (or already has) and leaves a link here ;)