Manual:DumpBackup.php/zh

细节
dumpBackup.php将创建一个用于导出或备份的XML文档，这个XML将包含wiki的页面内容（甚至是页面历史内容）. dumpBackup.php不会创建维基数据库的完整备份，产生的转储不包含用户账号、图像、编辑日志和被删除修订等信息. 转储完成后即可导入XML转储.

例子


通用例子
首先你要为你的数据转储起一个名字.

例如某用户要往一个文件保存所有的修订历史（使用--full），并将其命名为 ：


 * 关于这个dump.xml例子的更多细节，请见下文的详细例子. 

你可以将数据转储限制在一个命名空间内. 在这个例子里，转储将只含模板的当前修订：

或模板的全部修订：

若要包含多个命名空间：

使用插件的例子：

 php dumpBackup.php \ --plugin=AbstractFilter:extensions/ActiveAbstract/AbstractFilter.php \ --current \ --output=gzip:/dumps/abstract.xml.gz \ --filter=namespace:NS_MAIN \ --filter=noredirect \ --filter=abstract \ --quiet

或

 php dumpBackup.php \ --plugin=MathMLFilter:../extensions/MathSearch/maintenance/MathMLFilter.php \ --current \ --filter=namespace:NS_MAIN \ --filter=mathml \ --quiet

选项可以与配合使用.

对于 ：

 php dumpBackup.php \ --full \ --include-files \ --uploads \ --output=gzip:/dumps/abstract.xml.gz \ --quiet

 选项也需要使用，否则将不会包含任何文件.



详细例子
''在这个例子中， 绿色的文本 是你需要输入的. ''


 * 1) 首先使用 cd 指令跳转到你的maintenance文件夹. 你的maintenance文件夹位置可能与此例不同.
 * 2) 然后输入 php dumpBackup.php --full > dump.xml ，按下回车. 这将产生类似于下面例子中的一长串代码：

新的XML文件将被创建在maintenance文件夹中. （你也许需要刷新一下你的SCP传输工具才会看到它）

选项
来自MediaWiki ：

 This script dumps the wiki page or logging database into an XML interchange wrapper format for export or backup.

XML output is sent to stdout; progress reports are sent to stderr.

Usage: php dumpBackup.php [ ] Actions: --full     Dump all revisions of every page. --current  Dump only the latest revision of every page. --logs     Dump all log events. --stable   Stable versions of pages? --pagelist= Where is a list of page titles to be dumped --revrange Dump specified range of revisions, requires revstart and revend options. Options: --quiet    Don't dump status reports to stderr. --report=n Report position and speed after every n pages processed. (Default: 100) --server=h Force reading from MySQL server h  --start=n   Start from page_id or log_id n  --end=n     Stop before page_id or log_id n (exclusive) --revstart=n Start from rev_id n  --revend=n    Stop before rev_id n (exclusive) --skip-header Don't output the header --skip-footer Don't output the footer --stub     Don't perform old_text lookups; for 2-pass dump --uploads  Include upload records without files --include-files Include files within the XML stream --conf= Use the specified configuration file (LocalSettings.php)

--wiki= Only back up the specified

Fancy stuff: (Works? Add examples please.) --plugin= [: ]  Load a dump plugin class --output= :     Begin a filtered output stream; s: file, gzip, bzip2, 7zip --filter= [: ] Add a filter on an output branch --7ziplevel=<0-10>         Level of 7zip compression (0 - no compression is default)

This script connects to the database using the username and password defined by and, which are normally set in. Usually $wgDBadminuser is a user with more privileges than the one in, but for running  no extra privileges are required, so the usernames and passwords may be the same. If the variables are not set,  will fail when trying to connect to the database:

 $ php dumpBackup.php --full DB connection error: Unknown error

备注
The XML file is sent to standard output (stdout); progress reports are sent to standard error (stderr). These are the default output and the output device for errors. When you call the script from the shell, then both outputs should by default be sent to the shell, meaning: You should see "informational" output and errors directly on screen.



错误代码
If you are not in the correct folder, you will receive this message:

 No input file specified.

The dumpBackup script says " " when the parameter after "--report" evaluates as 0 or not-a-number. The fix is to run dumpBackup without the "--report" option; then dumpBackup will print a status line every 100 pages processed.

Recommended configuration settings

 * should be set to 0, to avoid inserting all revisions into the object cache. Most of them won't benefit from being stored in the cache because your readers normally won't view random old revisions of pages on your wiki.



参见

 * Dumps/Software dependencies
 * Examples and wrapper scripts
 * xmldumps-backup contains scripts used by the Wikimedia Foundation, python scripts have some documentation; see also wikitech:Category:Dumps (some examples on Dumps/Rerunning_a_job for now).
 * Wikia's WikiFactory/Dumps
 * Examples and wrapper scripts
 * xmldumps-backup contains scripts used by the Wikimedia Foundation, python scripts have some documentation; see also wikitech:Category:Dumps (some examples on Dumps/Rerunning_a_job for now).
 * Wikia's WikiFactory/Dumps