MediaWiki Administrator's Handbook/Importing

From Wikibooks, open books for an open world
< MediaWiki Administrator's Handbook
Jump to: navigation, search

Special:Import is a feature designed to accompany Special:Export. Importing allows manual or automated copying of a page from a remote project into another project. This is not necessarily available on all wikis.

If the feature is disabled on a particular wiki the page will instead say "No transwiki import sources have been defined and direct history uploads are disabled." If it is available, however, importing will have one of two appearances:

Importing from transwiki import sources[edit]

The Special:Import interface seen on Wikimedia projects.


This is the interface used on Wikimedia projects (other than those that still have it disabled entirely). For this interface, choose the one-letter code that represents the project to import from (w = Wikipedia, b = Wikibooks, etc.); the ones listed will depend on what projects have been added as import sources. Projects that do not have their codes on this list cannot be imported from. Next, enter the page name. Only one page can be imported at a time using this interface. Talk pages are not automatically included and must be imported separately. Unchecking "Copy all history versions for this page" will result in only the current revision being carried across (similar to Special:Export's "Include only the current revision, not the full history" feature). "Transfer pages into namespace:" allows you to choose a namespace; for a page that needs cleanup, using the Transwiki namespace, if there is one, is probably a good idea.

In the case of Wikimedia projects, the projects from which imports can be made must be specifically requested from bugzilla. The following Wikimedia wikis have automated importing enabled.

Importing from XML[edit]

The Special:Import interface seen outside Wikimedia projects.


Used on many wikis, this interface is less automated but more powerful. Pages must first be obtained from the source wiki's Special:Export. This variant of the interface does not feature a "Copy all history versions for this page" checkbox; this must instead be done with Special:Export's "Include only the current revision, not the full history" checkbox. Use "Browse..." to select the saved XML file and then click "Upload File" to begin the upload. The time this takes will vary depending on the size of the XML, how busy the server is, and your Internet connection speed. If all goes well it will say "Import succeeded!", and if not the error message will indicate what went wrong.

Unlike the Wikimedia version pages cannot be directed into a new namespace from this interface, however it can be manually changed with a text editor; for example if there is a "News:" namespace on the target wiki, changing the <title> entry "Foo" to "News:Foo" will automatically direct it into the "News:" namespace.

General Notes[edit]

  • pages in the File: namespace can be imported, but the images attached to them can't (although if it is a Wikimedia project and they are on Wikimedia Commons they will automatically be sourced from there).
  • pages are automatically attributed to users with the same username. Note that if a user has been renamed with Special:Renameuser and an edit under their old username is subsequently imported it will be attributed to the old username, not their new one.
  • If you import to a page name that already exists the most recent revision of the now merged history will be the one displayed, so be sure to check the pages to make sure a wanted revision hasn't been replaced.
  • when importing from an import source the action is logged on Special:Log/import (both where the XML came from, and how many revisions were imported) and the action shows up on Special:Recentchanges. XML imports are also logged, but only in MediaWiki 1.9.x. With earlier builds means the page won't show up on Special:Recentchanges unless it is more recently edited than some of the wiki's current content. Note that neither method logs the page on Special:Newpages unless its oldest revision is newer than some of the wiki's own content.
  • Sometimes the Special:Log/import logging will fail to register an imported page. Additionally, some projects maintain manual transwiki logs (usually in a Transwiki: namespace).
  • when using Special:Export, always check the very bottom of the XML. If the last line isn't </mediawiki>, don't use it.
  • if you import XML of a page that has already been imported there will be duplicate revisions in the history. This may or may not apply to the transwiki import sources method.
  • by default, the XML importing version of the interface limits filesizes to around 1.4 megabytes. This limit can be changed by the server admin (or you in php.ini in maxuploadsize=).