diff options
author | cvs2git <cvs2git> | 2010-12-27 00:04:45 +0000 |
---|---|---|
committer | cvs2git <cvs2git> | 2010-12-27 00:04:45 +0000 |
commit | c82d349f864e6bd9f96fd1156903bc1f7193a203 (patch) | |
tree | e117a87533656110b6acd56fc0ca64289892a9f5 /bin/del-old-history | |
parent | 74e058c8a010ef6feb539248a550d0bb169c1e94 (diff) |
This commit was manufactured by cvs2svn to create tag 'TORRUS_1_0_9'.TORRUS_1_0_9
Diffstat (limited to 'bin/del-old-history')
-rwxr-xr-x | bin/del-old-history | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/bin/del-old-history b/bin/del-old-history deleted file mode 100755 index 5c9412acf..000000000 --- a/bin/del-old-history +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use FS::UID qw(adminsuidsetup dbh); -use FS::Record; #why is this necessary - -#WARNING: not all tables are safe to remove history! -# these are, and seem to take the most space in a typical install with queued -# exports -my @tables = qw( h_queue h_queue_arg ); - -my $years = 2; -my $seconds = $years * 31556926; #60*60*24*365.2422 is close enough -my $before = int( time - $seconds ); - -adminsuidsetup shift or die "usage: del-old-history user\n"; - -foreach my $table ( @tables ) { - - unless ( $table =~ /^h_/ ) { - warn "$table is not a history table, skipping\n"; - next; - } - - my $sql = "DELETE FROM $table WHERE history_date < $before"; - warn "$sql\n"; - my $sth = dbh->prepare($sql) or die dbh->errstr; - $sth->execute or die $sth->errstr; - -} |