2009-09-07 Sancho Lerena <slerena@artica.es>

* util/pandora_db.pl: Fixed bad calculation of utimestamp limit
        purgin agent access data.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1918 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2009-09-07 00:14:43 +00:00
parent 94ed36ae48
commit a71596aa8c
2 changed files with 13 additions and 12 deletions

View File

@ -1,4 +1,9 @@
2009-09-04 Sancho Lerena zslerena@artica.es>
2009-09-07 Sancho Lerena <slerena@artica.es>
* util/pandora_db.pl: Fixed bad calculation of utimestamp limit
purgin agent access data.
2009-09-04 Sancho Lerena <slerena@artica.es>
* pandora_server.spec: Updated dependency for sudo.

View File

@ -80,25 +80,21 @@ sub pandora_purgedb {
my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost:3306",$dbuser, $dbpass,{RaiseError => 1, AutoCommit => 1 });
# Calculate limit for deletion, today - $days
my $limit_timestamp = DateCalc("today","-$days days",\$err);
my $limit_timestamp2 = DateCalc($limit_timestamp,"+1 minute",\$err);
$limit_timestamp = &UnixDate($limit_timestamp,"%Y-%m-%d %H:%M:%S");
my $timestamp = &UnixDate("today","%Y-%m-%d %H:%M:%S");
my $limit_access = DateCalc("today","-24 hours",\$err);
$limit_access = &UnixDate($limit_access,"%Y-%m-%d %H:%M:%S");
my $ulimit_timestamp = &UnixDate($limit_access,"%s");
print "[PURGE] Deleting old access data (More than 24hr) \n";
$dbh->do("DELETE FROM tagent_access WHERE utimestamp < '$ulimit_timestamp'");
$limit_access = DateCalc("today","-$config_days_purge days",\$err);
$limit_access = &UnixDate($limit_access,"%Y-%m-%d %H:%M:%S");
$ulimit_timestamp = &UnixDate($limit_access,"%s");
my $ulimit_access_timestamp = &UnixDate("today","%s") - 86400;
my $ulimit_timestamp = &UnixDate("today","%s") - (86400 * $days);
my $limit_timestamp = DateCalc("today","-$days days",\$err);
print "[PURGE] Deleting old access data (More than 24hr) \n";
$dbh->do("DELETE FROM tagent_access WHERE utimestamp < '$ulimit_access_timestamp'");
print "[PURGE] Deleting old event data (More than $config_days_purge days)... \n";
$dbh->do("DELETE FROM tevento WHERE utimestamp < '$ulimit_timestamp'");
print "[PURGE] Deleting old data... \n";
$dbh->do ("DELETE FROM tagente_datos WHERE utimestamp < '$ulimit_timestamp'");
print "[PURGE] Delete old data (string) ... \n";
$dbh->do ("DELETE FROM tagente_datos_string WHERE utimestamp < '$ulimit_timestamp'");