summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sanitycheck.pl')
-rwxr-xr-xsanitycheck.pl60
1 files changed, 43 insertions, 17 deletions
diff --git a/sanitycheck.pl b/sanitycheck.pl
index 7fd12b176..bdd7552ce 100755
--- a/sanitycheck.pl
+++ b/sanitycheck.pl
@@ -21,23 +21,29 @@ use Bugzilla::Mailer;
use Getopt::Long;
use Pod::Usage;
-my $verbose = 0; # Return all comments if true, else errors only.
+my $verbose = 0; # Return all comments if true, else errors only.
my $login = ''; # Login name of the user which is used to call sanitycheck.cgi.
-my $help = 0; # Has user asked for help on this script?
-
-my $result = GetOptions('verbose' => \$verbose,
- 'login=s' => \$login,
- 'help|h|?' => \$help);
+my $help = 0; # Has user asked for help on this script?
+my $errors_to = 0; # send mail to error contact instead of user
+my @params;
+
+my $result = GetOptions(
+ 'verbose' => \$verbose,
+ 'login=s' => \$login,
+ 'help|h|?' => \$help,
+ 'errors_to' => \$errors_to,
+ 'param=s' => \@params,
+);
pod2usage({-verbose => 1, -exitval => 1}) if $help;
# Be sure a login name if given.
$login || ThrowUserError('invalid_username');
-my $user = new Bugzilla::User({ name => $login })
- || ThrowUserError('invalid_username', { name => $login });
+my $user = new Bugzilla::User({name => $login})
+ || ThrowUserError('invalid_username', {name => $login});
-my $cgi = Bugzilla->cgi;
+my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
# Authenticate using this user account.
@@ -46,20 +52,25 @@ Bugzilla->set_user($user);
# Pass this param to sanitycheck.cgi.
$cgi->param('verbose', $verbose);
+foreach my $param (@params) {
+ $cgi->param($param, 1);
+}
+
require 'sanitycheck.cgi';
# Now it's time to send an email to the user if there is something to notify.
if ($cgi->param('output')) {
- my $message;
- my $vars = {};
- $vars->{'addressee'} = $user->email;
- $vars->{'output'} = $cgi->param('output');
- $vars->{'error_found'} = $cgi->param('error_found') ? 1 : 0;
+ my $message;
+ my $vars = {};
+ $vars->{'addressee'}
+ = $errors_to ? Bugzilla->params->{mail_errors_to} : $user->email;
+ $vars->{'output'} = $cgi->param('output');
+ $vars->{'error_found'} = $cgi->param('error_found') ? 1 : 0;
- $template->process('email/sanitycheck.txt.tmpl', $vars, \$message)
- || ThrowTemplateError($template->error());
+ $template->process('email/sanitycheck.txt.tmpl', $vars, \$message)
+ || ThrowTemplateError($template->error());
- MessageToMTA($message);
+ MessageToMTA($message);
}
@@ -94,6 +105,21 @@ This should be passed the email address of a user that is capable of
running the Sanity Check process, a user with the editcomponents priv. This
user will receive an email with the results of the script run.
+=item B<--errors_to>
+
+Instead of mailing --login, mail the 'mail_errors_to' address.
+
+=item B<--param>
+
+Set parameters to ae.g. If you wanted to fix repair_bugs_fulltext
+pss to sanitycheck.cgi.
+
+e.g. If you wanted to fix bug full text records
+
+ --param repair_bugs_fulltext
+
+Can be set multiple times.
+
=back
=head1 DESCRIPTION