|
12 | 12 | >; |
13 | 13 |
|
14 | 14 | # args |
15 | | -my ( $author, $release, $force ); |
| 15 | +my ( $author, $force, $release ); |
16 | 16 | GetOptions( |
17 | 17 | "author=s" => \$author, |
18 | | - "release=s" => \$release, |
19 | 18 | "force" => \$force, |
| 19 | + "release=s" => \$release, |
20 | 20 | ); |
21 | 21 |
|
22 | 22 | # setup |
23 | | -my $type2index = { |
24 | | - release => 'cpan', |
25 | | - file => 'cpan', |
26 | | - author => 'cpan', |
27 | | - favorite => 'cpan', |
28 | | - permission => 'cpan', |
29 | | - contributor => 'contributor', |
30 | | -}; |
31 | | - |
32 | 23 | purge_author() if $author; |
33 | 24 |
|
34 | 25 | log_info {'Done'}; |
|
60 | 51 | } |
61 | 52 | }; |
62 | 53 |
|
63 | | - purge_ids( type => 'favorite', query => $query ); |
64 | | - purge_ids( type => 'file', query => $query ); |
65 | | - purge_ids( type => 'release', query => $query ); |
| 54 | + purge_ids( index => 'favorite', query => $query ); |
| 55 | + purge_ids( index => 'file', query => $query ); |
| 56 | + purge_ids( index => 'release', query => $query ); |
66 | 57 | if ( !$release ) { |
67 | | - purge_ids( type => 'author', id => $author ); |
68 | | - purge_ids( type => 'contributor', id => $author ); |
| 58 | + purge_ids( index => 'author', id => $author ); |
| 59 | + purge_ids( index => 'contributor', id => $author ); |
69 | 60 | } |
70 | 61 | } |
71 | 62 |
|
72 | 63 | sub purge_ids (%args) { |
73 | | - my $type = $args{type}; |
74 | | - my $es = MetaCPAN::ES->new( |
75 | | - index => $type2index->{$type}, |
76 | | - type => $type |
77 | | - ); |
78 | | - |
| 64 | + my $es = MetaCPAN::ES->new( index => $args{index} ); |
79 | 65 | my $bulk = $es->bulk; |
80 | 66 |
|
81 | 67 | my $id = $args{id}; |
|
0 commit comments