Bug 285466: Add documentation for --regenerate option to collectstats.pl
r=gerv a=LpSolit git-svn-id: svn://10.0.0.236/trunk@262540 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
0d44d5c9f4
commit
c6eaf4b92b
@ -1 +1 @@
|
||||
7873
|
||||
7874
|
||||
@ -25,14 +25,11 @@
|
||||
# Jean-Sebastien Guay <jean_seb@hybride.com>
|
||||
# Frédéric Buclin <LpSolit@gmail.com>
|
||||
|
||||
# Run me out of cron at midnight to collect Bugzilla statistics.
|
||||
#
|
||||
# To run new charts for a specific date, pass it in on the command line in
|
||||
# ISO (2004-08-14) format.
|
||||
|
||||
use strict;
|
||||
use lib qw(. lib);
|
||||
|
||||
use Getopt::Long qw(:config bundling);
|
||||
use Pod::Usage;
|
||||
use List::Util qw(first);
|
||||
use Cwd;
|
||||
|
||||
@ -45,6 +42,12 @@ use Bugzilla::User;
|
||||
use Bugzilla::Product;
|
||||
use Bugzilla::Field;
|
||||
|
||||
my %switch;
|
||||
GetOptions(\%switch, 'help|h', 'regenerate');
|
||||
|
||||
# Print the help message if that switch was selected.
|
||||
pod2usage({-verbose => 1, -exitval => 1}) if $switch{'help'};
|
||||
|
||||
# Turn off output buffering (probably needed when displaying output feedback
|
||||
# in the regenerate mode).
|
||||
$| = 1;
|
||||
@ -63,14 +66,6 @@ if (chdir($graphsdir)) {
|
||||
|
||||
my $dbh = Bugzilla->switch_to_shadow_db();
|
||||
|
||||
|
||||
# To recreate the daily statistics, run "collectstats.pl --regenerate" .
|
||||
my $regenerate = 0;
|
||||
if ($#ARGV >= 0 && $ARGV[0] eq "--regenerate") {
|
||||
shift(@ARGV);
|
||||
$regenerate = 1;
|
||||
}
|
||||
|
||||
# As we can now customize statuses and resolutions, looking at the current list
|
||||
# of legal values only is not enough as some now removed statuses and resolutions
|
||||
# may have existed in the past, or have been renamed. We want them all.
|
||||
@ -112,7 +107,7 @@ my @resolutions = @{$fields->{'resolution'}};
|
||||
# per bug, per day. Instead, we now just get all the data out of the DB
|
||||
# at once and stuff it into some data structures.
|
||||
my (%bug_status, %bug_resolution, %removed);
|
||||
if ($regenerate) {
|
||||
if ($switch{'regenerate'}) {
|
||||
%bug_resolution = @{ $dbh->selectcol_arrayref(
|
||||
'SELECT bug_id, resolution FROM bugs', {Columns=>[1,2]}) };
|
||||
%bug_status = @{ $dbh->selectcol_arrayref(
|
||||
@ -149,7 +144,7 @@ foreach (@myproducts) {
|
||||
|
||||
&check_data_dir ($dir);
|
||||
|
||||
if ($regenerate) {
|
||||
if ($switch{'regenerate'}) {
|
||||
regenerate_stats($dir, $_, \%bug_resolution, \%bug_status, \%removed);
|
||||
} else {
|
||||
&collect_stats($dir, $_);
|
||||
@ -528,3 +523,39 @@ sub CollectSeriesData {
|
||||
}
|
||||
}
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
collectstats.pl - Collect data about Bugzilla bugs.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
./collectstats.pl [--regenerate] [--help]
|
||||
|
||||
Collects data about bugs to be used in Old and New Charts.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over
|
||||
|
||||
=item B<--help>
|
||||
|
||||
Print this help page.
|
||||
|
||||
=item B<--regenerate>
|
||||
|
||||
Recreate all the data about bugs, from day 1. This option is only relevant
|
||||
for Old Charts, and has no effect for New Charts.
|
||||
This option will overwrite all existing collected data and can take a huge
|
||||
amount of time. You normally don't need to use this option (do not use it
|
||||
in a cron job).
|
||||
|
||||
=back
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This script collects data about all bugs for Old Charts, triaged by product
|
||||
and by bug status and resolution. It also collects data for New Charts, based
|
||||
on existing series. For New Charts, data is only collected once a series is
|
||||
defined; this script cannot recreate data prior to this date.
|
||||
|
||||
@ -32,7 +32,8 @@ BEGIN { *esc = \&Pod::Simple::HTML::esc }
|
||||
# in the contents file, even though its HTML POD will still exist.
|
||||
use constant FILE_TRANSLATION => {
|
||||
Files => ['importxml', 'contrib', 'checksetup', 'email_in',
|
||||
'install-module', 'sanitycheck', 'jobqueue', 'migrate'],
|
||||
'install-module', 'sanitycheck', 'jobqueue', 'migrate',
|
||||
'collectstats'],
|
||||
Modules => ['bugzilla'],
|
||||
Extensions => ['extensions'],
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user