We have a situation where our attachment growth is expanding quite rapidly as users are utilising Confluence as a collaboration tool around office documents. Due to this the prior versions quickly build up which turns a file of a few MiB in size to a few hundred MiB.
I'm wondering if there is a third-party plugin or some way you could let me know to periodically purge history? We would ultimately like to be able to purge history within a designated period of time.
Looking at our attachments table shows there is a moderate 3,561 attachment documents, of this there are a total 4,953 when counting prior versions.
I could quite simply use a mechanism in SQL to print and purge content with a query such as:
select attachmentid,
title,
pageid,
creator,
lastmoddate
from attachments
where prevver is not null
and datediff(curdate(), lastmoddate) > 30;
And then delete the subsequent attachment file, however I would gather there are two problems to this:
- Confluence would need to be off-line
- Lucene cache would need to be rebuilt (maybe?).
I'd really prefer not using this method unless it's proven to be safe.
If there are no other ways, no plugins etc, I'd be happy to investigate writing such a plugin provided the api's are available from within confluence to delete prior versions. If they are, could you kindly point me in the right direction to get me started on this? My plugin authoring experience has currently been only for themes and macros.