This is a schema change. It's only a table creation, but the table must be created...
[lhc/web/wiklou.git] / maintenance / populateCategory.php
1 <?php
2 /**
3 * @addtogroup Maintenance
4 * @author Simetrical
5 */
6
7 $optionsWithArgs = array( 'begin', 'max-slave-lag', 'throttle' );
8
9 require_once "commandLine.inc";
10 require_once "populateCategory.inc";
11
12 if( isset( $options['help'] ) ) {
13 echo <<<TEXT
14 This script will populate the category table, added in MediaWiki 1.13. It will
15 print out progress indicators every 1000 categories it adds to the table. The
16 script is perfectly safe to run on large, live wikis, and running it multiple
17 times is harmless. You may want to use the throttling options if it's causing
18 too much load; they will not affect correctness.
19
20 If the script is stopped and later resumed, you can use the --begin option with
21 the last printed progress indicator to pick up where you left off. This is
22 safe, because any newly-added categories before this cutoff will have been
23 added after the software update and so will be populated anyway.
24
25 When the script has finished, it will make a note of this in the database, and
26 will not run again without the --force option.
27
28 Usage:
29 php populateCategory.php [--max-slave-lag <seconds>] [--begin <name>]
30 [--throttle <seconds>] [--force]
31
32 --begin: Only do categories whose names are alphabetically after the pro-
33 vided name. Default: empty (start from beginning).
34 --max-slave-lag: If slave lag exceeds this many seconds, wait until it
35 drops before continuing. Default: 10.
36 --throttle: Wait this many milliseconds after each category. Default: 0.
37 --force: Run regardless of whether the database says it's been run already.
38 TEXT;
39 exit( 0 );
40 }
41
42 $defaults = array(
43 'begin' => '',
44 'max-slave-length' => 10,
45 'throttle' => 0,
46 'force' => false
47 );
48 $options = array_merge( $defaults, $options );
49
50 populateCategory( $options['begin'], $options['max-slave-length'],
51 $options['throttle'], $options['force'] );