diff options
author | Eric Wong <e@yhbt.net> | 2020-01-26 01:17:42 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-01-27 02:58:06 +0000 |
commit | 227a1d886672767e37cc86a3432952c14eb8a143 (patch) | |
tree | dd4890655f88583a16952c751cf9f4e9e731d224 /lib/PublicInbox/Admin.pm | |
parent | fcfa0d639da338c470f07942da71f78fa65354a1 (diff) | |
download | public-inbox-227a1d886672767e37cc86a3432952c14eb8a143.tar.gz |
inbox: add ->version method
This allows us to simplify version checking by avoiding "//" or "||" operators sprinkled around.
Diffstat (limited to 'lib/PublicInbox/Admin.pm')
-rw-r--r-- | lib/PublicInbox/Admin.pm | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/PublicInbox/Admin.pm b/lib/PublicInbox/Admin.pm index 1f1b133d..2d3e0281 100644 --- a/lib/PublicInbox/Admin.pm +++ b/lib/PublicInbox/Admin.pm @@ -84,7 +84,6 @@ sub resolve_inboxes ($;$$) { if ($cfg) { $cfg->each_inbox(sub { my ($ibx) = @_; - $ibx->{version} ||= 1; my $path = abs_path($ibx->{inboxdir}); if (defined($path)) { $dir2ibx{$path} = $ibx; @@ -97,7 +96,7 @@ EOF } if ($opt->{all}) { my @all = values %dir2ibx; - @all = grep { $_->{version} >= $min_ver } @all; + @all = grep { $_->version >= $min_ver } @all; push @ibxs, @all; } else { # directories specified on the command-line my $i = 0; @@ -189,7 +188,7 @@ invalid indexlevel=$indexlevel (must be `basic', `medium', or `full') sub index_inbox { my ($ibx, $im, $opt) = @_; my $jobs = delete $opt->{jobs} if $opt; - if (ref($ibx) && ($ibx->{version} || 1) == 2) { + if (ref($ibx) && $ibx->version == 2) { eval { require PublicInbox::V2Writable }; die "v2 requirements not met: $@\n" if $@; my $v2w = $im // eval { $ibx->importer(0) } || eval { |