Hello!
I need help. I found this article https://confluence.atlassian.com/confkb/how-to-find-the-deleted-date-for-a-page-in-trash-1155479219.html
But I have an empty table AO_7B47A5_EVENT
Where can I find delete date of items in trash?
Is it possible to get this date using Java API via scriptrunner or only through the database?
Confluence version 7.13.11
Thanks in advance I hope somebody can help!
Hi @aas,
Looking at the Confluence 7.13.11 Java API documentation, I don't think there is a way to retrieve the page's deleted date & time via Java API.
However, you can do so in Confluence 7.14.0 and above with the new addition of the getTrashDate method in the API.
import com.atlassian.confluence.spaces.SpaceManager
import com.atlassian.confluence.pages.TrashManager
import com.atlassian.sal.api.component.ComponentLocator
def trashManager = ComponentLocator.getComponent(TrashManager)
def spaceManager = ComponentLocator.getComponent(SpaceManager)
// Replace with your space key
def space = spaceManager.getSpace('TEST')
// Adjust the min/max results you want
def deletedPages = trashManager.getTrashContents(space, 0, 100)
deletedPages.each { page ->
log.warn "The page ${page.title}(${page.id}) deleted on ${page.trashDate.get()}"
}
Kind Regards,
Helmy
Hi @Helmy Ibrahim _Adaptavist_ !
Thanks for your answer. I could upgrade my confluence to 7.14.0 and above and your script works fine! I can get all trashed items and their deleted date and after that I can purge the old ones (deleted before certain date) with
trashManager.purge(space.getKey(), item.id)
But in logs I found
java.lang.RuntimeException: There was a SQL exception thrown by the Active Objects library:
java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (CONFL.SYS_C00188413) violated
Caused by: Error : 1, Position : 0, Sql = INSERT INTO "AO_7B47A5_EVENT" ("USER_KEY","EVENT_AT","SPACE_KEY","CONTENT_ID","CONTAINER_ID","NAME","VERSION_MODIFICATION_DATE") VALUES (:1 ,:2 ,:3 ,:4 ,:5 ,:6 ,:7 ) RETURNING ID INTO :8 , OriginalSql = INSERT INTO "AO_7B47A5_EVENT" ("USER_KEY","EVENT_AT","SPACE_KEY","CONTENT_ID","CONTAINER_ID","NAME","VERSION_MODIFICATION_DATE") VALUES (?,?,?,?,?,?,?) RETURNING ID INTO ?, Error Msg = ORA-00001: unique constraint (CONFL.SYS_C00188413) violated
Why I have this exception? May be it because of old items in trash which were deleted before upgrade?
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.