Importing a confluence xmp export, issues with namespaces

Describe the issue / Steps to reproduce:
full xml export of a confluence space
installed bluespice via zip on my host, and added following things in my Localesettings.php

$wgShowExceptionDetails = true;
$wgFileExtensions = [ 'png', 'gif', 'jpg', 'jpeg', 'webp','svg', 'unknown', ];
// Define constants for my additional namespaces.
//
//
// Define constants for my additional namespaces.
define("NS_DS", 2185756678); // This MUST be even.
define("NS_DS_TALK", 2185756679); // This MUST be the following odd integer.

// Add namespaces.
$wgExtraNamespaces[NS_DS] = "Demospace";
$wgExtraNamespaces[NS_DS_TALK] = "Demospace_talk"; // Note underscores in the namespace name.

I unzipped my xml dump, used the confluence migration tool and got this output:


Box Requirements Checker
========================

> Using PHP 8.2.27
> PHP is using the following php.ini file:
  /etc/php/8.2/cli/php.ini

> Checking Box requirements:
  ✔ The package "psr/log" requires a version matching ">=5.3.0".
  ✔ The package "symfony/console" requires a version matching "^5.5.9|>=7.0.8".
  ✔ The package "symfony/debug" requires a version matching ">=7.1.3".
  ✔ The package "symfony/polyfill-ctype" requires a version matching ">=7.2".
  ✔ The package "symfony/polyfill-mbstring" requires a version matching ">=7.2".
  ✔ The package "symfony/yaml" requires a version matching ">=7.1.3".
  ✔ The application requires the extension "dom".
  
                                                                                                                                                                                                                   
 [OK] Your system is ready to run the application.                                                                                                                                                                 
                                                                                                                                                                                                                   

Source: /tmp/confluence/input
Destination: /tmp/confluence/workspace

Fetching file list ...done.

Finding users
- 'Max...

Finding namespaces
- DS (ID:2185756677)

Finding space details
- DS

Finding SpaceDescription body id's
- 2185756678

Finding pages
- 'DS:Seite_2' (ID:2445934598)
- 'DS:Seite_1' (ID:2445312012)
- 'DS:Main_Page' (ID:2185756750)

Finding attachments
- 'DS_netmgr.png'
- 'DS_WhatsApp_Image_2024-12-18_at_10.23.37.jpeg'
- 'DS_DS.unknown'
Done.

  • when looking for a example page in my demo namespace, I cant find it, even after I created it a few seconds ago.

  • thumbnail of png wont render

  • Do I need to change the ID of the demo namespace to a even number, like I did in the first code block, or is that not necessary?

  • What manual steps are required to do first, before importing works?

  • Do i just have to define the namespace in the Localsettings.php and then import or do I have to manually create the namespace via the Namespacemanager?

im literally clueless


<?php
return array (
  2185756677 =>
  array (
    'id' => 2185756677,
    'key' => 'DS',
    'name' => 'Demo Space',
    'creationDate' => '2024-07-10 11:27:00.301',
    'lastModificationDate' => '2024-07-10 11:27:00.301',
    'spaceType' => 'global',
    'spaceStatus' => 'CURRENT',
    'description' => 2185756676,
    'homePage' => 2185756750,
    'creator' => '8a7f808a7e787e81017e7bb91c47019e',
    'lastModifier' => '8a7f808a7e787e81017e7bb91c47019e',
  ),
);

  • also the namespaces dont show in the sidebar, how can I change that?

  • also all pages on the bottom of the wiki live data privarcy, impressium, about etc. are also empty, what could be the issue?

What was the error message/error log?

PHP Deprecated:  ParserOutput::mCategories public read access deprecated [Called from MediaWiki\Extension\DynamicPageList3\Hooks::endReset in /var/www/bluespice/w/extensions/DynamicPageList3/includes/Hooks.php at line 559] in /var/www/bluespice/w/includes/debug/MWDebug.php on line 381
PHP Deprecated:  MediaWiki\Extension\NotifyMe\MediaWiki\Content\MailTemplate overrides fillParserOutput which was deprecated in MediaWiki 1.38. [Called from MediaWiki\Content\Renderer\ContentRenderer::getParserOutput in /var/www/bluespice/w/includes/content/Renderer/ContentRenderer.php at line 47] in /var/www/bluespice/w/includes/debug/MWDebug.php on line 381
PHP Deprecated:  Use of AbstractContent::getParserOutput was deprecated in MediaWiki 1.38. [Called from ContentHandler::callDeprecatedContentGPO in /var/www/bluespice/w/includes/content/ContentHandler.php at line 1878] in /var/www/bluespice/w/includes/debug/MWDebug.php on line 381
[2025-02-09T23:22:34.161418+01:00] error.ERROR: [115ef0e0bf7b031cf32af728] [no req]   PHP Warning: Array to string conversion {"exception":"[object] (ErrorException(code: 0): PHP Warning: Array to string conversion at /var/www/bluespice/w/includes/TemplateParser.php(171) : eval()'d code:32)","exception_url":"[no req]","reqId":"115ef0e0bf7b031cf32af728","caught_by":"mwe_handler"} {"host":"mri-05.test.aspicon.lan","wiki":"bluespice","mwversion":"1.39.11","reqId":"115ef0e0bf7b031cf32af728","cli_argv":"maintenance/rebuildall.php"}
[2025-02-09T23:22:34.162950+01:00] error-json.ERROR: {"id":"115ef0e0bf7b031cf32af728","type":"ErrorException","file":"/var/www/bluespice/w/includes/TemplateParser.php(171) : eval()'d code","line":32,"message":"PHP Warning: Array to string conversion","code":0,"url":null,"caught_by":"mwe_handler","backtrace":[{"file":"/var/www/bluespice/w/includes/TemplateParser.php(171) : eval()'d code","line":32,"function":"handleError","class":"MWExceptionHandler","type":"::"},{"file":"/var/www/bluespice/w/includes/TemplateParser.php","line":291,"function":"{closure}","class":"TemplateParser","type":"->"},{"file":"/var/www/bluespice/w/extensions/NotifyMe/src/Channel/Email/MailContentProvider.php","line":109,"function":"processTemplate","class":"TemplateParser","type":"->"},{"file":"/var/www/bluespice/w/extensions/NotifyMe/src/MediaWiki/Content/MailTemplate.php","line":79,"function":"getHtmlFromData","class":"MediaWiki\\Extension\\NotifyMe\\Channel\\Email\\MailContentProvider","type":"->"},{"file":"/var/www/bluespice/w/includes/content/AbstractContent.php","line":590,"function":"fillParserOutput","class":"MediaWiki\\Extension\\NotifyMe\\MediaWiki\\Content\\MailTemplate","type":"->"},{"file":"/var/www/bluespice/w/includes/content/ContentHandler.php","line":1878,"function":"getParserOutput","class":"AbstractContent","type":"->"},{"file":"/var/www/bluespice/w/includes/content/ContentHandler.php","line":1698,"function":"callDeprecatedContentGPO","class":"ContentHandler","type":"->"},{"file":"/var/www/bluespice/w/includes/content/Renderer/ContentRenderer.php","line":47,"function":"getParserOutput","class":"ContentHandler","type":"->"},{"file":"/var/www/bluespice/w/includes/Revision/RenderedRevision.php","line":265,"function":"getParserOutput","class":"MediaWiki\\Content\\Renderer\\ContentRenderer","type":"->"},{"file":"/var/www/bluespice/w/includes/Revision/RenderedRevision.php","line":237,"function":"getSlotParserOutputUncached","class":"MediaWiki\\Revision\\RenderedRevision","type":"->"},{"file":"/var/www/bluespice/w/includes/Revision/RevisionRenderer.php","line":236,"function":"getSlotParserOutput","class":"MediaWiki\\Revision\\RenderedRevision","type":"->"},{"file":"/var/www/bluespice/w/includes/Revision/RevisionRenderer.php","line":158,"function":"combineSlotOutput","class":"MediaWiki\\Revision\\RevisionRenderer","type":"->"},{"function":"MediaWiki\\Revision\\{closure}","class":"MediaWiki\\Revision\\RevisionRenderer","type":"->"},{"file":"/var/www/bluespice/w/includes/Revision/RenderedRevision.php","line":199,"function":"call_user_func"},{"file":"/var/www/bluespice/w/includes/Storage/DerivedPageDataUpdater.php","line":1438,"function":"getRevisionParserOutput","class":"MediaWiki\\Revision\\RenderedRevision","type":"->"},{"file":"/var/www/bluespice/w/includes/Storage/DerivedPageDataUpdater.php","line":1470,"function":"getCanonicalParserOutput","class":"MediaWiki\\Storage\\DerivedPageDataUpdater","type":"->"},{"file":"/var/www/bluespice/w/includes/deferred/RefreshSecondaryDataUpdate.php","line":85,"function":"getSecondaryDataUpdates","class":"MediaWiki\\Storage\\DerivedPageDataUpdater","type":"->"},{"file":"/var/www/bluespice/w/includes/deferred/DeferredUpdates.php","line":474,"function":"doUpdate","class":"RefreshSecondaryDataUpdate","type":"->"},{"file":"/var/www/bluespice/w/includes/deferred/DeferredUpdates.php","line":399,"function":"attemptUpdate","class":"DeferredUpdates","type":"::"},{"file":"/var/www/bluespice/w/includes/deferred/DeferredUpdates.php","line":214,"function":"run","class":"DeferredUpdates","type":"::"},{"file":"/var/www/bluespice/w/includes/deferred/DeferredUpdatesScope.php","line":264,"function":"{closure}","class":"DeferredUpdates","type":"::"},{"file":"/var/www/bluespice/w/includes/deferred/DeferredUpdatesScope.php","line":196,"function":"processStageQueue","class":"DeferredUpdatesScope","type":"->"},{"file":"/var/www/bluespice/w/includes/deferred/DeferredUpdates.php","line":206,"function":"processUpdates","class":"DeferredUpdatesScope","type":"->"},{"file":"/var/www/bluespice/w/includes/deferred/DeferredUpdates.php","line":281,"function":"doUpdates","class":"DeferredUpdates","type":"::"},{"file":"/var/www/bluespice/w/includes/deferred/DeferredUpdates.php","line":134,"function":"tryOpportunisticExecute","class":"DeferredUpdates","type":"::"},{"file":"/var/www/bluespice/w/includes/Storage/DerivedPageDataUpdater.php","line":1803,"function":"addUpdate","class":"DeferredUpdates","type":"::"},{"file":"/var/www/bluespice/w/includes/page/WikiPage.php","line":2136,"function":"doSecondaryDataUpdates","class":"MediaWiki\\Storage\\DerivedPageDataUpdater","type":"->"},{"file":"/var/www/bluespice/w/maintenance/refreshLinks.php","line":280,"function":"doSecondaryDataUpdates","class":"WikiPage","type":"->"},{"file":"/var/www/bluespice/w/maintenance/refreshLinks.php","line":203,"function":"fixLinksFromArticle","class":"RefreshLinks","type":"::"},{"file":"/var/www/bluespice/w/maintenance/refreshLinks.php","line":87,"function":"doRefreshLinks","class":"RefreshLinks","type":"->"},{"file":"/var/www/bluespice/w/maintenance/rebuildall.php","line":60,"function":"execute","class":"RefreshLinks","type":"->"},{"file":"/var/www/bluespice/w/maintenance/includes/MaintenanceRunner.php","line":309,"function":"execute","class":"RebuildAll","type":"->"},{"file":"/var/www/bluespice/w/maintenance/doMaintenance.php","line":85,"function":"run","class":"MediaWiki\\Maintenance\\MaintenanceRunner","type":"->"},{"file":"/var/www/bluespice/w/maintenance/rebuildall.php","line":67,"args":["string"],"function":"require_once"}]} {"private":true} []
PHP Warning:  Array to string conversion in /var/www/bluespice/w/includes/TemplateParser.php(171) : eval()'d code on line 32
Deleting illegal entries from the links tables...

Screenshots

  • Expected behavior:
    that the namespace is imported right, and the pages are visible in the namespace mainpage, and im able to find the Namespace via the search bar

System info:

  • OS: [ubuntu 20.04]
  • Server: [e.g. Apache 2.4.41]
  • PHP: [8.2.27]
  • Database:[10.3.39-MariaDB-0ubuntu0.20.04.2]
  • BlueSpice version: [free 4.5.4 deployed via zip]
  • Browser version: [chromium 133.0.6943.53 ]

edit: I would also add more pictures to this question, for better understanding, can you unlock this function for me?

Hello and welcome to the BlueSpice community forums!

  1. Regarding the LocalSettings.php: I recommend using the “NamespaceManager” and “ConfigManager” interfaces in BlueSpice itself, rather than changing the LocalSettings.php file. Also, make sure you name the namespace “DS”, not “Demospace” (see page name “DS:Seite_2” from the migration tool output). The namespace must exists before importing the migration result.
  2. The error messages during the installations may be caused by the PHP version. BlueSpice 4.5 is not fully compatible to PHP 8.2, but only to 8.1. This is most likely also the reason for missing contents after installation
    Consider installing BlueSpice via docker (GitHub - hallowelt/bluespice-deploy: Easy setup and deployment of BlueSpice MediaWiki) or downgrading the PHP version. Upcoming BlueSpice 5 will be compatible to PHP 8.2+.
  3. Be aware that migrate-confluence only creates a XML and a folder with images. You will need to manually import them into the wiki. See Migrate the contents and Import into MediaWiki

Hello, thanks for your answer, I purged my previous installation and created a new one only with default settings and without any extensions like opensearch.

This is my current LocalSettings.php to define my namespace:

define("NS_DS", 2185756680); // This MUST be even.
define("NS_DS_TALK", 2185756679); // This MUST be the following odd integer.


$wgExtraNamespaces[NS_DS] = "Demospace";
$wgExtraNamespaces[NS_DS_TALK] = "Demospace_talk";


$wgContentNamespaces[] = 2185756680; 
$wgNamespacesWithSubpages[2185756680] = true;
$wgNamespaceAliases['DS'] = 2185756680;

am I able to define the ID of the namespace with the NamespaceManger or Configmanager, or do I create it via the namespacemanager and modify it in the LocalSettings.php?

so confluence gave me the “ds” after exporting the demospace, can I just edit the file name, and the migration tool will use the new name?
“Confluence-export-space-ds.zip” →
“Confluence-export-space-demospace.zip”

or where can I change the namespace name beforce importing?

so after correcting the namespace name in the LocalSettings.php “Demospace” → “DS”, the import should work?

edit: which maintenance jobs excluding “rebuildrecentchanges” and “initSiteStats” are required, so all changes after importing the xml dump are applied?

If I do not create namespaces and run the importDump, the pages are created without any problems. If I now create the namespace and move the pages into the namespace, the pages appear with full content.

If I do it like in the Github migration tool documentation and first define the namespace name “DS” that Confluence gave me, with the ID 2185756680, and then run the importDump, the imported pages are now displayed as empty, as if they had not been created.

I also uploaded my documentation, where I documented every step, maybe you guys can find any errors:

few questions aside:

So the ID and the name of the namespace in the workspace files have to be the same as configured in the namespacemanager?

I tried to configure Buttons via common.css to show the namespaces as buttons on the wiki main page, but the CSS wouldnt work, are there any requirements for the CSS to work aside the configuration in the common.css?

Is there a way to prevent that the migration-tool generates uneven ID Integer for my namespace?

Is it best-practice to create a namespace via the namespacemanager, copy the ID and paste this “admin namespace ID like (3000)” into the files of the workspace folder before doing the migrate-tools extract command?

Is it different to my previous attempts, to just use the ID from the confluence dump like 2185756677, and change the ID of the namespace in the localsettings.php via the define and then doing the import?

define("NS_DS", 2185756680); // This MUST be even.
define("NS_DS_TALK", 2185756679); // This MUST be the following odd integer.


$wgExtraNamespaces[NS_DS] = "DS";
$wgExtraNamespaces[NS_DS_TALK] = "DS_Talk";


$wgContentNamespaces[] = 2185756680; 
$wgNamespacesWithSubpages[2185756680] = true;
#wgNamespaceAliases['DS'] = 2185756680;

Feels like the way mentioned above with using the ID provided by the namespacemanager (3000) seems better, and maybe that’s the way you had in mind when you wrote the migrate-confluence tool, but unfortunately I didn’t find it anywhere in the documentation.

this was the right way, of creating the namespace via namespacemanager, using the generated ID to overwrite the confluence ID, and now the assignment of the pages to the namespace is right after doing a importDump


sed -i 's/2185756677/3000/g' ./space-id-details-map.php
sed -i 's/2185756677/3000/g' ./page-id-to-space-id.php
sed -i 's/2185756677/3000/g' ./filenames-to-filetitles-map.php
sed -i 's/2185756677/3000/g' ./pages-titles-map.php
sed -i 's/2185756677/3000/g' ./space-id-to-prefix-map.php
sed -i 's/2185756677/3000/g' ./space-id-homepages.php
sed -i 's/2185756677/3000/g' ./space-id-to-description-id-map.php


root@xy:/tmp/confluence/workspace# grep -rnH "2185756677" . 
./space-id-to-prefix-map.php:4:  2185756677 => 'DS',
./space-id-details-map.php:4:  2185756677 => 
./space-id-details-map.php:6:    'id' => 2185756677,
./page-id-to-space-id.php:4:  2445934598 => 2185756677,
./page-id-to-space-id.php:5:  2445312012 => 2185756677,
./page-id-to-space-id.php:6:  2185756750 => 2185756677,
./pages-titles-map.php:4:  '2185756677---Seite_2' => 'DS:Seite_2',
./pages-titles-map.php:5:  '2185756677---Seite_1' => 'DS:Seite_1',
./pages-titles-map.php:6:  '2185756677---Demo_Space_Startseite' => 'DS:Main_Page',
./space-id-to-description-id-map.php:4:  2185756677 => 2185756676,
./filenames-to-filetitles-map.php:4:  '2185756677---Seite_2---iwishtounderstand.png' => 'DS_Seite_2iwishtounderstand.png',
./filenames-to-filetitles-map.php:5:  '2185756677---Seite_1---rate_(1).png' => 'DS_Seite_1rate_(1).png',
./filenames-to-filetitles-map.php:6:  '2185756677---Demo_Space_Startseite---rate_(1).png' => 'DS_Seite_1rate_(1).png',
./filenames-to-filetitles-map.php:7:  '2185756677---Demo_Space_Startseite---iwishtounderstand.png' => 'DS_Seite_2iwishtounderstand.png',
./filenames-to-filetitles-map.php:8:  '2185756677---Demo_Space_Startseite---netmgr.png' => 'DS_netmgr.png',
./filenames-to-filetitles-map.php:9:  '2185756677---Demo_Space_Startseite---WhatsApp_Image_2024-12-18_at_10.23.37.jpeg' => 'DS_WhatsApp_Image_2024-12-18_at_10.23.37.jpeg',
./filenames-to-filetitles-map.php:10:  '2185756677---Demo_Space_Startseite---DS' => 'DS_DS.unknown',
./space-id-homepages.php:4:  2185756677 => 2185756750,

root@xy:/tmp/confluence/workspace# sed -i 's/2185756677/3000/g' ./space-id-details-map.php
sed -i 's/2185756677/3000/g' ./page-id-to-space-id.php
sed -i 's/2185756677/3000/g' ./filenames-to-filetitles-map.php
sed -i 's/2185756677/3000/g' ./pages-titles-map.php
sed -i 's/2185756677/3000/g' ./space-id-to-prefix-map.php
sed -i 's/2185756677/3000/g' ./space-id-homepages.php
sed -i 's/2185756677/3000/g' ./space-id-to-description-id-map.php

root@xy:/tmp/confluence/workspace# grep -rnH "2185756677" . 

root@xy:/tmp/confluence/workspace# grep -rnH "3000" . 
./space-id-to-prefix-map.php:4:  3000 => 'DS',
./space-id-details-map.php:4:  3000 => 
./space-id-details-map.php:6:    'id' => 3000,
./page-id-to-space-id.php:4:  2445934598 => 3000,
./page-id-to-space-id.php:5:  2445312012 => 3000,
./page-id-to-space-id.php:6:  2185756750 => 3000,
./pages-titles-map.php:4:  '3000---Seite_2' => 'DS:Seite_2',
./pages-titles-map.php:5:  '3000---Seite_1' => 'DS:Seite_1',
./pages-titles-map.php:6:  '3000---Demo_Space_Startseite' => 'DS:Main_Page',
./space-id-to-description-id-map.php:4:  3000 => 2185756676,
./filenames-to-filetitles-map.php:4:  '3000---Seite_2---iwishtounderstand.png' => 'DS_Seite_2iwishtounderstand.png',
./filenames-to-filetitles-map.php:5:  '3000---Seite_1---rate_(1).png' => 'DS_Seite_1rate_(1).png',
./filenames-to-filetitles-map.php:6:  '3000---Demo_Space_Startseite---rate_(1).png' => 'DS_Seite_1rate_(1).png',
./filenames-to-filetitles-map.php:7:  '3000---Demo_Space_Startseite---iwishtounderstand.png' => 'DS_Seite_2iwishtounderstand.png',
./filenames-to-filetitles-map.php:8:  '3000---Demo_Space_Startseite---netmgr.png' => 'DS_netmgr.png',
./filenames-to-filetitles-map.php:9:  '3000---Demo_Space_Startseite---WhatsApp_Image_2024-12-18_at_10.23.37.jpeg' => 'DS_WhatsApp_Image_2024-12-18_at_10.23.37.jpeg',
./filenames-to-filetitles-map.php:10:  '3000---Demo_Space_Startseite---DS' => 'DS_DS.unknown',
./space-id-homepages.php:4:  3000 => 2185756750,

importImages ...
ImportDump ...


after replacing both with sed (namespace ID and name after analyze) to the name and ID provided by the NameSpaceManager, the import works flawlessly

root@xy:/tmp/confluence/workspace# sed -i 's/2185756677/3002/g' ./*
root@xy:/tmp/confluence/workspace# sed -i 's/DS/Test/g' ./*

Interesting. Thanks for sharing the solution!

Just a couple of remarks:

  1. 2185756680 is the Confluence internal Space-ID
  2. It is usually not used in the migration result (workspace/result/output.xml) at all. And therefore it does not affect the import. Only the associated namespace prefix (in this case DS, which is also the Confluence Space-Key) is used in the resulting XML. We use this, because it usually works well with MediaWiki namespace prefixes.
  3. Using 2185756680 as a MediaWiki namespace ID will most likely cause troubles. While PHP supports integers up to 9223372036854775807 on 64bit architectures, MySQL only supports up to 2147483647 [2] (as the field is “signed” [3]). MediaWiki itself only expects up to 10000 [4].

[1] PHP: Predefined Constants - Manual
[2] https://dev.mysql.com/doc/refman/8.4/en/integer-types.html
[3] mediawiki/maintenance/tables-generated.sql at 1.43.0 · wikimedia/mediawiki · GitHub
[4] Manual:page table - MediaWiki