Manual:Guide to setting up interwiki linking

Interwiki links is an example of an interwiki link!

Mediawiki uses certain namespaces as pointers to articles on different wiki's.

customization
(remember that your actual wikidb and wikiuser name were specified by you, and are stored in LocalSettings.php )

view interwiki table
type interwiki to see a list of interwiki related tables

mysql> interwiki interwiki           interwiki.iw_prefix interwiki.iw_local  interwiki.iw_url mysql> interwiki

To show you what you have...

SELECT * FROM interwiki;

See http://dev.mysql.com/doc/mysql/en/Retrieving_data.html for more information.

add your own custom
you can follow the format of the next section to create your own interwiki links to add..

bugzilla-interwiki.sql REPLACE INTO interwiki (iw_prefix,iw_url,iw_local) VALUES ('kdebug','http://bugs.kde.org/show_bug.cgi?id=$1',1), ('mozbug','http://bugzilla.mozilla.org/show_bug.cgi?$1',1), ('gentoobug','http://bugs.gentoo.org/show_bug.cgi?$1',1);

mysql -u -p <  mysql -u wikiuser -p wikidb < bugzilla-interwiki.sql THIS DOES NOT REPORT SUCCESS when it works... there is a bug in the mysql database program... no feedback is a bug, but it probably worked. You must open that interwiki.sql with a text editor to double check.

use wikipedia's interwiki list
the file: maintanance/wikipedia-interwiki.sql contains data like this: REPLACE INTO interwiki (iw_prefix,iw_url,iw_local) VALUES ('w','http://www.wikipedia.org/wiki/$1',1), ('m','http://meta.wikipedia.org/wiki/$1',1), ('meta','http://meta.wikipedia.org/wiki/$1',1), ('zu','http://zu.wikipedia.org/wiki/$1',1); I assume the replace into works...

so, mysql> \. /var/www/localhost/mediawiki-1.3.0/maintenance/wikipedia-interwiki.sql Query OK, 155 rows affected (0.24 sec) Records: 155 Duplicates: 0  Warnings: 0

mysql> should have enabled the interwiki links that I wanted...

more mysql help
Mysql Help

Using phpMyAdmin instead
If your server uses the software phpMyAdmin, you can simply select the database that uses the wiki (remember that your actual wikidb and wikiuser name were specified by you, and are stored in LocalSettings.php ), then select the table "interwiki" from the sidebar. To use the graphical interface, just select "browse" at the top and then you can opt to "insert new row" (at the bottom of the table) following the pattern established for the other items ("$1" is what will be replaced with whatever follows the interwiki prefix in your code; it will usually be at the end of the URL for the site for which you want to make a shortcut). Then click go or opt to insert another record until you are done.

Maintenance script
See maintenance scripts for how to use it.

maintenance/wikipedia-interwiki.sql

When upgrading from a 1.2 to 1.3, your interwiki table will be created. however, it will not be updated on further upgrades.

undocumented feature
'''Q: I'm puzzled about doing Interwiki links, the Interwiki.php is obsoleted... how do you set up interwiki links?'''

A: Before we can answer that, we must ask another question: do you need language links or just external interwiki links?

To set up new interwiki link prefixes, you stick them into the 'interwiki' table in the database (which is undocumented... the source code is the documentation). iw_prefix iw_url  	                iw_local fr 	  http://fr.yourdomain.tld/$1 	1
 * Sample sql in the maintenance dir. Basically:
 * maintenance/interwiki.sql defines the standard prefixes
 * maintenance/wikipedia-interwiki.sql has the wikipedia language prefixes
 * set the magic global on then, and mark the local prefixes as local in the db
 * $wgInterwikiMagic = true; # Treat language links as magic connectors, not inline links
 * default is true
 * The 'iw_local' field in the interwiki table is currently only used for the redirect feature. Inline or 'other langues' box is determined by whether the prefix is in the array of language codes/names defined in the language file ($wgLanguageNames).

Next page: Custom skins >

bugzilla links
bugzilla-interwiki.sql REPLACE INTO interwiki (iw_prefix,iw_url,iw_local) VALUES ('kdebug','http://bugs.kde.org/show_bug.cgi?id=$1',1), ('mozbug','http://bugzilla.mozilla.org/show_bug.cgi?$1',1), ('gentoobug','http://bugs.gentoo.org/show_bug.cgi?$1',1);