# ================================================================== # Gossamer Links - enhanced directory management system # # Website : http://gossamer-threads.com/ # Support : http://gossamer-threads.com/scripts/support/ # CVS Info : 087,071,086,086,085 # Revision : $Id: ClickTrack.pm,v 1.3 2009/05/08 19:56:50 brewt Exp $ # # Copyright (c) 2004 Gossamer Threads Inc. All Rights Reserved. # Redistribution in part or in whole strictly prohibited. Please # see LICENSE file for full details. # ================================================================== # # ClickTrack is subclassed so that new() is wrapped to handle ClickTrack table # cleanups - but only the first time a ClickTrack table object is created, and # only once / day. package Links::Table::ClickTrack; use strict; use Links qw/$CFG %STASH/; use GT::SQL::Table (); use vars qw/@ISA/; @ISA = 'GT::SQL::Table'; sub new { my $self = shift->SUPER::new(@_) or return; return $self if $STASH{clicktrack_cleanup}++; Links::init_date(); my $cleanup_date = GT::Date::date_get(time - 2*24*60*60, '%yyyy%-%mm%-%dd%'); return $self if $CFG->{last_clicktrack_cleanup} and $cleanup_date eq $CFG->{last_clicktrack_cleanup}; $self->delete(GT::SQL::Condition->new(Created => '<' => $cleanup_date)); $CFG->{last_clicktrack_cleanup} = $cleanup_date; $CFG->save; $self; } 1;