Solution for automated trash purging?

Daniel Hertrich December 14, 2017

Hi there,

is there some Confluence plugin or another solution (or way) to purge pages from the confluence trash bin after a specific amount of time (trash date + x days)?

Are there *any* ways to automate permanent deletion dependent on criteria such as "trashed" date, "created" date etc.?

Thank you!

 

2 answers

0 votes
Daniel Hertrich December 18, 2017

I looked into a possible solution using the Archiving Plugin, but that doesn't seem to be an option. Problem: We needed a two-step workflow:

Step 1: User archives a page manually by assigning the "archive" tag OR a page is archived autoimatically by specific filter crieteria (OK, will work).

Step 2: The Archiving Plugin scans its own archive space to permanently delete all pages that are older than 90 days.  (that one won't work)

However, Step 2 doesn't seem to be possible, as the Archiving Plugin is not able to use its own Archive spaces as input. Even after making such spaces visible by changing their status from "Archived" to "Current", the Archiving Plugin is not able to assign workflow rules to its own Archive spaces. 
Or did I miss something?

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 18, 2017

(NB. you should have been added your comment as a reply to my answer in the top, not as a new answer. Now the context is somewhat lost.)

So, permanent deletion is a primary requirement? So must the content go forever?

I am asking this, because our add-on is built more with the mindset of "archive this content, so that it becomes invisible, but when it is necessary, it can be searched through, it can be viewed, it can be restored". The motto is: "don't delete, archive instead as you can never know".

Daniel Hertrich December 19, 2017

Oh sorry. WIll do the next time.

Yes, permanent deletion is a primary requirement. 

Basically, the requirement for now is that if the user deletes a page, it should be recoverable for x days, but not visible to the normal user anymore and not available for standard searches. After those x days, it should be deleted permanently automatically. This has legal reasons is thus a hard requirement.

In my use case, when using your plugin, archiving would be kind of a workaround for the lack of an automated way to purge the trash bin in a way that a page is deleted from the trash "x days after it has been trashed".

I think your plugin could help in that situation, if it could two two more things:

- Apply archiving rules also to already archived pages, i.e. that an "... (Archive)" space would be (optionally) visible to the archiving rules form, even if the space is set to "Status = Archived" (which would be required, too, to avoid search matches from these archives)

- If there was an additional "Archiving strategy", that takes care that content is permanently deleted. Maybe don't call it "archiving" then. ;-) In some companies, there are such (legal) requirements. If you add such features to the plugin, it could be very valuable to such companies, especially since there doesn't seem to be another available solution yet.

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 19, 2017

Thanks for elaborating the use case, Daniel!

Based on your explanation I created 2 public feature requests in our tracker and I encourage you to vote on these:

  1. https://midori.zendesk.com/hc/en-us/articles/115004528194--Permanently-delete-archiving-strategy
  2. https://midori.zendesk.com/hc/en-us/articles/115004528314-Allow-archiving-even-on-archive-spaces

In addition to our product vision, user votes significantly affect the product roadmap.

Final note: I understand that the law requires you to permanently destroy content and that must go forever. But, those pages will be captured in Confluence backups and your database backups anyway. Is that compatible with the law?

Daniel Hertrich December 19, 2017

Thanks Aron. For ease of implementation, "permanent deletion" could be implemented as another "Archiving strategy", however, my guess is that this is not too intuitive for new users, so it might be better to make this a new area on the archiving rules setup page and not list it as an "Archiving strategy", but rather a new rule what to do with a page.

The issue with backups is addressed already: No backups older than x days are kept at all. ;-) 

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 19, 2017

Gotcha!

Rafael Franco
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.
December 19, 2017

Hi Daniel,

Using ScriptRunner for Confluence as mentioned before you can establish using a Script Job what is the frequency that the check is made, meaning you can say that you want to purge the trash after 30 days of pages being in there.

Let me know if you need help with that.

Cheers,

Rafael

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 19, 2017

How can you flush a single page from the trash?

If you cannot, then the trash cannot be used for this use case.

For example, if you put page "A" to the trash on 1 Jan, then page "B" on 5 Jan, and you completely empty the trash on 1 Feb (30 days after "A" was trashed), then "B" will also be flushed although it was 25 day old only  -> PROBLEM!

Daniel Hertrich December 20, 2017

Rafael, Aron is right, I need to scan every single page in the trash and decide, depending on its "trashed" date, if it's going to be deleted permanently or not in the current script run. Is this possible? 

 

Rafael Franco
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.
December 20, 2017

Hi Daniel,

We had a similar question before from other customers and unfortunately Atlassian does not provide a timestamp when a page is trashed.

What you can do to make it work is to listen to the PageTrashEvent, add a content property to the page setting the date that was trashed and then use a Script Job to go through all these pages.

Hope it was clear,

Rafael

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 20, 2017

Rafael, it still doesn't give an answer to my question:

How can you flush a single page from the trash?

Rafael Franco
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.
December 20, 2017

DefaultTrashManager has a purge method with the following signature:

public boolean purge(String spaceKey, long contentId)

ContentId is the id of the page.

Daniel Hertrich December 20, 2017

Rafael, do you mean there is no trashed date provided in an API by Atlassian or is there not even a trashed date stored in the Confluence database?

Rafael Franco
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.
December 20, 2017

There isn't even a trashed date stored in the database :(

As I mentioned, you can implement yours, but it's not provided by Confluence. Shocking I know...

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 20, 2017

> DefaultTrashManager has a purge method with the following signature:

Ah, OK, cool! I didn't know about that.

Daniel Hertrich December 20, 2017

Thanks guys, I'll see and discuss internally how we will proceed. 

Anderson Hsu
Contributor
July 7, 2020

Hi all, 

How can I use it in confluence 4.2.3 environment? Kindly help give suggestion about how to clean trash automatically? Thanks a lot.

Regards, Hsu Yao Chang

LaurieC
Contributor
June 21, 2022

@Rafael Franco Thanks for the info on Scriptrunner for Confluence and the ability to purge specific pages from the trash. I have a few questions:

  • If I understand correctly, you would use a listener to identify any deleted pages and then add a content property to capture the date it was deleted and then use the DefaultTrashManager to delete pages by content ID that have a content property older than say 90 days. Is that correct?
  • Is the listener a built-in listener? Or can you provide the code to build out the listener that would put the date on the page?
  • Is the DefaultTrashManager a built-in script? Will it analyze the content property and be able to evaluate which pages are older and a certain number of days and then return the list of content IDs of pages that should be deleted?
  • Would this approach work also for attachments that are in the trash?

Thanks so much! We're evaluating options to delete items in the trash that are older than x days. We love Scriptrunner for Jira, but don't yet have Scriptrunner for Confluence.

Laurie

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 15, 2017

You can empty trash periodically using the ScriptRunner app, as explained here.

As for emptying only certain pages from the trash, I don't think you can do that. It is "nothing or all".

If you need more sophisticated page lifecycle tracking (based on last modification, last view, manual markers, etc.) and automated archival, check out the Archiving Plugin.

Daniel Hertrich December 18, 2017

Thank you Aron, I'll have a closer look at the Archiving Plugin. It looks very useful on first glance. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events