5 =head1 NAME $RCSfile: mapsscrub,v $
7 This script scrubs messages from the MAPS database based on the users settings
15 Andrew DeFaria <Andrew@DeFaria.com>
21 Fri Nov 29 14:17:21 2002
25 $Date: 2013/06/12 14:05:47 $
31 Usage: mapsscrub.pl [-usa|ge] [-h|elp] [-v|erbose] [-de|bug]
35 -usa|ge Print this usage
37 -v|erbose Verbose mode (Default: Not verbose)
38 -de|bug Turn on debugging (Default: Off)
40 -user|id User ID to scrub (Default: All users)
41 -n\oopitmize Whether or not to optimize DB (Default: optimize)
50 use lib "$FindBin::Bin/../lib";
51 use lib "$FindBin::Bin/../../lib";
63 usage => sub { pod2usage },
64 help => sub { pod2usage (-verbose => 2)},
65 verbose => sub { set_verbose },
66 debug => sub { set_debug },
75 my %options = GetUserOptions($userid);
77 my $timestamp = SubtractDays(Today2SQLDatetime, $options{History});
79 $total{'Emails cleaned'} = CleanEmail $timestamp, $opts{dryrun};
80 $total{'Log entries removed'} = CleanLog $timestamp, $opts{dryrun};
82 for (qw(white black null)) {
83 $total{"${_}list entries removed"} = CleanList(
87 dryrun => $opts{dryrun},
109 path => '/var/local/log',
110 timestamped => 'yes',
113 FindUser(%opts{userid});
115 while (my $rec = GetUser) {
116 SetContext($rec->{userid});
118 CleanUp($rec->{userid});
121 # Now optimize the database
122 OptimizeDB if $opts{optimize};