Get deleted date for a page in trash

aas
Contributor
October 10, 2023

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!

1 answer

1 accepted

0 votes
Answer accepted
Helmy Ibrahim _Adaptavist_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 9, 2023

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()}"
}
Perhaps you can upgrade to 7.14.0 and above, and the script would work for the deleted pages pre-update?

Kind Regards,
Helmy

aas
Contributor
March 19, 2025

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events