In Kirby, it is easy to upload a file and then upload another file to the given files file. But the first file sits there and is not actively used. This often leads to situations where there are a lot of unused files in the project and if there are a lot of files, the user does not have time to check which version of the file is used and which is not.
So I created a file status pointer that shows the ◆ sign in the info text for an actively used file and the ◇ sign for a file that is only in a folder but not linked anywhere in the files field. Now together with batch editing, this is an excellent way for a user to quickly clean up their repository.
I don’t have a universal plugin for this, since mine searches my selected files filed by name, but I think it would be very beneficial if it was in the Kirby core natively.
Maybe Kirby could add a cleanup routine that crawls the site and builds a list of unused files. It could be a feature available to run on all pages and from the settings?
It’s probably hard to do this in a performant way.
I like the idea of a cleanup routine. It could also be a CLI command like the already existing clean:content
.
I don’t like the idea of moving it to the CLI. As most shared hosting does not support SSH, the CLI is useful for development only. A cleanup routine would make it inaccessible to site admins and owners that are not developers.
I agree. But I think it would be a better idea to look at the big picture here. Making CLI commands like these available (to admins) in the Panel sounds like a good idea.
How difficult would it be to create a custom panel view (or extend the settings view) with some CLI buttons? Maybe using a plugin like Janitor?