Moving from MediaWiki to SharePoint O365 - doRegularPages.php

This script will process the individual html files created from a MediaWiki xml dump by this script to final output files to be uploaded to SharePoint (except for templates, which remains a manual work).

Make sure you've created the folders as explained here, update the URL of your MediaWiki installation on line 5, the URL of your SharePoint site on line 7 and the path of your project directory on line 8.

Moving from MediaWiki to SharePoint O365 - extractPages.php

This is the source code of the extractPages-script, which will create individual html files for all the articles contained in an XML dump from MediaWiki.

Don't forget to update the rootPath on line 2 and the yourSite MediaWiki namespaces on lines 49 - 51.

Moving from MediaWiki to SharePoint O365 - part 5

So we've pimped SharePoint O365 with some javascripts and copied all files and images from our MediaWiki to certain libraries in SharePoint. What remains is getting the textual content there. To do this, we're going to combine the formatted (HTML) content, which we rip from our local MediaWiki website using PHP with cURL, and the unformatted wiki-syntax content which we get from an xml-dump.

Moving from MediaWiki to SharePoint O365 - filePathFlattener.php

This is the source code of the filePathFlattener-script, which will move all files from the images folder-structure of a MediaWiki installation to two folders: one for all the images, and one for all the other files.

It requires there to be an images folder, a filesFlat folder and an imagesFlat folder. You of course also need to update the rootPath on line 4.

Moving from MediaWiki to SharePoint O365 - part 4

Having our scripts in place to emulate some of the MediaWiki functionality and knowing how to use it, we can now finally turn our attention to the actual migration of content. Content comes in two forms: text, as inputted in MediaWiki, and attachments. The attachments can be documents (docx, xslx, pdf, ...) which are available for download, or they can be images (png, jpg, gif, ...) which are displayed in the articles themselves.

In this post, let's focus our attention on the attachments.

Moving from MediaWiki to SharePoint O365 - part 3

Now that you have the scripts in place, how do you make use of them?


This one is simple. Write #REDIRECT[[pagename]] like you're used to doing it in MediaWiki. Just take care that you write it exactly as I did: in uppercase, without a space between # and REDIRECT or between REDIRECT and [[. My script is not dummy-proofed like MediaWiki is.

Math and source code

As we're making use of third party scripts (MathJax and SyntaxHighlighter), you should refer to the corresponding websites for documentation. In short, you can do the following:

Moving from MediaWiki to SharePoint O365 - part 2

After getting our tools set up and acquainting ourselves with SharePoint O365, lets take a step back and think for a moment. The objective is to migrate all wiki content from MediaWiki to SharePoint O365. We can get to our content in MediaWiki, i.e. the raw content as the user types it in, or if need be the HTML-content produced by MediaWiki (using PHP with cURL). And I've got a way to upload HTML-content into pages in SharePoint. So this doesn't sound like such a challenge after all?


MediaWiki has a lot of user friendly formatting syntax. Like * for bulleted and # for numbered lists. Like ==heading==. Like [[some other article]]. Or how about [some external link]. And don't forget the [[Image:something|thumb|right]]. And then there's categories. And templates. And wikitables. And if you've had a bit of fun with the extensions, there's code highlighting. And math. And lots of other stuff.
SharePoint has HTML and an editor.

Moving from MediaWiki to SharePoint O365 - templateCaller.js

This is the source code of the templateCaller script, which, as mentioned, does more than replacing templates by now.

To work, it requires to be placed in your SiteAssets/JayVee folder (create the JayVee folder), where there should also be jquery.min.js and the folders MathJax and SyntaxHighlighter with the corresponding scripts inside. Your seattle.master should be updated to load the jquery script (first) and this script (second) as explained here.
You of course need to change the vars sharePointRootURL (line 15) and sharePointSiteRootURL (line 16) to match the URLs of your site.

If there are errors in it, or things that can be done better, please let me know in the comments so I can improve it! I am not at all fluent in javascript / jQuery, nor will I pretend to be.

Moving from MediaWiki to SharePoint O365 - part 1

Some clever person at Microsoft understood the wiki hype and decided to call some component of their SharePoint platform 'wiki', never mind if it really is one or has some of the much-used functionalities of such things. They knew management would fall for it. And in my case (and yours apparently), they did. It's just another wiki right?

From the articles I've written before, you know I'm a fan of good software being used for what it's meant to do. Like MediaWiki for wikis. So if you've ended up on this page because you're being forced to move away from MediaWiki instead of towards it, let me tell you: I feel your pain. I understand your frustration. If you've never worked with SharePoint before, I understand the frustration you're about to have.
But let's not mix these feelings with the work that needs to be done. So here's some empty space where you're allowed to feel sorry for yourself:

... and done.

Now we get to work.