Bump to beta4; disable compressOld as it's known to break.
[lhc/web/wiklou.git] / maintenance / compressOld.php
1 <?php
2 /**
3 * Compress the old table, old_flags=gzip
4 *
5 * @package MediaWiki
6 * @subpackage Maintenance
7 */
8
9 /** */
10
11 /**
12 * Usage:
13 *
14 * Non-wikimedia
15 * php compressOld.php [-t <type>] [-c <chunk-size>] [-b <begin-date>] [-e <end-date>] [-s <start-id>]
16 *
17 * Wikimedia
18 * php compressOld.php <database> [-t <type>] [-c <chunk-size>] [-b <begin-date>] [-e <end-date>] [-s <start-id>]
19 * [-f <max-factor>] [-h <factor-threshold>]
20 *
21 * <type> is either:
22 * gzip: compress revisions independently
23 * concat: concatenate revisions and compress in chunks (default)
24 *
25 * <start-id> is the old_id to start from
26 *
27 * The following options apply only to the concat type:
28 * <begin-date> is the earliest date to check for uncompressed revisions
29 * <end-date> is the latest revision date to compress
30 * <chunk-size> is the maximum number of revisions in a concat chunk
31 * <max-factor> is the maximum ratio of compressed chunk bytes to uncompressed avg. revision bytes
32 * <factor-threshold> is a minimum number of KB, where <max-factor> cuts in
33 *
34 */
35
36 die( 'compressOld is known to be broken at the moment.' );
37
38 $optionsWithArgs = array( 't', 'c', 's', 'f', 'h' );
39 require_once( "commandLine.inc" );
40 require_once( "compressOld.inc" );
41
42 if( !function_exists( "gzdeflate" ) ) {
43 print "You must enable zlib support in PHP to compress old revisions!\n";
44 print "Please see http://www.php.net/manual/en/ref.zlib.php\n\n";
45 die();
46 }
47
48 $defaults = array(
49 't' => 'concat',
50 'c' => 20,
51 's' => 0,
52 'f' => 3,
53 'h' => 100,
54 'b' => '',
55 'e' => '',
56 );
57
58 $args = $args + $defaults;
59
60 if ( $args['t'] != 'concat' && $args['t'] != 'gzip' ) {
61 print "Type \"{$args['t']}\" not supported\n";
62 }
63
64 print "Depending on the size of your database this may take a while!\n";
65 print "If you abort the script while it's running it shouldn't harm anything,\n";
66 print "but if you haven't backed up your data, you SHOULD abort now!\n\n";
67 print "Press control-c to abort first (will proceed automatically in 5 seconds)\n";
68 #sleep(5);
69
70 $success = true;
71 if ( $args['t'] == 'concat' ) {
72 $success = compressWithConcat( $args['s'], $args['c'], $args['f'], $args['h'], $args['b'], $args['e'] );
73 } else {
74 compressOldPages( $args['s'] );
75 }
76
77 if ( $success ) {
78 print "Done.\n";
79 }
80
81 exit();
82
83 ?>