summaryrefslogtreecommitdiffstats
path: root/sanitycheck.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'sanitycheck.cgi')
-rwxr-xr-xsanitycheck.cgi93
1 files changed, 1 insertions, 92 deletions
diff --git a/sanitycheck.cgi b/sanitycheck.cgi
index 4b6e524c2..c298d1250 100755
--- a/sanitycheck.cgi
+++ b/sanitycheck.cgi
@@ -88,7 +88,6 @@ print $cgi->header() unless Bugzilla->usage_mode == USAGE_MODE_CMDLINE;
# As this script can now alter the group_control_map table, we no longer
# let users with editbugs privs run it anymore.
$user->in_group("editcomponents")
- || ($user->in_group('editkeywords') && $cgi->param('rebuildkeywordcache'))
|| ThrowUserError("auth_failure", {group => "editcomponents",
action => "run",
object => "sanity_check"});
@@ -99,18 +98,6 @@ unless (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) {
}
###########################################################################
-# Users with 'editkeywords' privs only can only check keywords.
-###########################################################################
-unless ($user->in_group('editcomponents')) {
- check_keywords();
- Status('checks_completed');
-
- $template->process('global/footer.html.tmpl', $vars)
- || ThrowTemplateError($template->error());
- exit;
-}
-
-###########################################################################
# Create missing group_control_map entries
###########################################################################
@@ -658,18 +645,13 @@ while (my ($id, $email) = $sth->fetchrow_array) {
}
###########################################################################
-# Perform keyword cache checks
+# Perform keyword checks
###########################################################################
sub check_keywords {
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
- my %keyword = @{ $dbh->selectcol_arrayref(
- q{SELECT bug_id, keywords FROM bugs WHERE keywords != ''},
- {Columns=>[1,2]}) };
-
-
Status('keyword_check_start');
my %keywordids;
@@ -703,79 +685,6 @@ sub check_keywords {
$lastid = $id;
$lastk = $k;
}
-
- Status('keyword_cache_start');
-
- if ($cgi->param('rebuildkeywordcache')) {
- $dbh->bz_start_transaction();
- }
-
- my $query = q{SELECT keywords.bug_id, keyworddefs.name
- FROM keywords
- INNER JOIN keyworddefs
- ON keyworddefs.id = keywords.keywordid
- INNER JOIN bugs
- ON keywords.bug_id = bugs.bug_id
- ORDER BY keywords.bug_id, keyworddefs.name};
-
- $sth = $dbh->prepare($query);
- $sth->execute;
-
- my $lastb = 0;
- my @list;
- my %realk;
- while (1) {
- my ($b, $k) = $sth->fetchrow_array;
- if (!defined $b || $b != $lastb) {
- if (@list) {
- $realk{$lastb} = join(', ', @list);
- }
- last unless $b;
-
- $lastb = $b;
- @list = ();
- }
- push(@list, $k);
- }
-
- my @badbugs = ();
-
- foreach my $b (keys(%keyword)) {
- if (!exists $realk{$b} || $realk{$b} ne $keyword{$b}) {
- push(@badbugs, $b);
- }
- }
- foreach my $b (keys(%realk)) {
- if (!exists $keyword{$b}) {
- push(@badbugs, $b);
- }
- }
- if (@badbugs) {
- @badbugs = sort {$a <=> $b} @badbugs;
-
- if ($cgi->param('rebuildkeywordcache')) {
- my $sth_update = $dbh->prepare(q{UPDATE bugs
- SET keywords = ?
- WHERE bug_id = ?});
-
- Status('keyword_cache_fixing');
- foreach my $b (@badbugs) {
- my $k = '';
- if (exists($realk{$b})) {
- $k = $realk{$b};
- }
- $sth_update->execute($k, $b);
- }
- Status('keyword_cache_fixed');
- } else {
- Status('keyword_cache_alert', {badbugs => \@badbugs}, 'alert');
- Status('keyword_cache_rebuild');
- }
- }
-
- if ($cgi->param('rebuildkeywordcache')) {
- $dbh->bz_commit_transaction();
- }
}
###########################################################################