00001 <?php
00008 $optionsWithArgs = array( 'begin', 'max-slave-lag', 'throttle' );
00009
00010 require_once "commandLine.inc";
00011 require_once "populateCategory.inc";
00012
00013 if( isset( $options['help'] ) ) {
00014 echo <<<TEXT
00015 This script will populate the category table, added in MediaWiki 1.13. It will
00016 print out progress indicators every 1000 categories it adds to the table. The
00017 script is perfectly safe to run on large, live wikis, and running it multiple
00018 times is harmless. You may want to use the throttling options if it's causing
00019 too much load; they will not affect correctness.
00020
00021 If the script is stopped and later resumed, you can use the --begin option with
00022 the last printed progress indicator to pick up where you left off. This is
00023 safe, because any newly-added categories before this cutoff will have been
00024 added after the software update and so will be populated anyway.
00025
00026 When the script has finished, it will make a note of this in the database, and
00027 will not run again without the --force option.
00028
00029 Usage:
00030 php populateCategory.php [--max-slave-lag <seconds>] [--begin <name>]
00031 [--throttle <seconds>] [--force]
00032
00033 --begin: Only do categories whose names are alphabetically after the pro-
00034 vided name. Default: empty (start from beginning).
00035 --max-slave-lag: If slave lag exceeds this many seconds, wait until it
00036 drops before continuing. Default: 10.
00037 --throttle: Wait this many milliseconds after each category. Default: 0.
00038 --force: Run regardless of whether the database says it's been run already.
00039
00040 TEXT;
00041 exit( 0 );
00042 }
00043
00044 $defaults = array(
00045 'begin' => '',
00046 'max-slave-lag' => 10,
00047 'throttle' => 0,
00048 'force' => false
00049 );
00050 $options = array_merge( $defaults, $options );
00051
00052 populateCategory( $options['begin'], $options['max-slave-lag'],
00053 $options['throttle'], $options['force'] );