Friday, May 3, 2013

Life with MediaWiki

For a new project, I'm starting my own MediaWiki-powered..well wiki.  MediaWiki is the platform that Wikipedia is built on.  I've been an avid Wikipedia user and editor for years, but this is the first time I've delved into the platform and what lies under the hood.

I decided to use a Bitnami LAMP stack and installed the MediaWiki (and WordPress) modules.  Bitnami is a very convenient, pre-configured Ubuntu virtual machine that you can use to deploy applications.  I opted to deploy the instances to Amazon AWS, though VMWare images are also available.

My initial thoughts include:
1. MediaWiki is actual more complicated than I expected, but much-more powerful than I understood.
2. WikiPedia doesn't quite "drink their own champagne"; the default configurations of the platform are not what you find on WikiPedia proper.

Bitnami handles the basic installation and setup out of the box, meaning once you spin up your instance, MediaWiki just works.  But you are left with a fair amount of configuration and now real way to know what you're missing.  The first thing I noticed was that my wiki didn't have a mobile view.  Hmm...  A little detective work and I realized I needed an extension called, MobileFrontend to make my wiki iPhone-friendly.

I played around with a few more features and then discovered that Wikipedia has an Export feature.  I exported an article and imported into my wiki.  And it didn't look anything like the Wikipedia version.  See Wikipedia includes alot of things that aren't part of MediaWiki, but are still required.  These are things like extensions, Templates, Modules, and CSS sheets (and probably more).  It took some going back and forth to find the gaps, and I'm far from finished.

My Steps Need to "Copy" WikiPedia"

-> Mediawiki:Common.css.  It took me a while to figure out why none of my Infoboxes were working on my wiki, even after I downloaded a ton of Templates.  Apparently, you need to add the customized CSS found in this file.

-> Extensions.  Extensions are PHP add-ons to the platform, even though it would seem logical that some of the functionality they offer belongs in the core platform.  It's easy enough to install the extensions, once you figure out what they do and what you need.
   -> Scribunto.  MediaWiki uses this parsing language called Lua.  So far it seems they just picked Lua to be different.  Scribunto is the extension that allows you to call Lua code and includes the Lua binaries.
   -> Math.  (And Math requires 'texvc', which requires the entire Ocaml language)  This renders mathematical symbols and formulae.
   -> ParserFunctions.  This is a pre-rendering engine similar to the old server-side includes.
   -> ExpandTemplates.  I'm not sure what this one does.
   -> MobileFrontend.  This is the mobile-friendly view of MediaWiki.
   -> Cite.  Cite is required for all footnotes and References to display.

-> Templates and Modules.  There are many Templates that need to be stolen, such as for all the Infoboxes.  Modules are similar, but are written in Lua.  Many templates reference Modules, so you'll need those Modules, and you'll need Scribunto which implements Lua.
   -> Module:Math is an important one since many Template reference it for conversions.  But it doesn't come in as a dependency when you export an article or the Template.

If you find an imported article not rendering as expected, I found a useful trick is to do the following:
   1. Export an article and Import it into the source wiki
   2. Edit that article page
   3. There is a list of Templates used at the bottom.  If any are in red, you're missing them and need to do a separate export and import.

Another very useful trick is that WikiPedia broadcasts it's configuration.  Go to:
en.wikipedia.com/wiki/Special:Version
to see the current environment.



No comments:

Post a Comment