Help:Import
Note: When you edit this page, you agree to release your contribution under the CC0. See Public Domain Help Pages for more info. |
Import refers to the process of bringing pages from one wiki into another.
Importing pages can be a power-tool that can easily do unexpected and dangerous things to your wiki. Only import content this way if you know what you are doing.
There are two kinds of import, both of which are accessible via the Special:Import page, the Transwiki and Upload import.
Types of import
[edit]Transwiki import
[edit]Transwiki import, also known as interwiki import, lets you import pages from one wiki to another.
The settings of the destination wiki decide which source wikis are allowed.
MediaWiki:import-interwiki-text (Select a wiki and page title to import.
Revision dates and editors' names will be preserved.
All imports from other wikis are logged at the import log.
) might appear during the process.
Transwiki import is equivalent to going to Special:Export on the source wiki, downloading the resulting XML file, and then importing it using XML import, except that you might only have permissions to do one but not the other.
When transwiki importing, the Include all templates and transcluded pages.
option imports all the templates used an imported page.
This is not necessarily all templates the page depends on to run (if you import a template and its dependencies, it does not include any subtemplates unless they happen to be transcluded with the base template page itself). This option can easily import more pages than you intended, should generally only be checked if you really know what you are doing, as it can screw up the wiki in ways that take a lot of effort to undo.
To check if your wiki has Transwiki import sources configured and see which wikis they apply to, you can use the API:
- <wiki url>/w/api.php?action=paraminfo&modules=import
The configuration is specified as: <param name="interwikisource" description="For interwiki imports: wiki to import from"> …
Upload import
[edit]See also: Manual:Importing XML dumps
Upload Import, lets you import an XML file generated by exporting pages from another wiki. This displays the message MediaWiki:Importtext (Please export the file from the source wiki using the export utility. Save it to your device and upload it here.)
To export wiki pages to a file, see Help:Export
.
Generally, any user can export pages to a file, but importing them into a wiki requires the importupload
user right.
This is granted to sysops in the default configuration, but on WMF wikis is its own "importer" group.
Unlike with transwiki import, which always preserves content from the source wiki unchanged, nothing stops you from editing the XML file before importing it, allowing backdating of edits, fake usernames, or other ways of rewriting history.
This editing process can be used for:
- Adding a note about the import in the edit summary or as a change tag .
- Changing user names and page names to avoid conflicts.
- Adjusting namespace names to be more generic or suitable
- Rebasing edits, as an alternative to revision deletion of large chunks of history if unacceptable content is added and later removed.
See Manual:XML Import file manipulation in CSharp for an example of handling these XML files using C# in Visual Studio .NET.
Useful applications of importing
[edit]- Keeping the page history intact when moving and editing a page in a different wiki. This is particularly helpful if the source page becomes harder to locate due to page moves.
- Preserving the history when a page is moved to another wiki and then deleted from the original wiki.
- Using templates from another wiki.
Usernames
[edit]The default behavior
[edit]By default, imported edits appear with an interwiki prefix, like meta>Example
.
See an example of an imported history here.
Assigning edits to local users
[edit]If you tick the Assign edits to local users where the named user exists locally
checkbox, then edits will be attributed to the user with no interwiki prefix if such a user exists.
This makes it not easily possible to distinguish between imported edits and edits originally made on the wiki.
Recent changes
[edit]Imported edits never show up in recent changes , but the act of performing the import itself does.
Import destinations
[edit]By default, imported edits appear in the same namespace and title on the target wiki as they did in the source wiki. The import form allows you to specify the following:
- A namespace to import content to instead (Import to a namespace:). The namespace option completely ignores the source wiki namespace, so if you import m:Template:Void into Help space it will become Help:Void, not Help:Template:Void.
- A base page to make all imported pages subpages of (Import as subpages of the following page:).