This is a command line tool to convert the contents of a Dokuwiki into a MediaWiki import data format.
- PHP >= 8.2 with the
xml
extension must be installed pandoc
>= 3.1.6. Thepandoc
tool must be installed and available in thePATH
(https://pandoc.org/installing.html).
- Download
migrate-dokuwiki.phar
from https://github.com/hallowelt/migrate-dokuwiki/releases/latest/download/migrate-dokuwiki.phar - Make sure the file is executable. E.g. by running
chmod +x migrate-dokuwiki.phar
- Move
migrate-dokuwiki.phar
to/usr/local/bin/migrate-dokuwiki
(or somewhere else in thePATH
)
- Create a directory for the migration (e.g.
/tmp/migration/workspace/
). - Create a directory for the migration (e.g.
/tmp/migration/workspace/input
). - Copy the
data
directory from dokuwiki to/tmp/migration/workspace/input
. - Remove unused directories before copying. Only
attic
,media
,media-attic
,media-meta
,meta
,pages
, can be used for migration.attic
andmedia-attic
contain older versions and are not required for migration. - If attic versions should be migrated all archived versions have to be extracted (e.g.
find . -name "*.gz" -exec gunzip {} \;
on linux systems).
- Create the "workspace" directory (e.g.
/tmp/migration/workspace/
) - From the parent directory (e.g.
/tmp/migration/
), run the migration commands- Run
migrate-dokuwiki analyze --src input/ --dest workspace/
to create "working files". After the script has run you can check those files and maybe apply changes if required (e.g. when applying structural changes). - Run
migrate-dokuwiki extract --src input/ --dest workspace/
to extract all contents, like wikipage contents, attachments and images into the workspace - Run
migrate-dokuwiki convert --src workspace/ --dest workspace/
(yes,--src workspace/
) to convert the wikipage contents from Confluence Storage XML to MediaWiki WikiText - Run
migrate-dokuwiki compose --src workspace/ --dest workspace/
(yes,--src workspace/
) to create importable data
- Run
If you re-run the scripts you will need to clean up the "workspace" directory!
- Copy the diretory "workspace/result" directory (e.g.
/tmp/migration/workspace/result/
) to your target wiki server (e.g./tmp/result
) - Go to your MediaWiki installation directory
- Make sure you have the target namespaces set up properly. See
workspace/namespaces-map.php
for reference. - Make sure $wgFileExtensions is setup properly. See
workspace/result/images
for reference. - Move the
workspace/result
directory to your MediaWiki server (e.g./tmp
). - Use
php maintenance/importImages.php /tmp/result/images/
to first import all attachment files and images - Use
php maintenance/importDump.php /tmp/result/output.xml
to import the actual pages
You may need to update your MediaWiki search index afterwards.