php

MediaWiki extensions

I’ve written several MediaWiki extensions, mainly for the CLUG Wiki. I don’t think any of them are particularly beautiful or maintained, but they are an essential part of our wiki, and might be useful to somebody out there…

Category Gallery:

Written for ClugPark, this extension displays all the images in a category together, as a gallery.

Usage:

<category-gallery category="PicturesOfPenguins" resizewidth="50" width="60" height="60"><category-gallery>

Mailman subscribe links:

Written for the Mailing Lists page, this extension displays mailman subscribe forms.

Usage:

<mailman>http://lists.example.com/mailman/subscribe/foobar</mailman>

Obfuscate e-mail addresses:

Written for the Contact a Committee Member page. I use my own simple Javascript that replaces innerHTML and href when you mouse over an e-mail link. I think it’s spambot-proof.

Usage:

<email domain="example.com">foobar</email>

Wordpress -> Drupal

This is my script for migrating from Wordpress to Drupal. I know that there is already a migration script out there, but I still wrote my own for a few reasons:

  • My needs are simple, and I knew what I wanted.
  • I wanted to migrate comments and pingbacks if possible. This turned out to be easy.
  • I wanted to learn more about coding for Drupal.
  • I’d already started writing it when I saw Borek’s migrator.
  • I wanted to migrate straight to Drupal 5, not 4 first.

So here it is.

Limitations and bugs:

  • Attached files are copied by requesting them off the old server. But thumbnails aren’t migrated too.
  • Pages aren’t migrated. But I’m sure this would be a piece of cake to fix
  • I put dumped my wordpress tables into my drupal database (They are all prefixed with wp-). This is messy, but while Drupal’s multi-database system is a cool and would be perfect, it’s unworkable when you are debugging. Errors seem to be hooked in drupal, and if you have a broken SQL query (for example) the error handling code hooks Drupal themes, which aren’t findable in the alternate-db world you are visiting.
  • All blog posts are migrated to a single user on the other side.
  • I’m pretty sure that I didn’t solve the character encoding issues, just sidestepped them…
  • I didn’t look into Drupal 6 compatibility.

Amatomu Drupal Module

I’ve written a simple drupal module for including the Amatomu tracker.

It also supports the “What’s hot in South African blogs” tag-cloud, albeit via ugly javascript. I’m not a fan of all this javascript DHTML nonsense, but maybe they can be talked into providing a better API

Todo list (Things amatomu does that I don’t care for, and thus haven’t coded):

  • I’d like to extend this to include support for the shmaak buttons.
  • The rank ribbon.

Available from Drupal.org. Releases for Drupal 5 and 6 are available.

SR Album

The scripts used to generate the album on my previous web site. The thumbnails are generated with Python (using ImageMagick’s convert) and displayed with a PHP script. This split approach keeps the scripts’ file-size down while not needing PHP to process any images, which keeps the speed up.

It’s very primitive, but can look quite nice, and is easily automated.

PHP4 for feisty - pbuilder for beginners

I helped Robbster out on #clug today, building php4 for feisty (it’s been dropped after edgy, in favour of php5). If you want to install it, don’t care about security holes, and want to use the debs I created, add this line to your apt sources list, and go wild:

deb http://ftp.leg.uct.ac.za/pub/stuff/tmp/php4-feisty ./

If on the other hand you want to know how to do it (so when the next PHP security hole appears tomorrow, you can build the latest version yourself), read on:

I’ve never used pbuilder before, so it was fun:

# aptitude install pbuilder

Edit /etc/pbuilderrc to point to your closest mirror, and uncomment the COMPONENTSline (so that you get universe included)

# pbuilder create

Now pbuilder is ready for work. Get the latest sources from debian (Download those 3 files at the end, dsc, orig.tar.gz and diff)

# pbuilder build *.dsc

Sit back and watch…

When it’s done, you probably want to create a trivial repository of your debs:

# cd /var/cache/pbuilder/result/; dpkg-scanpackages . /dev/null | gzip -c -9 > Packages.gz

Then add this to your sources.list

deb file:///var/cache/pbuilder/result/ ./

Wohoo. Remember to watch out for those security holes…

Syndicate content