Wiki.js

Tool to handle orphaned files

When editing pages it can happen, that the person editing doesn't delete unused assets. Like when he uploads a new version of a PDF file or removes outdated assets from a page. In this case there wil…

When editing pages it can happen, that the person editing doesn't delete unused assets. Like when he uploads a new version of a PDF file or removes outdated assets from a page.

In this case there will be a lot of old and unused files filling up the file storage after some months or years.

To handle this as an admin, an option in the admin area to find orphaned files could be useful:
You click a button, in the background an index of all files is created and compared to the pages (could take some minues) and in the end you will be shown a list of all the unused files. Then you can select them with a check box or mass select all and click delete.

A better option would be to keep the index current at all times inside the database and edit it when someone adds or removes a file from a page. For this you could add a column "used by" besides every asset in the database that stores IDs of all the pages that use this asset. That way you could even create a small section in the file manager that displays the names of pages that use this asset.