I've written a confluence plugin and want to delete the historical versions of space attachments to clean up disk space。
I initially tried to use the attachmentManager.removeAttachmentVersionFromServer(att) method to remove attachments, but only the most open attachments were removed per run, after which the error occurred:
Exception in thread "Thread-85" org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.atlassian.confluence.pages.Attachment#884751]
I later saw CachingAttachmentManager and tried to use that method. But I somehow imported into the plugin. The constructor of CachingAttachmentManager contains parameters.
Can someone tell me how to delete the historical version of the attachment in the plugin?
Or tell me how to introduce that CachingAttachmentManager？
Thank you everyone