Help:Interwiki links
MozillaWiki Handbook
Software help for MozillaWiki — see page histories for older versions.
Handbook Contents | Other help
en:Interwiki links is an example of an interwiki link!
Mediawiki uses certain namespaces as pointers to articles on different wiki's.
Overview
Installation
Security
- Security
- Security Checklist
- Paranoid Permissions (system)
- Permissive Permissions (system)
- Setting user rights (inside wiki environment)
Configuration
- Configuration
- Help:Configuration
- Apache config
- Robots.txt -- how to avoid search engines to index the internals of your wiki
- Rewrite Rules -- how to get rid of /index.php in URLs
- PHP config
- MySQL config
Customization
- Customization
- Timezone adjustments
- MediaWiki localization -- localization and customization for link texts and messages like 'fromwikipedia'
- Interwiki links
- Custom skins
- Custom Namespaces
- More tweaks
- Configuration tips and tricks
Manage the database
Performance
- PHP caching and optimization
- File cache
- Cache strategy deployed by Wikimedia
- Wikimedia servers: an example of a multi-server configuration
Upgrading
customization
(remember that your actual wikidb and wikiuser name were specified by you, and are stored in LocalSettings.php )
fire up mysql
mysql -u <wikiuser> -p
then enter your password, then,
USE <wikidb>
example:
aaron@escargot ~ $ mysql -u wikiuser -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 816 to server version: 4.0.20 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> USE wikidb Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql>
view interwiki table
type interwiki<tab><tab> to see a list of interwiki related tables
mysql> interwiki interwiki interwiki.iw_prefix interwiki.iw_local interwiki.iw_url mysql> interwiki
http://dev.mysql.com/doc/mysql/en/Retrieving_data.html gives us:
SELECT interwiki.iw_prefix FROM interwiki; SELECT interwiki.iw_url FROM interwiki;
Will show you what you have...
SELECT * FROM interwiki;
works a bit better...
edit interwiki table
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?id=$1',1), ('gentoobug','http://bugs.gentoo.org/show_bug.cgi?$1',1);
mysql -u <username> -p <nameofyourdatabase> < <filename.sql>
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
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).
- Sample sql in the maintenance dir. Basically:
iw_prefix iw_url iw_local
fr http://fr.yourdomain.tld/$1 1- 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 >
Creative Uses
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);
See also
- en:Interwiki links
- help:Interwiki linking
- Interwiki map Meta-Wiki
- and the interwiki wiki
Help contents Reading:
Go |
Search |
URL |
Namespace |
Page name |
Section |
Link |
Backlinks |
Piped link |
Interwiki link |
Redirect |
Variable |
Category
|