source: LMDZ6/branches/Amaury_dev/tools/fcm/sbin/fcm-vacuum-trac-env-db @ 5095

Last change on this file since 5095 was 5095, checked in by abarral, 4 months ago

Revert cosp*/ from the trunk, as it's external code
Add missing bits from FCM2 source

  • Property svn:executable set to *
File size: 2.4 KB
Line 
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
21use strict;
22use warnings;
23
24use FindBin;
25use lib "$FindBin::Bin/../lib";
26use FCM::Admin::System qw{
27    filter_projects
28    get_projects_from_trac_live
29    vacuum_trac_env_db
30};
31use FCM::Admin::Util qw{option2config};
32use Getopt::Long qw{GetOptions};
33use Pod::Usage qw{pod2usage};
34
35main();
36
37sub 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
60fcm-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
72Prints help and exits.
73
74=item --trac-live-dir=DIR
75
76Specifies the root location of the live directory of Trac environments. See
77L<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
87Specifies one or more project to vacuum. If no project is specified, the
88program searches the live directory for projects to vacuum.
89
90=back
91
92=head1 DESCRIPTION
93
94This program issues the "VACUUM" SQL command in the databases of the Trac
95environments in the live directory.
96
97=head1 COPYRIGHT
98
99Copyright (C) 2006-2021 British Crown (Met Office) & Contributors.
100
101=cut
Note: See TracBrowser for help on using the repository browser.