]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1436301 - Exempt bot accounts from idle group removal
authorDylan William Hardison <dylan@hardison.net>
Wed, 7 Feb 2018 14:03:59 +0000 (15:03 +0100)
committerdklawren <dklawren@users.noreply.github.com>
Wed, 7 Feb 2018 14:03:59 +0000 (09:03 -0500)
scripts/remove_idle_group_members.pl

index 407a8e6dc85eac95e54477644cfc94e786836182..74e8658ff980773f3036c5e0cec80f25ed28f06f 100755 (executable)
@@ -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
 );