EZP-22408: implemented cleanup script

This PR resolves issue https://jira.ez.no/browse/EZP-22408

This implements cleanup script.
For more details see `ezpublish-kernel` PR for the same issue at https://github.com/ezsystems/ezpublish-kernel/pull/993.