3 * Compress the text of a wiki.
8 * php compressOld.php [options...]
11 * php compressOld.php <database> [options...]
14 * -t <type> set compression type to either:
15 * gzip: compress revisions independently
16 * concat: concatenate revisions and compress in chunks (default)
17 * -c <chunk-size> maximum number of revisions in a concat chunk
18 * -b <begin-date> earliest date to check for uncompressed revisions
19 * -e <end-date> latest revision date to compress
20 * -s <start-id> the old_id to start from
21 * --extdb <cluster> store specified revisions in an external cluster (untested)
24 * @ingroup Maintenance ExternalStorage
27 $optionsWithArgs = array( 't', 'c', 's', 'f', 'h', 'extdb', 'endid', 'e' );
28 require_once( dirname(__FILE__
) . '/../commandLine.inc' );
29 require_once( "compressOld.inc" );
31 if( !function_exists( "gzdeflate" ) ) {
32 print "You must enable zlib support in PHP to compress old revisions!\n";
33 print "Please see http://www.php.net/manual/en/ref.zlib.php\n\n";
47 $options = $options +
$defaults;
49 if ( $options['t'] != 'concat' && $options['t'] != 'gzip' ) {
50 print "Type \"{$options['t']}\" not supported\n";
53 if ( $options['extdb'] != '' ) {
54 print "Compressing database $wgDBname to external cluster {$options['extdb']}\n" . str_repeat('-', 76) . "\n\n";
56 print "Compressing database $wgDBname\n" . str_repeat('-', 76) . "\n\n";
60 if ( $options['t'] == 'concat' ) {
61 $success = compressWithConcat( $options['s'], $options['c'], $options['b'],
62 $options['e'], $options['extdb'], $options['endid'] );
64 compressOldPages( $options['s'], $options['extdb'] );