Help:Interwiki links

From MozillaWiki
Jump to: navigation, search

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.

Edit system admin toc view this alone

Overview

  1. Administrator's Guide
  2. MediaWiki Architecture
    1. Display Layout
  3. Database Architecture
    1. Design Format

Installation

  1. Installation - Long
  2. Installation
    1. on Linux
    2. on Windows
    3. on Mac OS X
    4. on FreeBSD
  3. CVS tree installation)
  4. Installation FAQ
  5. Timezone adjustments

Security

  1. Security
  2. Security Checklist
  3. Paranoid Permissions (system)
  4. Permissive Permissions (system)
  5. Setting user rights (inside wiki environment)

Configuration

  1. Configuration
  2. Help:Configuration
  3. Apache config
  4. Robots.txt -- how to avoid search engines to index the internals of your wiki
  5. Rewrite Rules -- how to get rid of /index.php in URLs
  6. PHP config
  7. MySQL config

Customization

  1. Customization
  2. Timezone adjustments
  3. MediaWiki localization -- localization and customization for link texts and messages like 'fromwikipedia'
  4. Interwiki links
  5. Custom skins
  6. Custom Namespaces
  7. More tweaks
  8. Configuration tips and tricks

Manage the database

  1. Backup Database
  2. Restore Database
  3. Reduce the size of the database

Performance

  1. PHP caching and optimization
  2. File cache
  3. Cache strategy deployed by Wikimedia
  4. Wikimedia servers: an example of a multi-server configuration

Upgrading

  1. Upgrade Mediawiki

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

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

Help contents

Reading: Go | Search | URL | Namespace | Page name | Section | Link | Backlinks | Piped link | Interwiki link | Redirect | Variable | Category
Tracking changes: Recent | (enhanced) | Related | Watching pages | Page history | Diff | User contributions | Edit summary | Minor edit
Logging in and preferences: Logging in | Preferences | User style
Editing: Overview | New page | Images/files | Image description page | Special characters | Formula | Table | EasyTimeline | Template | Renaming (moving) a page | Automatic conversion of wikitext | Talk page | Testing
Edit this template