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 * -f <max-factor> the maximum ratio of compressed chunk bytes to uncompressed avg. revision bytes
22 * -h <threshold> is a minimum number of KB, where <max-factor> cuts in
23 * --extdb <cluster> store specified revisions in an external cluster (untested)
26 * @ingroup Maintenance ExternalStorage
29 $optionsWithArgs = array( 't', 'c', 's', 'f', 'h', 'extdb', 'endid', 'e' );
30 require_once( dirname(__FILE__
) . '/../commandLine.inc' );
31 require_once( "compressOld.inc" );
33 if( !function_exists( "gzdeflate" ) ) {
34 print "You must enable zlib support in PHP to compress old revisions!\n";
35 print "Please see http://www.php.net/manual/en/ref.zlib.php\n\n";
51 $options = $options +
$defaults;
53 if ( $options['t'] != 'concat' && $options['t'] != 'gzip' ) {
54 print "Type \"{$options['t']}\" not supported\n";
57 if ( $options['extdb'] != '' ) {
58 print "Compressing database $wgDBname to external cluster {$options['extdb']}\n" . str_repeat('-', 76) . "\n\n";
60 print "Compressing database $wgDBname\n" . str_repeat('-', 76) . "\n\n";
64 if ( $options['t'] == 'concat' ) {
65 $success = compressWithConcat( $options['s'], $options['c'], $options['f'], $options['h'], $options['b'],
66 $options['e'], $options['extdb'], $options['endid'] );
68 compressOldPages( $options['s'], $options['extdb'] );