Extension:InterWiki

Purpose
This extension allows the InterWiki list in the database to be maintained from a list of entries in a file instead of running an update script or using a special page. This has the advantage of allowing a number of wikis installed on the same server to share the same interwiki list simplifying maintenance.
 * This extension modifies the database directly, so you should backup your database before using it.

Usage
The default file from which the InterWiki entries are taken is a file called InterWiki.txt which resides in the same directory as the extension script. A different file can be specified by setting the $wgInterWikiFile global, but only the filename should be specified, and it must still reside in the same directory as the extension script.

Another global is $wgInterWikiAddOnly which is set to true by default and specifies that entries which are present in the file should update existing items in the database or insert new ones, but items current items which are not present in the file should not be deleted from the database. If $wgInterWikiAddOnly is set to false, the database will be made to exactly match the items in the file and contain no other items.

File Format
Below is an example file listing some InterWiki links which could be added. Each InterWiki entry occupies a single line and has the wiki name and its URL separated by a pipe character ("|"). The url contains a $1 symbol which represents where the page name should be inserted. A single wiki can have more than one name by using a comma-separated list, in the example below, wikipedia can be linked to by either the full name or simply by a "W". WikiPedia,W     | http://en.wikipedia.org/wiki/$1 Meta,M          | http://meta.wikipedia.org/wiki/$1 MediaWiki,MW    | http://www.mediawiki.org/wiki/$1
 * 1) Wikipedia projects

PERL            | http://perldoc.perl.org/functions/$1.html PHP             | http://www.php.net/$1 SQL             | http://www.w3schools.com/sql/sql_$1.asp
 * 1) Documentation sites

Google,G        | http://www.google.com/search?q=$1 Foo             | http://www.foo.bar/$1.html | local,trans Each interwiki link can have two other options, local or trans, which can be added as in the last item in the example above. The local option means that the item is linking to the local wiki, not to an external site. The extension sets this flag automatically if the domain matches.
 * 1) Other
 * Extra options

The trans flag is used to allow pages from the external wiki to be transcluded. Transcluding external articles also requires the $wgEnableScaryTranscluding global variable to be set to true.

Installation
Get the latest revision of the code from OrganicDesign:Extension:InterWiki.php, save as a file in your extensions directory and include from your LocalSettings.php file as usual.

Changes

 * 0.0.4 (2008-02-16): fixed illegal offset problem
 * 0.0.2 (2007-09-14): fixed fatal error in MW1.11