Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bulk delete / purge Confluence page history / versions

Guenter Huber
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.
July 5, 2015

So, the question is:
When I delete page versions from the history, do they really / automatically get purged or do i need to do something else? (Some DB SQL command maybe?)

For others desperate / left alone by Atlassian out there:

Sadly the Bob Swift CLI add-on that can selectively delete page versions has problems with our authentication and before I wait another year for our IT to solve that:

I found a really ugly, but straight-forward kludge:
iMacros browser extension (I used the FF one) three-liner (if you already are on the respective history page):

TAB T=1
TAG POS=2 TYPE=A ATTR=TXT:Delete
TAG POS=1 TYPE=BUTTON ATTR=TXT:Delete

Set the Loop Max and Manage > Settings > Timeout sufficiently high.

No worries, the script will err when there is no Delete button any more, so the current one will be preserved.

No problem to adapt that to leave some versions,...

Atlassian, please answer the question above!!!
Thanks
G.

3 answers

1 accepted

3 votes
Answer accepted
lavitz slambert
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.
July 6, 2015

I'm not from atlassian but I can reply that one smile. When you delete a page version from page history section that information is also removed from the database together with all the child table references. As a prof of concept check the below test and outputs I've made against Confluence 5.8.4:

  1. Lest' create a page called "test page" and add an attachment (know how.txt) on the creation of that page.
  2. Now let's modify the page more two times.
  3. Now in the page history session we have 3 versions for our test page.
  4. After that we will run below queries:

    img.jpg

  5. In above image you can see 3 lines representing each version of your page plus one additional line representing the attachment we added.

  6. Now let's go to page history and remove the two first versions of the page and run those queries again:
    img2.jpg
  7. See that the previous two lines where removed? Also the line representing the attachment will remain as the attachment is still present in the latest page of our test. 

Hope this give you a better input on how Confluence works on the database level.

Thanks and Regards,
Lavitz - the guy that uses Confluence on Windows as a Hobby!
Guenter Huber
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.
July 6, 2015

Sounds reasonable, Lambert. Thanks for jumping in! What the SQL DB does with the records marked for deletion is a whole other story, but there are recipes to reclaim the space. IAC there will be much less trash when I copy the space next time. Did you try SQL to delete history? Confluence as a hobby? Can´t say what I think. Thanks again G.

lavitz slambert
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.
July 7, 2015

You are more than welcome :D. Never deleted the history manually as there's might be other tasks or attachments to delete depending on the content of the page (kinda risky). Yep, sometimes confluence is a pain in the @#$, but I do have some fun as well when checking the database structure.

1 vote
Doug
Contributor
August 25, 2015

I used iMacros last year to reduce a large amount of page versions. This macro code will allow deleting the oldest version to then be able to loop for a set number of times that would then leave the X most recent page versions. It was my goal to leave pages with at least 10 page versions and a minimum of a week of history.

TAG POS=1 TYPE=TD ATTR=TXT:"v. 1"
TAG POS=R1 TYPE=A ATTR=TXT:"Delete" 
TAG POS=1 TYPE=BUTTON ATTR=TXT:Delete

This year I used the Bob Swift CLI to remove the page versions, which saved hours of time. I too had the authentication problem, but we got around it by installing the CLI Client on the Confluence box and used ssh to run the commands.

1 vote
Guenter Huber
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.
August 24, 2015

Doug:
This year I used the Bob Swift CLI to remove the page versions, which saved hours of time. I too had the authentication problem, but we got around it by installing the CLI Client on the Confluence box and used ssh to run the commands.

Thanks, Doug, that was exactly the answer I was looking for!!!
Sadly I couldn´t find a way to convert your comment to an answer, so I did it with the quote.
If you can accomplish this with yours, please do!

I cross-linked this on the BobSwift issue I had opened for that.

Thanks again
G.

Doug
Contributor
August 25, 2015

Glad I could help.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events