From c20774f3a3602a05596c7eea12edd6882097b4e4 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 7 Feb 2018 15:03:59 +0100 Subject: Bug 1436301 - Exempt bot accounts from idle group removal --- scripts/remove_idle_group_members.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'scripts/remove_idle_group_members.pl') diff --git a/scripts/remove_idle_group_members.pl b/scripts/remove_idle_group_members.pl index 407a8e6dc..74e8658ff 100755 --- a/scripts/remove_idle_group_members.pl +++ b/scripts/remove_idle_group_members.pl @@ -31,16 +31,20 @@ my $dbh = Bugzilla->dbh; # Record any changes as made by the automation user my $auto_user = Bugzilla::User->check({ name => 'automation@bmo.tld' }); +# This ignores things that end with "bugs" or ".tld", just like +# Bugzilla/BugMail.pm sub Send() my $expired = $dbh->selectall_arrayref( - "SELECT DISTINCT profiles.userid AS user_id, + q{SELECT DISTINCT profiles.userid AS user_id, groups.id AS group_id FROM profiles JOIN user_group_map ON profiles.userid = user_group_map.user_id JOIN groups ON user_group_map.group_id = groups.id WHERE user_group_map.grant_type = ? + AND profiles.login_name NOT LIKE '%bugs' + AND profiles.login_name NOT LIKE '%.tld' AND groups.idle_member_removal > 0 AND (profiles.last_seen_date IS NULL OR TO_DAYS(LOCALTIMESTAMP(0)) - TO_DAYS(profiles.last_seen_date) > groups.idle_member_removal) - ORDER BY profiles.login_name", + ORDER BY profiles.login_name}, { Slice => {} }, GRANT_DIRECT ); -- cgit v1.2.3-24-g4f1b