Skip to content

Instantly share code, notes, and snippets.

@dklawren
Created November 16, 2016 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dklawren/ff4368141e2ab245f3b2b7b0e8922c9e to your computer and use it in GitHub Desktop.
Save dklawren/ff4368141e2ab245f3b2b7b0e8922c9e to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use lib qw(. local/lib/perl5)';
use Bugzilla;
use Bugzilla::FlagType;
use Bugzilla::User;
my $dbh = Bugzilla->dbh;
my $sth = $dbh->prepare("SELECT flag_when, type_id, setter_id, status
FROM flag_state_activity
WHERE YEAR(flag_when) = 2016 AND MONTH(flag_when) > 2",
{ Slice => {} });
$sth->execute();
while (my $row = $sth->fetchrow_hashref()) {
my $type = Bugzilla::FlagType->new({ id => $row->{type_id}, cache => 1 });
my $setter = Bugzilla::User->new({ id => $row->{setter_id}, cache => 1 });
my $status = $row->{status};
my $when = $row->{flag_when};
if ((($status eq '+' || $status eq '-') && !$setter->can_set_flag($type))
|| ($status eq '?' && !$setter->can_request_flag($type)))
{
print STDERR $setter->login . " inappropriately set " . $type->name . $status . " on " . $when . "\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment