Wednesday, August 14, 2019

Modifying an Exported Space From Confluence

Introduction

During times of Confluence migrations (from one instance to another), you may find yourself in a situation where the new Confluence instance has a space that has the same spacekey as an old space that you are attempting to import. This month's post will show you how to get around that issue.

Required skills

This document assumes you know how to export a Confluence space already and are comfortable with editing XML files.

Exporting and editing

To start, you will need to expand the exported zip file (that comes from exporting a space). In this expanded directory, you will need to edit the exportDescriptor.properties file. In this file, modify the spaceKey property to the desired spacekey and save your change.

In entities.xml, search and replace the following items listed in this table (replacing NEWKEY with an unused and new spacekey you wish to use in the new Confluence instance):
Search for Replace with
[CDATA[OLDKEY] [CDATA[NEWKEY]
OLDKEY NEWKEY
spaceKey=OLDKEY spaceKey=NEWKEY
[OLDKEY: [NEWKEY:
key=OLDKEY] key=NEWKEY]
<spaceKey>OLDKEY</spaceKey> <spaceKey>NEWKEY</spaceKey>
ri:space-key="OLDKEY" ri:space-key="NEWKEY"
ri:space-key=OLDKEY ri:space-key=NEWKEY
<ac:parameter ac:name="spaces">OLDKEY</ac:parameter> <ac:parameter ac:name="spaces">NEWKEY</ac:parameter>
<ac:parameter ac:name="spaceKey">OLDKEY</ac:parameter> <ac:parameter ac:name="spaceKey">NEWKEY</ac:parameter>
<property name="lowerDestinationSpaceKey"><![CDATA[NEWKEY]]></property> <property name="lowerDestinationSpaceKey"><![CDATA[newkey]]></property>
<property name="lowerKey">![CDATA[NEWKEY]]></property> <property name="lowerKey"><![CDATA[newkey]]></property>
spaceKey=OLDKEY spaceKey=NEWKEY
spacekey=oldkey spacekey=newkey

With those two files updated, re-zip all content back together, rename it to the original zip file (you may need to remove the old zip file or just rename it just in case), and upload it to your new Confluence instance as you would normally to import a space.

No comments:

Post a Comment