Mediawiki/Transwiki

From Bjoern Hassler's website
Jump to: navigation, search

The transwiki functionality allows you to import transfer content between mediawikis (page by page). It's a variation on the usual Special:Export/Special:Import functionality, and is really handy if you want to quickly move a single page between wikis (assuming that the license is compatible).

You can also transclude content between wikis, which of course has security implications, but can be handy for transcluding between two wikis that you both control.

Some links from http://meta.wikimedia.org/wiki/Help_talk:Import

1 Setting up interwiki links: Special:Interwiki[edit]

The transwiki functionality uses the interwiki system. (An interwiki link: wikipedia:Main Page). You can use existing interwiki links. You may want to install the Special:Interwiki extension, so that you can see what interwiki links you've got set up, or to add links if required:

Get the extension (mediawikiwiki:Extension:SpecialInterwiki) and add this to your local settings:

// http://www.mediawiki.org/wiki/Extension:SpecialInterwiki
require_once('extensions/Interwiki/SpecialInterwiki.php'); 
$wgGroupPermissions['*']['interwiki'] = false;
$wgGroupPermissions['sysop']['interwiki'] = true;

Then go to Special:Interwiki to view or modify interwiki links.

2 Interwiki transcluding[edit]

If you allow transcluding for a particular interwiki prefix (set up via Special:Interwiki), and if you enable mediawikiwiki:Manual:$wgEnableScaryTranscluding

$wgEnableScaryTranscluding = true;

then you can transclude content between wikis. For instance, avoer:User:Bjoern/test contains

[Interwiki transcluding is disabled]

You see that the image doesn't work, but that other links are localised. Also, the transcluded page is cached. avoer:Image:Firefox_icon.jpg

3 Interwiki page transfer[edit]

3.1 Set up transwiki sources[edit]

Once you know the interwiki spaces you've got, you can choose to enable some of these as sources for importing:

http://www.mediawiki.org/wiki/Manual:$wgImportSources

$wgImportSources = array('wikipedia');

Or

$wgImportSources = array('avoer','steeple');

for two interwiki prefixes we have set up here avoer: and steeplewiki:.

3.2 Special:Import[edit]

Once you've done this, sysops can now use transwiki functionality. On Special:Import you now have a second box:

TranswikiImport.png

You can simply enter pages from a source wiki, and transfer these to the present wiki. It works just like the xml import, in that

  • previously imported revisions aren't imported again,
  • images cannot be imported in that way.

This is quite neat, as it means you don't have to export content from one wiki via Special:Export first, and you don't have to cut and paste page content either. Of course, if you want to do multiple page, you need to use Special:Export, and if you want to transfer images as well, it becomes more complicated.

4 Links[edit]