Manual:Parameters to Special:Export/ja

See also Manual:DumpBackup.php

Wiki pages can be exported in a special XML format to upload into another MediaWiki.[1] See Help:Export for more details.

Available parameters[edit]

Below is the list of available parameters for Special:Export as of version 1.16. Not all of these are available through the Special:Export UI.

Parameter Variable type Description
action String Unused; XMLデータを取得するために"submit"に設定します。
Page Selection
pages ? 改行文字 (%0A) によって区切られたページタイトルのリストです。
addcat/catname String? These were added later. addcat returns all members of the category catname added to it. If enabled, addns and nsindex do the same, but with namespaces and their numerical indexes. A maximum of 5000 page titles will be returned.

For example, the following is for all pages in en:Category:Books:

dir[2] String タイムスタンプの降順でリビジョンを取得するためには"desc"と設定します。


Limiting Results
offset[2] ? 取得を開始したいリビジョンのタイムスタンプです。ただし指定されたタイムスタンプは取得範囲には含まれません。タイムスタンプにはいくつかのフォーマットを利用できます。MediaWikiにおいて通常使用されている14文字のフォーマットや、XMLダンプにあるようなISO 8601フォーマットを含みます。
limit[2] Integer 取得するリビジョンの最大数です。サイト特有の最大値(現在、Wikipediaでは100に設定されています)よりも多くリクエストした場合、自動的にサイト設定値まで減らされます。


curonly Boolean Include only the current revision (default for GET requests).
history ? Include the full history, overriding dir, limit, and offset.

This is not working for all say works fine and gives all revisions but doesn't.

templates ? Includes any transcluded templates on any pages listed for export.
listauthors Boolean Include a list of all contributors' names and user IDs for each page. Functionality is disabled by default; can be enabled by changing $wgExportAllowListContributors.
pagelink-depth Integer Includes any linked pages to the depth specified. Limited to $wgExportMaxLinkDepth (defaults to 0, disabling the feature), or 5 if user does not have permission to change limits.
wpDownload ? Save as file.

URL parameter requests do not work[edit]

The dir, offset and limit parameters only work for POST requests. GET requests through a URL are ignored.

When you use the URL as in a browser, you are submitting via GET. In the ruby script, you are using POST.

As an example, the following parameter request does not work, it returns all revisions of a page despite the parameter limit=5.

Retrieving earliest 5 revisions[edit]

A POST request is generated by cURL when passing -d "". The following retrieves the earliest 5 revisions from the English Wikipedia main page and its talk page:

curl -d "" ''

And here are the next 5 revisions of the main page only:

curl -d "" ''

Here the timestamp from the last revision of the previous query is copied into the offset field of the URL. Because the offset field is non-inclusive, that 5th revision is not displayed again, and instead we get revisions 6-10.[3]

POST request to download[edit]

A more explicit example, especially if you also want to save the darn thing, would be

curl -d "&pages=Main_Page&offset=1&action=submit" -o "somefilename.xml"

The URL root needs to follow the MediaWiki parameters... also, note the fact that you need to add the curl parameters at the end for saving the file as something. Otherwise it will just scroll on your screen and nothing will be saved. Currently, it appears that Wikipedia servers are under maintenance, hence the above method is showing error and not providing the xml.

If you instead have the list of titles in a file, say title-list, you must pass the list as a parameter to curl and encode the linefeeds correctly (for some reason, --data-urlencode and @ do not work):

curl -d "&action=submit&pages=$(cat title-list | hexdump -v -e '/1 "%02x"' | sed 's/\(..\)/%\1/g' )" -o "somefilename.xml"

If you want to save bandwidth, append the following arguments as well:

--compressed -H 'Accept-Encoding: gzip,deflate'

Stopping the export of your MediaWiki[edit]

If $wgExportAllowHistory is set to false in LocalSettings.php, only the current version can be exported, not the full history.

By default with GET requests, only the current (last) version of each page is returned.

If the $wgExportAllowHistory parameter is true in LocalSettings.php, and the "Include only the current revision, not the full history" is unchecked, then all versions of each page are returned.

To disable export completely, you need to set a callback-function in your LocalSettings.php:

function removeExportSpecial(&$aSpecialPages)
	return true;
$wgHooks['SpecialPage_initList'][] = 'removeExportSpecial';

Keep in mind that that exporting is still possible, if you have the API enabled.


  1. If this function is enabled on the destination wiki, and the user is a sysop there. The export can be used for analyzing the content. See also Syndication feeds for exporting other information but pages and Help:Import on importing pages.
  2. 2.0 2.1 2.2 These parameters are ignored if either curonly or history are supplied, or if passed via a GET request (e.g., a browser address bar). See URL parameter requests do not work for more information.
  3. This parameter convention is very similar to the one for UI history pages.

See also[edit]

External links[edit]