X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;f=maintenance%2FcompressOld.php;h=865fcebd9ca51e67d412ea01d4fd7dd0d0f66c6d;hb=85e6160dfd874e44b945b72a3752d529ae377a8a;hp=0d3531376efad50ffdc04ec7ada6713eedb08bca;hpb=2ba5e0e71834eb363242f73d0d0977ed6537fa9a;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/compressOld.php b/maintenance/compressOld.php index 0d3531376e..865fcebd9c 100644 --- a/maintenance/compressOld.php +++ b/maintenance/compressOld.php @@ -1,7 +1,39 @@ ] [-c ] [-b ] [-e ] [-s ] + * + * Wikimedia + * php compressOld.php [-t ] [-c ] [-b ] [-e ] [-s ] + * [-f ] [-h ] + * + * is either: + * gzip: compress revisions independently + * concat: concatenate revisions and compress in chunks (default) + * + * is the old_id to start from + * + * The following options apply only to the concat type: + * is the earliest date to check for uncompressed revisions + * is the latest revision date to compress + * is the maximum number of revisions in a concat chunk + * is the maximum ratio of compressed chunk bytes to uncompressed avg. revision bytes + * is a minimum number of KB, where cuts in + * + */ + +$optionsWithArgs = array( 't', 'c', 's', 'f', 'h' ); require_once( "commandLine.inc" ); require_once( "compressOld.inc" ); @@ -11,19 +43,39 @@ if( !function_exists( "gzdeflate" ) ) { die(); } +$defaults = array( + 't' => 'concat', + 'c' => 20, + 's' => 0, + 'f' => 3, + 'h' => 100, + 'b' => '', + 'e' => '', +); + +$args = $args + $defaults; + +if ( $args['t'] != 'concat' && $args['t'] != 'gzip' ) { + print "Type \"{$args['t']}\" not supported\n"; +} + print "Depending on the size of your database this may take a while!\n"; print "If you abort the script while it's running it shouldn't harm anything,\n"; print "but if you haven't backed up your data, you SHOULD abort now!\n\n"; print "Press control-c to abort first (will proceed automatically in 5 seconds)\n"; -sleep(5); +#sleep(5); + +$success = true; +if ( $args['t'] == 'concat' ) { + $success = compressWithConcat( $args['s'], $args['c'], $args['f'], $args['h'], $args['b'], $args['e'] ); +} else { + compressOldPages( $args['s'] ); +} -$n = 0; -if( !empty( $argv[1] ) ) { - $n = intval( $argv[1] ); +if ( $success ) { + print "Done.\n"; } -compressOldPages( $n ); -print "Done.\n"; exit(); ?>