Created
November 16, 2016 18:23
-
-
Save dklawren/ff4368141e2ab245f3b2b7b0e8922c9e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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