00001 <?php
00027 $optionsWithArgs = array( 't', 'c', 's', 'f', 'h', 'extdb', 'endid', 'e' );
00028 require_once( dirname(__FILE__) . '/../commandLine.inc' );
00029 require_once( "compressOld.inc" );
00030
00031 if( !function_exists( "gzdeflate" ) ) {
00032 print "You must enable zlib support in PHP to compress old revisions!\n";
00033 print "Please see http://www.php.net/manual/en/ref.zlib.php\n\n";
00034 wfDie();
00035 }
00036
00037 $defaults = array(
00038 't' => 'concat',
00039 'c' => 20,
00040 's' => 0,
00041 'b' => '',
00042 'e' => '',
00043 'extdb' => '',
00044 'endid' => false,
00045 );
00046
00047 $options = $options + $defaults;
00048
00049 if ( $options['t'] != 'concat' && $options['t'] != 'gzip' ) {
00050 print "Type \"{$options['t']}\" not supported\n";
00051 }
00052
00053 if ( $options['extdb'] != '' ) {
00054 print "Compressing database $wgDBname to external cluster {$options['extdb']}\n" . str_repeat('-', 76) . "\n\n";
00055 } else {
00056 print "Compressing database $wgDBname\n" . str_repeat('-', 76) . "\n\n";
00057 }
00058
00059 $success = true;
00060 if ( $options['t'] == 'concat' ) {
00061 $success = compressWithConcat( $options['s'], $options['c'], $options['b'],
00062 $options['e'], $options['extdb'], $options['endid'] );
00063 } else {
00064 compressOldPages( $options['s'], $options['extdb'] );
00065 }
00066
00067 if ( $success ) {
00068 print "Done.\n";
00069 }
00070
00071 exit();
00072
00073