2 # Copyright (C) 2018 all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
6 use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
7 use PublicInbox::Search;
8 use PublicInbox::Config;
9 use PublicInbox::InboxWritable;
11 use PublicInbox::Xapcmd;
12 my $usage = "Usage: public-inbox-compact REPO_DIR\n";
13 my $dir = shift or die $usage;
14 my $config = eval { PublicInbox::Config->new };
16 $dir = abs_path($dir);
18 $config->each_inbox(sub {
19 $ibx = $_[0] if abs_path($_[0]->{mainrepo}) eq $dir
23 warn "W: $dir not configured in ".
24 PublicInbox::Config::default_file() . "\n";
28 address => [ 'old@example.com' ],
30 $ibx = PublicInbox::Inbox->new($ibx);
32 $ibx = PublicInbox::InboxWritable->new($ibx);
34 # we rely on --no-renumber to keep docids synched to NNTP
35 PublicInbox::Xapcmd::run($ibx, [qw(xapian-compact --no-renumber)]);