Extension:BugSquish

Note - the most up to date version of this documentation is available at http://www.kennel17.co.uk/testwiki/BugSquish. -

This extension checks your bug tracker installation and adds a strikethrough to interwiki links for closed bugs. BugSquish currently supports the Bugzilla, RT and Trac bug trackers, running on either MySQL or PostgreSQL databases.

Changes

 * 2011-10-18: Added the CSS styling to the extension, so it is available by default, therefore you no longer need to add it manually. You can still over-ride it in MediaWiki:Common.css, though.
 * 2011-10-02: BugSquish now supports Trac. Thanks to Braden Ehrat for the patch.
 * 2009-11-12: Updated extension so that it now works correctly on MW 1.14 and above.

Credits
&copy; Copyright 2006-2011, Mark Clements. Released under a creative-commons cc-by-sa 2.5 (or later) license.

Many thanks to Dax Kelson for providing the RT and PostgreSQL code and to Braden Ehrat for integrating with Trac.

Installation
Simply copy and paste the code (below) into a new file in your 'extensions' directory and include it from your LocalSettings.php file in the usual way.

Requirements
Firstly, links to your bug tracker need to be setup in your interwiki table. For example you might setup an interwiki link called  with the URL   (though see known issues, below, if you plan to use this prefix). This means you can enter the wiki code  to create a link to bug 2314 in your Bugzilla install (resulting in a link such as: bug:2314). For links to other bug-trackers, the URL format will change, but the principal is the same.

Note that setting up links to your bug-tracker in this manner is something that MediaWiki supports natively - it is not functionality added by this extension. BugSquish simply adds the ability to shown these links crossed out (or otherwise styled) based on their status.

For BugSquish to work are you need to have an interwiki prefix that accepts just a single number, and that the DB containing the bugs must be accessible locally (though the code is designed to allow for alternative access to the bug tracker data (e.g. via WebDAV)... once someone has written the necessary code!).

Multiple interwiki prefixes to different bug tracker installations can be defined on the same wiki.

Configuration
For each interwiki link that you want to use, you need to add an entry into. Each entry has the following required elements:


 * interwiki => The interwiki prefix this definition applies to.
 * type => The type of connection. Currently only   is valid for this field.
 * tracker => The type of bug tracker you are linking to. Currently the following values are recognised: ,   and.

The following elements are only required if necessary:
 * prefix => DB prefix (as setup in your tracker installation - can be omitted if this does not apply to your tracker, or no prefix is being used).

The following optional elements can be used to define the database connection. If any of the elements are omitted, then the values used for your MediaWiki installation are used. Therefore if Bugzilla shares a database with MediaWiki (and the MediaWiki user has appropriate access privileges) then you can omit all of the settings. If not, then fill in anything that differs from your MediaWiki install.
 * dbtype => The database type. Currently only   and   are supported.
 * host => The database host.
 * database => The database name.
 * user => Username for DB connection.
 * password => Password for DB connection.

Example 1 - shared DB
If MediaWiki and Bugzilla are installed in a single DB, then you only need to specify a minimal set of components:

Example 2 - separate DB
If Bugzilla is stored in a separate DB, then you need to supply details. In most cases 'host' will be the same as for MediaWiki, in which case it can be omitted (as it has been here). Also if no table prefix is used in your Bugzilla install, then that field can be omitted.

Known issues

 * Doesn't handle interwiki links created dynamically via templates, (e.g. .  It should handle links that don't contain variables though - let me know if you spot any other problems with transclusion, however!
 * In MediaWiki v1.6 the 'Buginese' language was added, which has the ISO code 'bug'. This means that in the default configuration for version 1.6 upwards, you can't use 'bug' for the links (or rather, you can, but they appear in the left side-bar rather than in the text as expected).  There are two work-arounds to this.
 * Use a different interwiki prefix.
 * If you don't use inter-language links (and if you're unsure, you probably don't) then you can disable them by setting $wgInterwikiMagic to false in your LocalSettings.php file.
 * This breaks when a bug is linked to in a log comment/edit summary and viewing special:log/special:recentchanges. (Calling setCacheTime on non-object)

Source Code
Available from http://www.kennel17.co.uk/testwiki/BugSquish.