summaryrefslogtreecommitdiffstats
path: root/sanitycheck.cgi
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2006-07-06 15:12:04 +0200
committermkanat%bugzilla.org <>2006-07-06 15:12:04 +0200
commitf162521444148d622df3b42a8304b6cce8f2150e (patch)
tree78cf6a0bfad99a4f053c998b98efe36929475005 /sanitycheck.cgi
parent5e55e7bc89682617a14d5fbc3b6098c12ce1aece (diff)
downloadbugzilla-f162521444148d622df3b42a8304b6cce8f2150e.tar.gz
bugzilla-f162521444148d622df3b42a8304b6cce8f2150e.tar.xz
Bug 173629: Clean up "my" variable scoping issues for mod_perl
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=myk
Diffstat (limited to 'sanitycheck.cgi')
-rwxr-xr-xsanitycheck.cgi14
1 files changed, 10 insertions, 4 deletions
diff --git a/sanitycheck.cgi b/sanitycheck.cgi
index f0f794194..cfe5e1fe3 100755
--- a/sanitycheck.cgi
+++ b/sanitycheck.cgi
@@ -333,6 +333,7 @@ print "OK, now running sanity checks.<p>\n";
sub CrossCheck {
my $table = shift @_;
my $field = shift @_;
+ my $dbh = Bugzilla->dbh;
Status("Checking references to $table.$field");
@@ -509,6 +510,7 @@ sub DoubleCrossCheck {
my $table = shift @_;
my $field1 = shift @_;
my $field2 = shift @_;
+ my $dbh = Bugzilla->dbh;
Status("Checking references to $table.$field1 / $table.$field2");
@@ -582,12 +584,9 @@ while (my ($id, $email) = $sth->fetchrow_array) {
# Perform vote/keyword cache checks
###########################################################################
-my $offervotecacherebuild = 0;
-
sub AlertBadVoteCache {
my ($id) = (@_);
Alert("Bad vote cache for bug " . BugLink($id));
- $offervotecacherebuild = 1;
}
$sth = $dbh->prepare(q{SELECT bug_id, votes, keywords
@@ -615,21 +614,25 @@ $sth = $dbh->prepare(q{SELECT bug_id, SUM(vote_count)
$dbh->sql_group_by('bug_id'));
$sth->execute;
+my $offer_votecache_rebuild = 0;
+
while (my ($id, $v) = $sth->fetchrow_array) {
if ($v <= 0) {
Alert("Bad vote sum for bug $id");
} else {
if (!defined $votes{$id} || $votes{$id} != $v) {
AlertBadVoteCache($id);
+ $offer_votecache_rebuild = 1;
}
delete $votes{$id};
}
}
foreach my $id (keys %votes) {
AlertBadVoteCache($id);
+ $offer_votecache_rebuild = 1;
}
-if ($offervotecacherebuild) {
+if ($offer_votecache_rebuild) {
print qq{<a href="sanitycheck.cgi?rebuildvotecache=1">Click here to rebuild the vote cache</a><p>\n};
}
@@ -752,6 +755,7 @@ if (defined $cgi->param('rebuildkeywordcache')) {
sub BugCheck {
my ($middlesql, $errortext, $repairparam, $repairtext) = @_;
+ my $dbh = Bugzilla->dbh;
my $badbugs = $dbh->selectcol_arrayref(qq{SELECT DISTINCT bugs.bug_id
FROM $middlesql
@@ -817,6 +821,8 @@ BugCheck("bugs INNER JOIN products ON bugs.product_id = products.id " .
sub DateCheck {
my $table = shift @_;
my $field = shift @_;
+ my $dbh = Bugzilla->dbh;
+
Status("Checking dates in $table.$field");
my $c = $dbh->selectrow_array(qq{SELECT COUNT($field)
FROM $table