How To Create Folder In Confluence Space
Purpose
This guide provides some workarounds if you need to copy or rename a space in Confluence.
Confluence Cloud, Server, and Data Center do not provide a method for copying a space or changing the space key. The following feature requests have been raised.
Limitations
The information on this page is provided for informational purposes only, and will not be directly supported by Atlassian,should you wish to pursue possible workarounds in light of this limitation.
This information is not actively maintained and should be thoroughly tested before applying it to any production environment.
Solution 1 - Use an app from the Atlassian Marketplace
Available forCLOUDSERVERDATA CENTER
The best option is to use one of the third-party apps that can help you copy a space. Examples:
- Search for Copy Space apps on Marketplace
- Command-line tools such as the Bob Swift CLI tool can also be useful for bulk actions like copying a space.
Note that the Atlassian Labs Copy Space for Confluence app is not compatible with Confluence Server and Data Center 7.0 or later.
Solution 2 - Use the copy page hierarchy feature
Available forCLOUDSERVERDATA CENTER
The ability to copy a page and all its child pages were introduced in Confluence 6.0. This can be useful if you need to copy the contents of an entire space.
The following instructions are for Confluence Server or Data Center, but you can follow a similar process in Cloud.
To copy a space using copy page hierarchy:
-
Create a new space and set any permissions, look and feel, and other customizations.
-
In your source space, go to Space Tools > Reorder pages, and temporarily move any pages that exist at the root of the space to be a child of the homepage. This is to ensure the connection between pages in links and macros are preserved when copying. If you have no pages at the root, you can skip this step.
-
On the space homepage, select … > Copy.
-
Specify your new space as the destination.
-
Select Include child pages.
-
Make sure all checkboxes are selected so that labels, attachments, and restrictions are all preserved.
-
Select Copy. This might take a little while, depending on how big your space is. Pages are copied in batches, so don't worry if they're not all there immediately.
- Go back to the source space, and move any pages you temporarily moved, back to the root of the space.
-
In the new space, your copied pages will be a child of the new space's existing homepage. Go to Space tools > Reorder pages, and move your copied pages to the root of the space, so they are not a child of the homepage.
-
Go to Space Tools > Overview and set your copied homepage as the space homepage.
-
Delete the unwanted homepage.
-
Move any other pages that should not be a child of the homepage (such as an included library) back to the root of the space.
See the whole process in this short video.
Note that incoming links from other spaces will continue to point to your source space.
Solution 3 - export the space and modify the XML
Available forSERVERDATA CENTER
It is possible to manually clone or rename a space by modifying an XML backup of the target space.
Make sure you have a backup of your site and use a staging environment to test your changes before attempting this in production.
If you are renaming many spaces at once, it may be easier to export the full instance. Please note that in the case of a full site export, theexportDescriptor.properties file will not need to be altered, but you will need to change the space keys in:
<export_folder>/plugin-data/com.atlassian.activeobjects.confluence.spi/activeObjectsBackupRestoreProvider.pdata We strongly recommend testing your import on a staging server first, as full site backups are known to be problematic when importing back into Confluence. If you encounter any issues you should use the space-by-space method.
Stage 1:Generate the XML backup and create a test instance
- Select a new, unique space key and name for the second space. Space keys may only consist of ASCII letters or numbers (A-Z, a-z, 0-9) and no empty spaces, special characters or underscore are allowed in the key.If we have one of the invalid characters in the space key, the re-import will fail with a stack trace.
- Clone your production Confluence instance to a test server on another computer now. (For instructions, see Restoring a Test Instance from Production.) You should now have a production server and test server both containing the same data and can avoid the risk of corrupting your production Confluence instance.
- On thetest server, log in as an administrator.
-
Go to Space > Space Tools > Content Tools > Export > XML > Next > Full Export > Export Space and export the target space as
XMLincluding attachments.
- Save the space backup.
Stage 2:Edit the entities.xml file (via Bash & PowerShell scripts OR manually)
Scripts
If using the Bash script, then skip Stage 3: Edit the exportDescriptor.properties file step.
If using the PowerShell script, then execute Stage 3: Edit the exportDescriptor.properties file step.
If usingany of the two scripts,then skip theStage 6: Rename Space References step.
# variables (all upper case) zipfile="<path/myfile.zip>" oldkey_uppercase="<OLD SPACE KEY>" oldname_uppercase="<OLD SPACE NAME>" newkey_uppercase="<NEW SPACE KEY>" newname_uppercase="<NEW SPACE NAME>" # from here on, no changes are needed # the variables defined above will be used below # the lower case variables will be defined here based on the above, and you do not need to change them oldkey_lowercase=$(echo "${oldkey_uppercase}" | tr [:upper:] [:lower:]) oldname_lowercase=$(echo "${oldname_uppercase}" | tr [:upper:] [:lower:]) newkey_lowercase=$(echo "${newkey_uppercase}" | tr [:upper:] [:lower:]) newname_lowercase=$(echo "${newname_uppercase}" | tr [:upper:] [:lower:]) # unzipping only the entities.xml and the exportDescriptor.properties files unzip ${zipfile} entities.xml exportDescriptor.properties; # commands to actually edit the entities.xml and exportDescriptor.properties files sed -i "s/\[CDATA\[${oldname_uppercase}\]/\[CDATA\[${newname_uppercase}\]/g" entities.xml; sed -i "s/\[CDATA\[${oldname_lowercase}\]/\[CDATA\[${newname_lowercase}\]/g" entities.xml; sed -i "s/\[CDATA\[${oldkey_uppercase}\]/\[CDATA\[${newkey_uppercase}\]/g" entities.xml; sed -i "s/\[CDATA\[${oldkey_lowercase}\]/\[CDATA\[${newkey_lowercase}\]/g" entities.xml; sed -i "s/\"spaceKey\":\"${oldkey_uppercase}\"/\"spaceKey\":\"${newkey_uppercase}\"/g" entities.xml; sed -i "s/spaceKey=${oldkey_uppercase}/spaceKey=${newkey_uppercase}/g" entities.xml exportDescriptor.properties; sed -i "s/spacekey=${oldkey_uppercase}/spacekey=${newkey_uppercase}/g" entities.xml; sed -i "s/ri:space-key=\"${oldkey_uppercase}\"/ri:space-key=\"${newkey_uppercase}\"/g" entities.xml; sed -i "s/ri:space-key=${oldkey_uppercase}/ri:space-key=${newkey_uppercase}/g" entities.xml; sed -i "s/<ac:parameter ac:name=\"spaces\">${oldkey_uppercase}<\/ac:parameter>/<ac:parameter ac:name=\"spaces\">${newkey_uppercase}<\/ac:parameter>/g" entities.xml; sed -i "s/<ac:parameter ac:name=\"spaceKey\">${oldkey_uppercase}<\/ac:parameter>/<ac:parameter ac:name=\"spaceKey\">${newkey_uppercase}<\/ac:parameter>/g" entities.xml; sed -i "s/\"parentPageSpaceKey\":\"${oldkey_uppercase}\"/\"parentPageSpaceKey\":\"${newkey_uppercase}\"/g" entities.xml; # zipping the updated entities.xml and exportDescriptor.properties files back into the zip file zip -u ${zipfile} entities.xml exportDescriptor.properties; $oldKeyL = "oldname" $newKeyL = "newname" $exportFolder = "path_to_export_folder" $oldKeyU = $oldKeyL.ToUpper() $newKeyU = $newKeyL.ToUpper() $fileIn = Join-Path $exportFolder "entities.xml" $fileOut = Join-Path $exportFolder "entities2.xml" $fileContent = [System.IO.File]::ReadAllText($fileIn) $afterReplace = $fileContent. Replace("<property name=`"lowerDestinationSpaceKey`"><![CDATA[$oldKeyL]]></property>", "<property name=`"lowerDestinationSpaceKey`"><![CDATA[$newKeyL]]></property>"). Replace("<property name=`"lowerKey`">![CDATA[$oldKeyL]]></property>", "<property name=`"lowerKey`">![CDATA[$newKeyL]]></property>"). Replace("[$oldKeyU]", "[$newKeyU]"). Replace("[$oldKeyL]", "[$newKeyL]"). Replace("spaceKey=$oldKeyU", "spaceKey=$newKeyU"). Replace("spaceKey=$oldKeyL", "spaceKey=$newKeyL"). Replace("[$oldKeyU`:", "[$newKeyU`:"). Replace("key=$oldKeyU]", "key=$newKeyU]"). Replace("<spaceKey>$oldKeyU</spaceKey>", "<spaceKey>$newKeyU</spaceKey> "). Replace("ri:space-key=`"$oldKeyU`"", "ri:space-key=`"$newKeyU`""). Replace("ri:space-key=$oldKeyU", " ri:space-key=$newKeyU"). Replace("<ac:parameter ac:name=`"spaces`">$oldKeyU</ac:parameter>", "<ac:parameter ac:name=`"spaces`">$newKeyU</ac:parameter>"). Replace("<ac:parameter ac:name=`"spaceKey`">$oldKeyU</ac:parameter>", "<ac:parameter ac:name=`"spaceKey`">$newKeyU</ac:parameter>") [System.IO.File]::WriteAllText($fileOut, $afterReplace) Rename-Item -Path $fileIn -NewName "entities_old.xml" Rename-Item -Path $fileOut -NewName "entities.xml" Manual
- Open the space backup file with a zip file editor and find the file
entities.xml. - Edit
entities.xmlin a text editor. -
Do a 'Search & Replace' on the old space name as shown below. Swap out
Old Space NameandNew Space Namefor the actual names.Search for
Replace with
[CDATA[Old Space Name][CDATA[New Space Name] -
Do a 'Search' for any occurrences of the old space name that occur in user content. You may wish to replacesome or all of these references with the new space name. Replace
Old Space NameandNew Space Namewith the actual names. -
Do 'Search & Replaces' for each of the space key patterns as shown below.
Note carefully that letter casing matters here: the placeholder variables OLDKEY/NEWKEY represent keys in UPPER or MIXED-CASE and oldkey/newkey represent keys in all-lowercase.
Search For
Replace With
OLDKEYNEWKEYspaceKey=OLDKEYspaceKey=NEWKEY[OLDKEY:[NEWKEY:key=OLDKEY]key=NEWKEY]<spaceKey>OLDKEY</spaceKey><spaceKey>NEWKEY</spaceKey>ri:space-key="OLDKEY"ri:space-key="NEWKEY"Perform this step if links within the renamed space should point to themselves and not the original space key, otherwise, skip
ri:space-key=OLDKEYri:space-key=NEWKEYPerform this step if links within the renamed space should point to themselves and not the original space key, otherwise, skip
<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>Beware new key is used on both sides
<property name="lowerKey"><![CDATA[NEWKEY]]></property><property name="lowerKey"><![CDATA[newkey]]></property>Beware new key is used on both sides
<property name= "lowerKey"><![CDATA[oldkey]]></property><property name= "lowerKey"><![CDATA[newkey]]></property>spaceKey=OLDKEYspaceKey=NEWKEYspacekey=oldkeyspacekey=newkey - Save the modified
entities.xml. - Overwrite the original
entities.xmlin the space back up with the modified version.
Stage 3:Edit the exportDescriptor.properties file
- Also, edit the
exportDescriptor.propertiesfile in a text editor - Change thespaceKey value in the
exportDescriptor.propertiesfile to the new spaceKey
Stage 4:Restore to a lower (Test/Dev/Staging) environment for verification
- Login to yourtest instance as a Confluence administrator.
- Go to
> General Configuration > Backup & Restore. Under 'Upload a zipped backup to Confluence', browse to select the modified space backup. Check the 'Build index' option and select 'Upload & Restore'. - Once the restore process has been completed, access the new space and test that you can access pages, embedded links, and attachments. Any error in this step indicates that your search and replace was performed incorrectly and you should retry from step 2.
Stage 5: Import the space into Prod
- Back up your production instance now.
- Login to theproduction instance as a Confluence administrator.
- Go to
>General Configuration > Backup & Restore. Under 'Upload a zipped backup to Confluence', browse to select the modified space backup. Check the 'Build index' option and select 'Upload & Restore' If any data loss occurs as a result of using this workaround, immediately revert to the backup. - Once the restore process has been completed, access the new space and test that you can access pages, embedded links, and attachments. If any error occurs during this step, revert to the site backup.
- If renaming a space, you can delete the old space by going to Space > Space Tools > Overview > Delete Space. Click OK to remove the old space.
Stage 6: Rename Space References
Links in other spaces to the old space will remain unchanged. If you are renaming a space, you will need to change these links to point to the new space. Users who are copying a space can leave the links pointing to the original space by skipping this stage.
Changing these links depends on if you want to change every link or only some. If not all links must be changed or you are unwilling to stop your production instance, this must be done by editing each page individually. If all links must be changed, follow the instructions below.
- Create a site XML backup including attachments from
>General Configuration > Backup & Restore. - Save the site XML backup file.
- Stop the production instance.
- Create two copies of the site backup. Keep one copy as the original, unmodified backup, the other will be modified. Rename the backups so that it is clear which is being modified.
- Open the copy for modification and edit
entities.xml. -
Do four 'Search & Replaces' on each of the references to the old space key as shown below. Swap out
oldkeyandnewkeyfor the actual keysSearch for
Replace with
[oldkey][newkey]spaceKey=oldkeyspaceKey=newkey[oldkey:[newkey:key=oldkey]key=newkey] - Save the updated
entities.xmlback into the modified site XML backup file - Start the production instance
- Import the modified site XML backup from
>General Configuration > Backup & Restore. If you have any problems, revert to the original unmodified back up and redo the links manually instead
How To Create Folder In Confluence Space
Source: https://starview.app/r/jeg9c5stpb/https://confluence.atlassian.com/confkb/how-to-copy-or-rename-a-space-in-confluence-169578.html
Posted by: wilkeswhoundle.blogspot.com

0 Response to "How To Create Folder In Confluence Space"
Post a Comment