]> Sergey Matveev's repositories - public-inbox.git/blobdiff - script/public-inbox-index
use PublicInbox::Config::each_inbox where appropriate
[public-inbox.git] / script / public-inbox-index
index e487e3fe327f69080e29996bb934a3cd219f46f8..73ad9bc4a1c08926f83ccfcde1857f863952e1ee 100755 (executable)
@@ -73,16 +73,14 @@ if (@ARGV) {
 sub usage { print STDERR "Usage: $usage\n"; exit 1 }
 usage() unless @dirs;
 
-foreach my $k (keys %$config) {
-       $k =~ /\Apublicinbox\.([^\.]+)\.mainrepo\z/ or next;
-       my $name = $1;
-       my $v = $config->{$k};
+$config->each_inbox(sub {
+       my ($ibx) = @_;
+
        for my $i (0..$#dirs) {
-               next if $dirs[$i] ne $v;
-               my $ibx = $config->lookup_name($name);
-               $dirs[$i] = $ibx if $ibx;
+               next if $dirs[$i] ne $ibx->{mainrepo};
+               $dirs[$i] = $ibx;
        }
-}
+});
 
 foreach my $dir (@dirs) {
        if (!ref($dir) && -f "$dir/inbox.lock") { # v2