In order to make MediaWiki do something new, we first watched how it does some of the old things. In particular, how a new Wiki gets created. Here's a summary. When MediaWiki is first installed, there is no database. How does the engine know this, and what does it do to create one? Well, it doesn't actually check for a database. Instead, a clean installation of the MediaWiki scripts looks for a LocalSettings.php file in the top-level directory (which we'll call "~"). If that file isn't found, then the script ultimately serves up the content of ~/includes/templates/NoLocalSettings.php. The most significant thing on that page is a link to ~/config/index.php. Clicking on that link will take you to the installation script. The top of the page generated by that script will report on the environment, and the bottom half will contain a form to allow the wiki to be configured. In our case, the second bullet in the environment report says "Found database drivers for: MySQL" and the form Database config section has a single radio button for Database type, labelled "MySQL". It looks like this page will be a good place to start looking for what needs to change. Obviously we want to expand the found database drivers and to make an additional radio button available.
We decided to embark on a project to adapt the MediaWiki engine to support Microsoft SQL Server on the back end instead of MySQL. From monitoring the MediaWiki discussion group, I was aware that my team was not the only one to find this of interest, and one participant in the discussion asked that I set up a blog to discuss our progress on this project. Well, here it is! For development, we had access to a machine that already had PHP 4.4.4 installed on it. The first action we took was to upgrade that to PHP 5.1.6. MySQL was already up and running on the machine, as was Microsoft SQL 2000. The first hurdle we faced was getting PHP 5.1.6 to work properly with Microsoft Internet Information Server (IIS) version 6. Most of the instructions we found online relate to IIS 5, and were not particularly helpful. Finding our resident webmaster to point us in the right direction got us off the ground. Making changes to the PHP.ini file had no effect until I added a key to the registry using regedit. The new key has the name [HKEY_LOCAL_MACHINE\SOFTWARE\PHP] and the value "IniFilePath" = "C:\\PHP". After making this change, it was smooth sailing to get PHP configured. Copying the files from the MediaWiki distribution onto a web server directory and browsing to that directory, and we had MediaWiki up and running (with the MySQL back end) in a matter of moments. Now we want to watch the PHP as the web site runs our Wiki, so we want a debugger that runs on our desktops and that will let us step through code running on the server. That's where Komodo (http://www.activestate.com) comes in. What a great tool! The only confusing thing we ran into setting up Komodo is that we have to get rid of the PHP registry entry on the client or we can't set up Komodo for remote debugging. (Komodo runs with a special PHP.ini file when it's in debugging mode, and apparently the registry entry overrides Komodo's mechanism for specifying where to find this alternate INI file). Once that's set up, we put the magic words at the end of the Wiki URL, and presto!, we can step through the code from the Komodo client and watch how the MediaWiki PHP scripts do their magic.