Extension:InterWiki

From MediaWiki.org
Jump to: navigation, search
This extension should not be confused with Extension:Interwiki, which is used on Wikimedia wikis.


MediaWiki extensions manual
Crystal Clear action run.png
InterWiki

Release status: stable

Implementation Database
Description Allows to manage the InterWiki list from a file
Author(s) Aran Dunkley (Nadtalk)
Latest version 1.0.1 (2008-11-18)
License GPL
Download see here
Parameters
  • $wgInterWikiFile
  • $wgInterWikiAddOnly

Translate the InterWiki extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

Purpose[edit | edit source]

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 back up your database before using it.

Usage[edit | edit source]

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 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[edit | edit source]

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 projects
WikiPedia,W      | http://en.wikipedia.org/wiki/$1
Meta,M           | http://meta.wikipedia.org/wiki/$1
MediaWiki,MW     | http://www.mediawiki.org/wiki/$1

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

# Other
Google,G         | http://www.google.com/search?q=$1
Foo              | http://www.foo.bar/$1.html | local,trans
Extra options

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.

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[edit | edit source]

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

Changes[edit | edit source]

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

See also[edit | edit source]