]> Sergey Matveev's repositories - public-inbox.git/blobdiff - script/public-inbox-compact
extindex: -xcpdb and -compact support
[public-inbox.git] / script / public-inbox-compact
index dfebac1ceead671c98c9a27505ccbf1812b8e0fe..6e34aaeb44649180fd4ee32ba9d6190aa5458b3c 100755 (executable)
@@ -1,12 +1,12 @@
 #!perl -w
-# Copyright (C) 2018-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2018-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use v5.10.1;
 use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
-my $opt = { compact => 1, -coarse_lock => 1 };
+my $opt = { compact => 1, -coarse_lock => 1, -eidx_ok => 1 };
 my $help = <<EOF; # the following should fit w/o scrolling in 80x24 term:
-usage: public-inbox-compact INBOX_DIR
+usage: public-inbox-compact <INBOX_DIR|EXTINDEX_DIR>
 
   Compact Xapian DBs in an inbox
 
@@ -29,9 +29,13 @@ PublicInbox::Admin::progress_prepare($opt);
 
 require PublicInbox::InboxWritable;
 require PublicInbox::Xapcmd;
-my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt);
-unless (@ibxs) { print STDERR $help; exit 1 }
-foreach (@ibxs) {
-       my $ibx = PublicInbox::InboxWritable->new($_);
+my $cfg = PublicInbox::Config->new;
+my ($ibxs, $eidxs) = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt, $cfg);
+unless ($ibxs) { print STDERR $help; exit 1 }
+for my $ibx (@$ibxs) {
+       $ibx = PublicInbox::InboxWritable->new($ibx);
        PublicInbox::Xapcmd::run($ibx, 'compact', $opt);
 }
+for my $eidx (@$eidxs) {
+       PublicInbox::Xapcmd::run($eidx, 'compact', $opt);
+}