Restoring attachments from a File System backup when a Space is mistakenly deleted
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
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.
*Fisheye および Crucible は除く
The supported procedure is to restore a space export that contains the attachments included in it. Thus, Atlassian cannot guarantee providing any support for the procedure below .
目的
This guide applies only if you have deleted a space by mistake, re-imported that space using the Space XML Backup (without attachments) and the attachments were recovered from the filesystem backup of the old space.
ソリューション
We already have a guide on How to resolve missing attachments however, this does not apply in the situation explained here because after we imported the lost space, we have a new space with new page and attachment IDs.
In this case, we have a set of IDs belonging to the new attachment hierarchy and the old attachment folders (which contain the attachments we want to recover), but there is no easy way of mapping one to the other.
This solution requires that you have access to the Confluence repository backup before the space deletion. If you don't have access to it, there are minimum possibilities to restore the attachments.
Please, follow the steps below:
- You will need to run this query twice (make sure to replace the
<SPACE_ID>
in the query accordingly)- The first time on the new database using the new space ID
The second time on the old database using the old space ID
SELECT contentid, title, lowertitle, contenttype, pageid FROM content WHERE contenttype IN ('PAGE', 'BLOGPOST') AND contentid IN (SELECT pageid FROM content WHERE contenttype = 'ATTACHMENT' AND prevver IS NULL AND spaceid = <SPACE_ID>) UNION (SELECT contentid, title, lowertitle, contenttype, pageid FROM content WHERE contenttype = 'ATTACHMENT' AND prevver IS NULL AND spaceid = <SPACE_ID>) ORDER BY 4, 3;
- This will fetch the page and attachment names along with their IDs
- Combined with the old and new space IDs, you should be able to construct the paths of the old and new attachments on the filesystem (based on this documentation Hierarchical File System Attachment Storage)
- After that, all you need to do is copy the attachments from the old path to their corresponding new path