1 | #!/usr/bin/perl |
---|
2 | # ------------------------------------------------------------------------------ |
---|
3 | # (C) Crown copyright Met Office. All rights reserved. |
---|
4 | # For further details please refer to the file COPYRIGHT.txt |
---|
5 | # which you should have received as part of this distribution. |
---|
6 | # ------------------------------------------------------------------------------ |
---|
7 | |
---|
8 | use strict; |
---|
9 | use warnings; |
---|
10 | |
---|
11 | use FindBin; |
---|
12 | use lib "$FindBin::Bin/../lib"; |
---|
13 | use FCM::Admin::System qw{ |
---|
14 | filter_projects |
---|
15 | get_projects_from_trac_live |
---|
16 | vacuum_trac_env_db |
---|
17 | }; |
---|
18 | use FCM::Admin::Util qw{option2config}; |
---|
19 | use Getopt::Long qw{GetOptions}; |
---|
20 | use Pod::Usage qw{pod2usage}; |
---|
21 | |
---|
22 | main(); |
---|
23 | |
---|
24 | sub main { |
---|
25 | my %option; |
---|
26 | my $result = GetOptions( |
---|
27 | \%option, |
---|
28 | q{help|usage|h}, |
---|
29 | q{trac-live-dir=s}, |
---|
30 | ); |
---|
31 | if (!$result) { |
---|
32 | pod2usage(1); |
---|
33 | } |
---|
34 | if (exists($option{help})) { |
---|
35 | pod2usage(q{-verbose} => 1); |
---|
36 | } |
---|
37 | option2config(\%option); |
---|
38 | my @projects = filter_projects([get_projects_from_trac_live()], \@ARGV); |
---|
39 | for my $project (@projects) { |
---|
40 | vacuum_trac_env_db($project); |
---|
41 | } |
---|
42 | } |
---|
43 | |
---|
44 | __END__ |
---|
45 | =head1 NAME |
---|
46 | |
---|
47 | fcm-vacuum-trac-env-db |
---|
48 | |
---|
49 | =head1 SYNOPSIS |
---|
50 | |
---|
51 | fcm-vacuum-trac-env-db [OPTIONS] [PROJECT ...] |
---|
52 | |
---|
53 | =head1 OPTIONS |
---|
54 | |
---|
55 | =over 4 |
---|
56 | |
---|
57 | =item --help, -h, --usage |
---|
58 | |
---|
59 | Prints help and exits. |
---|
60 | |
---|
61 | =item --trac-live-dir=DIR |
---|
62 | |
---|
63 | Specifies the root location of the live directory of Trac environments. See |
---|
64 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
65 | |
---|
66 | =back |
---|
67 | |
---|
68 | =head1 ARGUMENTS |
---|
69 | |
---|
70 | =over 4 |
---|
71 | |
---|
72 | =item PROJECT |
---|
73 | |
---|
74 | Specifies one or more project to vacuum. If no project is specified, the |
---|
75 | program searches the live directory for projects to vacuum. |
---|
76 | |
---|
77 | =back |
---|
78 | |
---|
79 | =head1 DESCRIPTION |
---|
80 | |
---|
81 | This program issues the "VACUUM" SQL command in the databases of the Trac |
---|
82 | environments in the live directory. |
---|
83 | |
---|
84 | =head1 COPYRIGHT |
---|
85 | |
---|
86 | E<169> Crown copyright Met Office. All rights reserved. |
---|
87 | |
---|
88 | =cut |
---|