How can I export page version history details for a given space?
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
An admin would like to export a simple page history with modification dates, name of last modifier, comments and the page version number for every page in a space. This export would be an export of the data that is seen when viewing <Confluence-Base-URL>/pages/viewpreviousversions.action?pageId=XXXX.
Cause
Currently Confluence native functionality does not offer a way to export this history via the UI.
Resolution
You can extract the page history details by running the following query on your database. Be sure to fill in the value of SPACE KEY
before running the query.
SELECT um.username,
c.title,
c.version,
c.lastmoddate,
c.versioncomment,
c.contentid
FROM content c
JOIN user_mapping um
ON c.lastmodifier = um.user_key
WHERE ( c.prevver IN (SELECT contentid
FROM content
WHERE prevver IS NULL
AND contenttype IN ( 'PAGE', 'BLOGPOST' )
AND content_status = 'current'
AND spaceid IN (SELECT spaceid
FROM spaces
WHERE spacekey = '<SPACE KEY HERE>'))
AND c.content_status = 'current'
AND c.contenttype IN ( 'PAGE', 'BLOGPOST' ) )
OR ( c.prevver IS NULL
AND c.contenttype IN ( 'PAGE', 'BLOGPOST' )
AND c.content_status = 'current'
AND c.spaceid IN ((SELECT spaceid
FROM spaces
WHERE spacekey = '<SPACE KEY HERE>')) )
ORDER BY c.title,
c.version DESC
Depending on what type of database you are running, you may need to format this query differently.