]> git.ipfire.org Git - thirdparty/bugzilla.git/blob - clean-bug-user-last-visit.pl
Bug 996893: Perl 5.18 and newer throw tons of warnings about deprecated modules
[thirdparty/bugzilla.git] / clean-bug-user-last-visit.pl
1 #!/usr/bin/perl
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 #
6 # This Source Code Form is "Incompatible With Secondary Licenses", as
7 # defined by the Mozilla Public License, v. 2.0.
8
9 =head1 NAME
10
11 clean-bug-user-last-visit.pl
12
13 =head1 DESCRIPTION
14
15 This utility script cleans out entries from the bug_user_last_visit table that
16 are older than (a configurable) number of days.
17
18 It takes no arguments and produces no output except in the case of errors.
19
20 =cut
21
22 use 5.10.1;
23 use strict;
24 use warnings;
25 use lib qw(. lib);
26
27 use Bugzilla;
28 use Bugzilla::Constants;
29
30 Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
31
32 my $dbh = Bugzilla->dbh;
33 my $sql = 'DELETE FROM bug_user_last_visit WHERE last_visit_ts < '
34 . $dbh->sql_date_math('NOW()',
35 '-',
36 Bugzilla->params->{last_visit_keep_days},
37 'DAY');
38 $dbh->do($sql);