Table of Contents
- What does it handle?
- Attachments
- How do I prepare my mediawiki pages for import?
- What about the mediawiki special page: export pages?
- The exporter
- What if I don't agree with a particular conversion? Is it customizable?
- Conversion notes
- Planned Future improvements
- Other options - Intient's MediaWiki to Confluence
What does it handle?
- some syntax
- tables (somewhat lossy)
- attachments
See the attached sample input for what syntaxes have been covered. In summary:
- Bold
- Italics
- Monospace
- No formatting
- Links
- with aliases
- with anchors
- with namespaces are handled in various ways:
- with the Image namespace, handled as an image
- with the Category namespace, the link syntax is stripped out. (Would the appropriate equivalent be labels?)
- with other namespaces, the syntax is essentially negated. Ex: Help:Editing becomes Help__Editing
- Why? Several reasons: Mediawiki namespaces are not the same thing as Confluence spaces, so a namespace to space translation would not have the desired effect; the 'namespace:' syntax can also mean interwiki linking which I'm not ready to contemplate; the __ syntax will work with the mediawiki exporter module. Comments on desired use cases for this issue would be helpful for future improvements.
- Headings
- Bulleted Lists
- Numbered Lists
- <pre>, <code>, and Leading Spaces syntax
- Table of Contents, (tested with the Table of Contents macro version 1.4.7)
- Indenting colons syntax is stripped out (No Confluence equivalent)
- Images (very basic syntax)
- Very simple tables. Complex ones with rowspans, colspans, inner tables, or styles, will be converted as closely as possible, but there will be some loss.
Attachments
Point the UWC Settings Attachment Directory to the Mediawiki images directory you are using. This will probably be [Mediawiki-dir]/images
Note: It will need to be on a local filesystem. The mediawiki converter doesn't know how to access images over the net.
How do I prepare my mediawiki pages for import?
Use the exporter.
If you don't want to export your entire wiki, then you'll need to create individual text files for each page. Filename should be the page name, and file contents should be mediawiki syntax.
What about the mediawiki special page: export pages?
Mediawiki's export pages feature creates one xml file for all the desired exportable pages. We're not prepared to handle that at this time, so it's not terribly useful, unless you want to parse XML.
The exporter
Use the exporter to create a directory of data from your old wiki that can best be used by the UWC. See GUI v3 Exporter for more info on the exporter.
To use the exporter
You will first need to
- Configure the conf/exporter.mediawiki.properties file
Configuring the exporter.mediawiki.properties file
You must configure the exporter.mediawiki.properties file, in order for the exporter to work.
It is located in the conf directory of the UWC.
The available properties are as such:
| Property | Required | Example | Description |
|---|---|---|---|
| exporter.class | |
com.atlassian.uwc.exporters.MediaWikiExporter | Leave this alone, unless you want a different class to run the export |
| databaseName | |
myMediawikiDatabase | This is the name of the mediawiki database you are using. You can find out what this is by opening the Mediawiki LocalSettings.php file, and looking at the value of $wgDBname |
| dbUrl | |
jdbc:mysql://localhost:3306 | This is the JDBC connection url. It should follow the format jdbc:databasebrand://hostname:port, or some variant. |
| jdbc.driver.class | |
com.mysql.jdbc.Driver | This is the JDBC driver class. If your Mediawiki uses a different database than MySQL, you will need to change this property to the appropriate driver class, get the associated driver JAR, and place that JAR in the lib directory. (The MySQL driver jar is provided already.) |
| login | |
mylogin | Your login for the Mediawiki database. See mediawiki LocalSettings.php $wgDBuser |
| password | |
mypassword | Your password for the Mediawiki database. See mediawiki LocalSettings.php $wgDBpassword |
| output | |
/Users/My/Desktop | This is the output directory that the export will be sent to. This needs to be a valid directory. |
| dbPrefix | |
mw_ | This is the table prefix. See LocalSettings.php $wgDBprefix |
| Optional SQL Properties - For any of the sql properties to work, they must all be set and non-empty | |||
| db.sql.pagedata | |
select page_id, page_namespace, page_title, page_latest from mw_page; | This SQL will grab all the interesting pages |
| db.sql.textdata | |
select old_text from mw_text where old_id = ( select rev_text_id from mw_revision where rev_id = "db.column.textid" ); | This SQL will grab the text for each result of the pagedata SQL. You can use any of the column properties as variables. |
| db.column.title | |
page_title | This is the column name for the title of a page |
| db.column.namespace | |
page_namespace | This is the column name for the namespace of a page |
| db.column.pageid | |
page_id | This is the column name for the page id |
| db.column.textid | |
page_latest | This is the column name for the revision id. It will be used to get the text. |
| db.column.text | |
old_text | This is the column name for the text. |
Please note:
- Pages will be exported to the directory output/exported_mediawiki_pages where output is defined in the exporter.mediawiki.properties file.
- Pages from the namespace Special will not be exported
- Pages will be organized by the standard mediawiki namespace they belong to. (Example: Discussions, Users, Images, etc.). Exception: The "Main"/default namespace becomes the "Pages" directory.
- Pages from any of the standard Discussion namespaces will have the word Discussion appended to the page title so they do not overwrite the associated article on import.
- Pages with a non-standard namespace, will be renamed. (example, Test:Testing becomes Test__Testing)
- Pages containing 'bad' characters (like / or backslash), will be renamed (example, Bad/Character becomes Bad_Character)
- If your mediawiki is not using Mysql, you will need to provide the JDBC driver for your database. (See Configuring the exporter.mediawiki.properties file)
- If your mediawiki is not using Mysql, you may need to use the Optional SQL Properties.
- The exporter is compatible with Mediawiki 1.7.1. This should mean that it works as far back as 1.5. If you need to use it with an earlier Mediawiki, you will need to use the Optional SQL Properties.
Optional SQL Properties
If you disagree with the way the exporter pulls out the data from the database, you can customize the SQL statements that will be used.
There are seven properties that must be set if they are to be used:
db.sql.pagedata, db.sql.textdata, db.column.pageid, db.column.title, db.column.namespace, db.column.textid, db.column.text
The pagedata SQL will be used to slurp up all of the pages you are exporting.
The textdata SQL will be used to grab the text for each page that was returned as a result of pagedata. (So pagedata will be run once, and textdata will be run for every result of pagedata).
The column properties describe the name of the column that refers to a particular piece of data. These can be used in the textdata SQL. For example:
db.sql.textdata=select old_text from mw_text where old_id = ( select rev_text_id from mw_revision where rev_id = "db.column.textid" );
What if I don't agree with a particular conversion? Is it customizable?
As long as you don't mind getting your hands dirty. ![]()
So, if you want to change how the converter converts you have a couple of options.
Leave out some converters.
On the Select Converters page, the list of conversion engines that are auto-loaded based on the wiki you've chosen (from the Choose Wiki Type page) can be modified. You can remove some. You don't want the _TOC_ syntax to get changed to the Table of Contents macro? Just remove the converter with the words 'toc' in it.
Modify or even add your own converters
The mediawiki converters are defined in the file /conf/converter.mediawiki.properties
Please see the UWC Developer Documentation for more information.
Conversion notes
Headers
So, in Mediawiki, headers are defined as follows:
== Header 1== === Header 2=== ==== Header 3==== etc.
Therefore, they are translated to:
- h1. Header 1 - h2. Header 2 - h3. Header 3
But what about
=Header=
?
That last is discouraged syntax, but it is legal. It essentially corresponds with the style for the title of the page. So, if it's there what should we do with it? Choices include ignoring it or translating it to Confluence
h1.
syntax.
I chose the latter. This means that both
=title= ==Header 1==
are translated to
- h1. title - h1. Header 1
| Header Conversion Customization If you don't want the =title= to be converted, edit the converter.mediawiki.properties file, and comment out the line containing the words: |
Code, Pre and Leading Spaces
In Mediawiki there are a variety of ways to say: Just show what I typed
- <nowiki>
- <pre>
- <code>
- Leading Spaces (starting a line with a space)
<nowiki> gets translated to {noformat}
<pre> gets translated to {code}
<code> get translated to {code}
Leading spaces get translated to {panel}
| Code, Pre, and Leading Spaces Conversion Customization If you want to change these, the converters you are interested in are : |
Planned Future improvements
- more syntax handling (including definition lists, more complicated image syntax, more complicated table syntax)
Other options - Intient's MediaWiki to Confluence
MediaWiki users have another good option to explore which is
the MediaWiki to Confluence converter from Intient.

Comments (38)
Oct 09, 2006
Alain Moran says:
have you thought about using the content formatting table, tr/tablerow, td/table...have you thought about using the content formatting table, tr/table-row, td/table-cell macros for those cases where you have colspans & rowspans or styles?
Oct 11, 2006
Laura Kolker says:
I'll definitely keep that in mind if I continue to refine the tables conversion....I'll definitely keep that in mind if I continue to refine the tables conversion. Thanks.
Oct 11, 2006
John Pettersson says:
Which version(s) of MediaWiki is supported by the Exporter? I have tried with ou...Which version(s) of MediaWiki is supported by the Exporter? I have tried with our 1.4.12 and the exporter fails.
Oct 11, 2006
Laura Kolker says:
Good question. I developed it with 1.7.1. I haven't tested it against 1.4.12. I...Good question. I developed it with 1.7.1.
I haven't tested it against 1.4.12. I'll see what I can do about that. Can you give me any more info about what didn't work? Any Java Exceptions that went to the command line?
Just so you know, I just updated the Exporter about an hour ago, with a few changes. You might want to consider getting a more recent copy, just in case that's the problem.
Also, I realize I only just documented how to configure the exporter, but a misconfiguration would also cause the exporter to fail.
Thanks.
Jan 31, 2007
Laura Kolker says:
Update: The exporter is compatible with Mediawiki 1.7.1. This should mean that i...Update:
The exporter is compatible with Mediawiki 1.7.1. This should mean that it works as far back as 1.5. If you need to use it with an earlier Mediawiki, you will need to use the Optional SQL Properties.
Mar 30, 2007
hormemrk says:
I just converted a MediaWiki site to Confluence using UWC. It worked as expected...I just converted a MediaWiki site to Confluence using UWC. It worked as expected except for the bulleted lists. In Mediawiki it's legal to just put:
*stuff
*more stuff
a * followed by the text with no space in between. That's what almost _all_ of our users are doing these days.
Basically I need to add a space after all * or ** or *** etc that are the first character in a line. Is there an easy way to fix it?
Mar 30, 2007
Laura Kolker says:
Hi hormemrk, The quickest thing for you to do is to add a converter to conf/co...Hi hormemrk,
The quickest thing for you to do is to add a converter to
conf/converters.mediawiki.properties
Here's some doc on that:
http://confluence.atlassian.com/display/CONFEXT/UWC+Developer+Documentation
I've created a JIRA issue for the syntax:
http://developer.atlassian.com/jira/browse/UWC-80
It looks like this might be pretty trivial, so I might be able to get to it today. If I'm wrong and it's a big issue, I won't be able to get to it for some time, but you can watch the issue to see it's progress.
Cheers,
Laura
Mar 30, 2007
Laura Kolker says:
Just a quick update. It did turn out to be trivial. I've added these lines to t...Just a quick update. It did turn out to be trivial.
I've added these lines to the conf/converter.mediawiki.properties:
## Lists Mediawiki.0950-lists.java-regex=(^|\n)([*#]+)(\w)([^*\n]+)(?=\n){replace-with}$1$2 $3$4I'm not going to have time to release this today, so just add that to your conf/converter.mediawiki.properties after the Image handling
Cheers,
Laura
Apr 11, 2007
hormemrk says:
Laura, thanks a lot. That took care of most list items. However, if there's a li...Laura, thanks a lot. That took care of most list items. However, if there's a link or a macro at the beginning of the list item, it doesn't convert, e.g. *[http://mylink.here] or *makro:something
Apr 11, 2007
Laura Kolker says:
Hi hormemrk, I'm glad that helped. I've added a new issue for the syntax that's...Hi hormemrk,
I'm glad that helped. I've added a new issue for the syntax that's still not working. It's here:
http://developer.atlassian.com/jira/browse/UWC-92
Thanks for all your bug reports, I really do appreciate it. It's almost impossible to hit every syntax on a first cut, so these sorts of reports are invaluable for making the conversion really work for people.
Cheers!
Laura
Apr 12, 2007
Wyatt Wong says:
Hi, I'm trying to run the exporter from MediaWiki 1.4.5 (with a significantly di...Hi,
I'm trying to run the exporter from MediaWiki 1.4.5 (with a significantly different schema from 1.5+), and the code seems to have a bug in it after doing some digging. Please confirm?
File:
com/atlassian/uwc/exporters/MediaWikiExporter.java
at Line 379:
byte[] bytes2 = pagedata.getBytes(COL_TITLE); //get bytes, 'cause we might have unicode issues
should instead be:
byte[] bytes2 = pagedata.getBytes(titleColumn); //get bytes, 'cause we might have unicode issues
Please confirm, thanks!
-Wyatt
May 14, 2007
Vanessa Vandervalk says:
Hi, I'm trying out the converter on MediaWiki 1.8.4 (although the wiki we ultima...Hi,
I'm trying out the converter on MediaWiki 1.8.4 (although the wiki we ultimately want to convert is on 1.8.2).
For some reason, tables are not being converted, even though TableConverter is selected in the list of converters. I checked the export files and the tables are being exported, but they are totally missing from the converted files, except for an occasional pipe (|).
Could I get some help with this? We are interested in moving to Confluence, but we can't afford to lose data in converting to a new type of wiki.
Thanks!
May 14, 2007
Laura Kolker says:
Hi Vanessa, The Mediawiki converter should be able to handle tables, however it...Hi Vanessa,
The Mediawiki converter should be able to handle tables, however it's entirely possible that a particular syntax your wiki uses is not currently supported.
In order for me to help you, I need to know a little bit more about what's failing.
Can you do the following for me?
Create an issue here:
http://developer.atlassian.com/jira/browse/UWC
And include in that issue, information about the mediawiki syntax that isn't being converted.
Something like:
Mediawiki syntax:
{| |- |r1c1|r1c2 |}For more info on how to submit bug reports for the UWC, check out UWC Bug Reporting
Thanks
Laura
Jan 14, 2008
Steve Dantzer says:
Hi, We have many Categories defined and that was one of the valuable aspects of ...Hi,
We have many Categories defined and that was one of the valuable aspects of MediaWiki for us.
I see in the "What does it handle?" section above that Category is stripped out. Seems a conversion line in the converter file would solve it to convert to make them labels and achieve similar value.
For example.
[[Category:EAServer]] to {add-label:EAServer}
What would be the regex line in the converter file for doing this and would this work do you think?
Thanks,
Steve
Jan 15, 2008
Laura Kolker says:
Hi Steve, That seems like a reasonable approach. I'm not sure if you've done th...Hi Steve,
That seems like a reasonable approach.
I'm not sure if you've done this already, but if not, I'd suggest taking a look a the UWC Developer Documentation. In particular, you may find the anatomy of a Conversion properties file useful.
Off the top of my head, I would start by taking a close look at conf/converter.mediawiki.properties:
Mediawiki.0400-re_links_no_categories.java-regex=(?i)\[\[(category:[^\]]+)\]\]{replace-with}$1I think what you'll want to do is change the replace-with value from
to something like:
{add-label:$1}Haven't tested that, but that's where I'd start. The UWC has a regex testing utility embedded in it, for helping with that sort of testing, in case that's useful.
Let me know if there's anything else I can do to help.
Cheers,
Laura
Jan 16, 2008
Brendan Patterson says:
Steve, That's very interesting. I was not aware of that \ macro but just found ...Steve,
That's very interesting. I was not aware of that {add-label} macro but just found it at Adaptavist.
The regex would probably be something like this:
MediaWiki.000-categories.java-regex=\[\[Category:(.*)\]\]{replace-with}{add-label:$1}Laura thanks also for your response!!
Jan 18, 2008
Steve Dantzer says:
Hi, Thanks for your help. I had tried that same fix independently....Hi,
Thanks for your help.
I had tried that same fix independently. Here's the results:
In MediaWiki:
[[Category:PDSAPO4]] [[Category:APO booking report]] [[Category:Sales Order Admin & Finance]] [[Category:apoprod]][[Category:EAServer]]
Originally, the converter was doing this to the Categories:
Category:PDSAPO4 Category:APO booking report Category:Sales Order Admin & Finance Category:apoprodCategory:EAServer
With the change suggested, the result was:
{add-label:Category:PDSAPO4} {add-label:Category:APO booking report} {add-label:Category:Sales Order Admin & Finance} {add-label:Category:apoprod}{add-label:Category:EAServer}
Not perfect, but on the right track. The issue is the add-label macro is for Templates and Scaffolds and these are just pages (although at some point in the documentation it does mention 'pages'.). So I think I'll abandon this method. If there were another macro that could take a value and make it a label on a page, that would be cool, but I think labels are stored differently in the database (not just as 'tags'). I think for the conversion to work, some custom code would need to add it to the database, not the converted page.
Having the values for the Categories in the page is of some benefit even if it is not real 'meta-data'.
Feb 07
dean newport says:
I am exporting a small wiki, and so far so good except the images. My user had a...I am exporting a small wiki, and so far so good except the images. My user had a bunch of inline images(of the form...
[[Image:USAFDevelopmentProcess.jpg]]) and the exporter is creating them with the format .gif.txt and the page upload into confluence doesnt seem to do anything with them...any ideas?
Feb 08
Brendan Patterson says:
Hi Dean, Sounds like an enhancement needs to be made for that image probably on...Hi Dean,
Sounds like an enhancement needs to be made for that image - probably one to properly convert the text and one so that the mediawiki ImageConverter class recognizes that it needs to upload the file.
So just two files need the proper adjustments most likely: converter.mediawiki.properties and the class com/atlassian/uwc/converters/mediawiki/ImageConverter.java
Do you have a Java developer available who could make those changes?
If not we have enhancement pricing listed here
May 27
Judith Schmalz says:
Hello, \\ I want to convert a Media Wiki into Confluence. During the export of ...Hello,
I want to convert a Media Wiki into Confluence. During the export of the media wiki I get the following error message and the output directory is empty...
I set the following options in the exporter.mediawiki.properties:
I use the postgresql-8.3-603.jdbc3.jar as postgres driver.
What can be the reason for my problems?
I'm looking forward for any help, regards
Judith Schmalz
May 27
Laura Kolker says:
Hi Judith, So, what I'm seeing here is that the Postgres is failing on the SQL ...Hi Judith,
So, what I'm seeing here is that the Postgres is failing on the SQL for some reason. If you are (or know someone who is) comfortable with SQL, I would consider using some of the optional properties to tailor the SQL to your database's needs. This may take some experimentation. I would start by looking at the commented properties directly after dbPrefix. There's some doc, there but please feel free to send more questions my way.
Cheers,
Laura
Update: Accidentally updated before finishing comment. Oops. Adding the rest of it now.
Jun 16
Kelly He says:
Hi, I was trying to move the existing documents from mediawiki to confluence.&nb...Hi,
I was trying to move the existing documents from mediawiki to confluence. We are currently facing problems dealing with images and labels. Unfortunately, none of the images show up on the Confluence documents and there is no attacment on any of the pages. For lables, we are tying to transfer all the catagories to confluence as labels but Confluence is not reconizing a catagory as a label. Is there anything we can do to access the labels through the database and try to automatically tranform existing catagories to Confluence labels?
Thanks,
Kelly
Jun 16
Brendan Patterson says:
re labels: it is covered in the F.A.Q. at this linkre labels: it is covered in the F.A.Q. at this link
Jun 17
Laura Kolker says:
Hi Kelly, re: images Since I don't know what you've done yet, you're going to h...Hi Kelly,
re: images
Since I don't know what you've done yet, you're going to have to bear with me while I describe a bunch of things you may have already done.
Cheers,
Laura
Jun 17
Kelly He says:
Hi Laura, I did use the exporter and specified the directory. I was gettin...Hi Laura,
I did use the exporter and specified the directory. I was getting:
Converting Images - start
Converting Images - complete
Converting Mediawiki Attachments -- starting
no attachment files found in directory: http://devillage.ventyx.org/wiki/images
Looks like the program is not finding the images. Is there anything I can do to fix that?
Thank you very much for your help!
Cheers,
Kelly
Jun 17
Laura Kolker says:
Hi Kelly, no attachment files found in directory:Hi Kelly,
Yup. The attachments directory needs to be local directory from your file system.
Cheers,
Laura
Jun 16
Robert Manna says:
I'm trying to run the export on a media wiki, and I keep getting an error that s...I'm trying to run the export on a media wiki, and I keep getting an error that says the exporter cannot connect to the Mediawiki db. I've checked an re-checked the settings for username, password, etc and I don't see anything wrong. I'm not really an IT expert, can anyone point me in some direction?
Thanks,
-R
Jun 17
Laura Kolker says:
Hi Robert, So, on the plus side there aren't that many settings that could be g...Hi Robert,
So, on the plus side there aren't that many settings that could be going wrong.
On the downside, I can't tell you which one it is.
However, for the sake of thoroughness, since I did not hear you say them, I will list the following anyway:
Are you the DB admin or is there someone else who set up that database? If the latter, that person is best equipped to help you debug this. If this is a legacy system, and you don't know who set it up, well.... I would contact your particular database's support for ideas on how to get (or reset) these connection settings.
Cheers,
Laura
Jun 16
Robert Manna says:
Correction, it specifically says it is having trouble logging into the database....Correction, it specifically says it is having trouble logging into the database.
Thank you,
-Robert
Jun 17
Buelent Caliskan says:
I've got the errors and exceptions: XMLRPC & SOAP is enabled, i use Confluence w...I've got the errors and exceptions:
XML-RPC & SOAP is enabled, i use Confluence with JIRA Integration and MySQL.
2008-06-17 13:09:42,449 ERROR [Thread-2] - org.apache.xmlrpc.XmlRpcException: java.lang.Exception: RPC handler object "confluence1" not found and no default handler registered
org.apache.xmlrpc.XmlRpcException: java.lang.Exception: RPC handler object "confluence1" not found and no default handler registered
2008-06-17 13:09:42,518 ERROR [Thread-2] - Problem getting user permissions: login = 'admin' space = 'CC'
org.apache.xmlrpc.XmlRpcException: java.lang.Exception: RPC handler object "confluence1" not found and no default handler registered
org.apache.xmlrpc.XmlRpcClientException: Failure writing request
2008-06-17 13:09:42,886 ERROR [Thread-2] - **********************
Testing Connection Settings... FAILURE:
Problem with User setting: BAD_SPACE or USER_NOT_PERMITTED
Either the space does not exist, or the user has no access to that space.
2008-06-17 13:09:43,014 ERROR [Thread-2] - Problem with converter properties file: conf/converter.mediawiki.properties
java.lang.IllegalArgumentException: **********************
Testing Connection Settings... FAILURE:
Problem with User setting: BAD