1 | #!/usr/bin/perl |
---|
2 | # ------------------------------------------------------------------------------ |
---|
3 | # Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
4 | # |
---|
5 | # This file is part of FCM, tools for managing and building source code. |
---|
6 | # |
---|
7 | # FCM is free software: you can redistribute it and/or modify |
---|
8 | # it under the terms of the GNU General Public License as published by |
---|
9 | # the Free Software Foundation, either version 3 of the License, or |
---|
10 | # (at your option) any later version. |
---|
11 | # |
---|
12 | # FCM is distributed in the hope that it will be useful, |
---|
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | # GNU General Public License for more details. |
---|
16 | # |
---|
17 | # You should have received a copy of the GNU General Public License |
---|
18 | # along with FCM. If not, see <http://www.gnu.org/licenses/>. |
---|
19 | # ------------------------------------------------------------------------------ |
---|
20 | |
---|
21 | use strict; |
---|
22 | use warnings; |
---|
23 | |
---|
24 | use FindBin; |
---|
25 | use lib "$FindBin::Bin/../lib"; |
---|
26 | use FCM::Admin::System qw{ |
---|
27 | filter_projects |
---|
28 | get_projects_from_trac_live |
---|
29 | vacuum_trac_env_db |
---|
30 | }; |
---|
31 | use FCM::Admin::Util qw{option2config}; |
---|
32 | use Getopt::Long qw{GetOptions}; |
---|
33 | use Pod::Usage qw{pod2usage}; |
---|
34 | |
---|
35 | main(); |
---|
36 | |
---|
37 | sub main { |
---|
38 | my %option; |
---|
39 | my $result = GetOptions( |
---|
40 | \%option, |
---|
41 | q{help|usage|h}, |
---|
42 | q{trac-live-dir=s}, |
---|
43 | ); |
---|
44 | if (!$result) { |
---|
45 | pod2usage(1); |
---|
46 | } |
---|
47 | if (exists($option{help})) { |
---|
48 | pod2usage(q{-verbose} => 1); |
---|
49 | } |
---|
50 | option2config(\%option); |
---|
51 | my @projects = filter_projects([get_projects_from_trac_live()], \@ARGV); |
---|
52 | for my $project (@projects) { |
---|
53 | vacuum_trac_env_db($project); |
---|
54 | } |
---|
55 | } |
---|
56 | |
---|
57 | __END__ |
---|
58 | =head1 NAME |
---|
59 | |
---|
60 | fcm-vacuum-trac-env-db |
---|
61 | |
---|
62 | =head1 SYNOPSIS |
---|
63 | |
---|
64 | fcm-vacuum-trac-env-db [OPTIONS] [PROJECT ...] |
---|
65 | |
---|
66 | =head1 OPTIONS |
---|
67 | |
---|
68 | =over 4 |
---|
69 | |
---|
70 | =item --help, -h, --usage |
---|
71 | |
---|
72 | Prints help and exits. |
---|
73 | |
---|
74 | =item --trac-live-dir=DIR |
---|
75 | |
---|
76 | Specifies the root location of the live directory of Trac environments. See |
---|
77 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
78 | |
---|
79 | =back |
---|
80 | |
---|
81 | =head1 ARGUMENTS |
---|
82 | |
---|
83 | =over 4 |
---|
84 | |
---|
85 | =item PROJECT |
---|
86 | |
---|
87 | Specifies one or more project to vacuum. If no project is specified, the |
---|
88 | program searches the live directory for projects to vacuum. |
---|
89 | |
---|
90 | =back |
---|
91 | |
---|
92 | =head1 DESCRIPTION |
---|
93 | |
---|
94 | This program issues the "VACUUM" SQL command in the databases of the Trac |
---|
95 | environments in the live directory. |
---|
96 | |
---|
97 | =head1 COPYRIGHT |
---|
98 | |
---|
99 | Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
100 | |
---|
101 | =cut |
---|