WARNING:  This documentation is OLD

 

I use mediawiki to run the notes section of this site, and several others. However, due to the features I need to use, I had to modify the base install.

Install

I am running CentOS for my OS, so at first, I thought that I would use Dag’s build of MediaWiki, however, his is out of date. As I wanted security updates, I downloaded his source RPM, and installed it. I had to make the following changes to the .spec file:

  • Update the Version tag
  • Update the Release
  • Modify the cp command from %{__cp} -av install-utils.inc index.php redirect.php %{buildroot}/var/www/mediawiki/ to %{__cp} -av index.php redirect.php %{buildroot}/var/www/mediawiki/

After a quick rebuild, I was ready to move on.

Mediawiki has a few dependencies. I decided to install memcached. For this, Dag’s build worked fine. After a yum-based install, I had to do the following:

  • chkconfig memcached on

Since I wanted a centralized MediaWiki installation, I created a virtual host, and set up directories and symlinks as follows:

  • mkdir files img config
  • extensions -> /var/www/mediawiki/extensions/
  • includes -> /var/www/mediawiki/includes/
  • index.php -> /var/www/mediawiki/index.php
  • install-utils.inc -> /var/www/mediawiki/install-utils.inc
  • languages -> /var/www/mediawiki/languages/
  • maintenance -> /var/www/mediawiki/maintenance/
  • redirect.php -> /var/www/mediawiki/redirect.php
  • skins -> /var/www/mediawiki/skins/
  • config/index.php -> /var/www/mediawiki/config/index.php

I was then able to go to the virtual host and do the basic setup.

Hacking on MediaWiki

Skins

I wanted my skin of MediaWiki to be based on monobook, but still have it’s own look. In particular, I like having a banner across the top. Doing this required several CSS adjustments. Most of my changes were in main.css, but I also had to modify Opera7Fixes.css, as I was sliding several DIV elements down, and Opera didn’t like it.

I also didn’t like the default red colour for links, so I did a search in the codebase for CC2200 to change it. This is hardcoded a few places, and is not skinnable.

I also had to edit the graphics used to tag links, as the default MediaWiki colours did not mesh with my green-based theme.

User Access Resitriction

As I am using MediaWiki as a CMS, I need the ability to block users from accessing certain pages. To do this, I used the basic instructions at http://meta.wikimedia.org/wiki/Page_access_restriction_with_MediaWiki .

This gives me a special restrict tab, which I use to keep articles in progress private.

  1. cd /var/www/mediawiki
  2. wget http://conseil-recherche-innovation.net/download/mediawiki/restriction-beta-0.63.mediawiki-1.6.3.patch
  3. patch -p0 < restriction-beta-0.63.mediawiki-1.6.3.patch
  4. Set the following LocalSetting variables:
    • $wgEnableRestrict = true;
    • $wgRestrictNewPages = false;
    • $wgUserPageRestrict = false;
    • $wgRegexRestrict = array();
    • $wgNoRecentChangesRestrict = true;
    • $wgHideRestrictLog = true;
  5. Go to the Special:Userrights and add ability to users to restrict pages

Poem Extension

My girlfriend is a poet, so I needed a simple way to add poems into a wiki system. I used the line-indenting version of the poem extension to do this.

Spell Check

I used the WikiSpeller extension for spell checking, but it has stopped working. My next step is to build my own GSpellerServer, but I’ve not done this yet. Firefox 2 may make this moot.

Amazon Integration

There is an Amazon Extension that I could not get to work. I have replaced it with a few Amazon Templates that I use internally.

Anonymous Talk

I like for users to be able to comment on my pages, even though I do not want them to modify them. As such, I have opened up the discussion tabs per http://meta.wikimedia.org/wiki/Users:PyneJ:Hacks:PageWhiteList

Security

I didn’t like the fact that MediaWiki did not provide a facility for secure logins. These changes to my apache config force an https connection for the login page. It does not work 100%, but it’s better than nothing.

  • In the VirtualHost *:80 section:
    • RewriteEngine On
    • RewriteCond %{QUERY_STRING} Userlogin [NC]
    • RewriteCond %{SERVER_PORT} 80
    • RewriteRule ^(.*)$ https://www.starmind.org$1 [R,L]
  • In the VirtualHost *:443 section:
    • RewriteEngine On
    • RewriteCond %{QUERY_STRING} !Userlogin [NC]
    • RewriteCond %{SERVER_PORT} 443
    • RewriteRule ^(.*)$ http://www.starmind.org$1 [R,L]

FCK Editor

It would be very nice to have some users be able to use the FCK Editor to edit wiki pages. I followed the instructions and they worked quite well, but stored the data as HTML. This method fails for times when I want to make a quick edit, and like the simple syntax of MediaWiki.

There are projects out there to use FCK to edit, but save as Wiki markup, but I have not had much success with those yet.

Updates

When I build and deploy new updates for MediaWiki, I need to re-apply some my custom changes.

  • Reapply restrict patch
  • Manually install anon user patch
  • Manually adjust the CC2200 to 0000AA everywhere