Example #1
0
 * @file
 * @ingroup Maintenance ExternalStorage
 */
$optionsWithArgs = array('t', 'c', 's', 'f', 'h', 'extdb', 'endid', 'e');
require_once dirname(__FILE__) . '/../commandLine.inc';
require_once "compressOld.inc";
if (!function_exists("gzdeflate")) {
    print "You must enable zlib support in PHP to compress old revisions!\n";
    print "Please see http://www.php.net/manual/en/ref.zlib.php\n\n";
    wfDie();
}
$defaults = array('t' => 'concat', 'c' => 20, 's' => 0, 'b' => '', 'e' => '', 'extdb' => '', 'endid' => false);
$options = $options + $defaults;
if ($options['t'] != 'concat' && $options['t'] != 'gzip') {
    print "Type \"{$options['t']}\" not supported\n";
}
if ($options['extdb'] != '') {
    print "Compressing database {$wgDBname} to external cluster {$options['extdb']}\n" . str_repeat('-', 76) . "\n\n";
} else {
    print "Compressing database {$wgDBname}\n" . str_repeat('-', 76) . "\n\n";
}
$success = true;
if ($options['t'] == 'concat') {
    $success = compressWithConcat($options['s'], $options['c'], $options['b'], $options['e'], $options['extdb'], $options['endid']);
} else {
    compressOldPages($options['s'], $options['extdb']);
}
if ($success) {
    print "Done.\n";
}
exit;
 *
 */
die('compressOld is known to be broken at the moment.');
$optionsWithArgs = array('t', 'c', 's', 'f', 'h');
require_once "commandLine.inc";
require_once "compressOld.inc";
if (!function_exists("gzdeflate")) {
    print "You must enable zlib support in PHP to compress old revisions!\n";
    print "Please see http://www.php.net/manual/en/ref.zlib.php\n\n";
    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);
$success = true;
if ($args['t'] == 'concat') {
    $success = compressWithConcat($args['s'], $args['c'], $args['f'], $args['h'], $args['b'], $args['e']);
} else {
    compressOldPages($args['s']);
}
if ($success) {
    print "Done.\n";
}
exit;