Merge "Add tests for WikiMap and WikiReference"
[lhc/web/wiklou.git] / maintenance / dumpTextPass.php
1 <?php
2 /**
3 * Script that postprocesses XML dumps from dumpBackup.php to add page text
4 *
5 * Copyright (C) 2005 Brion Vibber <brion@pobox.com>
6 * https://www.mediawiki.org/
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * http://www.gnu.org/copyleft/gpl.html
22 *
23 * @file
24 * @ingroup Maintenance
25 */
26
27 $originalDir = getcwd();
28
29 require_once __DIR__ . '/commandLine.inc';
30 require_once __DIR__ . '/backupTextPass.inc';
31
32 $dumper = new TextPassDumper( $argv );
33
34 if ( !isset( $options['help'] ) ) {
35 $dumper->dump( true );
36 } else {
37 $dumper->progress( <<<ENDS
38 This script postprocesses XML dumps from dumpBackup.php to add
39 page text which was stubbed out (using --stub).
40
41 XML input is accepted on stdin.
42 XML output is sent to stdout; progress reports are sent to stderr.
43
44 Usage: php dumpTextPass.php [<options>]
45 Options:
46 --stub=<type>:<file> To load a compressed stub dump instead of stdin
47 --prefetch=<type>:<file> Use a prior dump file as a text source, to save
48 pressure on the database.
49 (Requires the XMLReader extension)
50 --maxtime=<minutes> Write out checkpoint file after this many minutes (writing
51 out complete page, closing xml file properly, and opening new one
52 with header). This option requires the checkpointfile option.
53 --checkpointfile=<filenamepattern> Use this string for checkpoint filenames,
54 substituting first pageid written for the first %s (required) and the
55 last pageid written for the second %s if it exists.
56 --quiet Don't dump status reports to stderr.
57 --report=n Report position and speed after every n pages processed.
58 (Default: 100)
59 --server=h Force reading from MySQL server h
60 --current Base ETA on number of pages in database instead of all revisions
61 --spawn Spawn a subprocess for loading text records
62 --buffersize=<size> Buffer size in bytes to use for reading the stub.
63 (Default: 512KB, Minimum: 4KB)
64 --help Display this help message
65 ENDS
66 );
67 }