From dd32e2d8d149f1394ac79d5178ad365892e7df76 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 12 May 2017 04:15:50 +1200 Subject: Clear event history (fix #3160) --- src/org/traccar/Main.java | 2 +- src/org/traccar/database/DataManager.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/org/traccar/Main.java b/src/org/traccar/Main.java index 21625d3c1..1e2db2693 100644 --- a/src/org/traccar/Main.java +++ b/src/org/traccar/Main.java @@ -44,7 +44,7 @@ public final class Main { @Override public void run() { try { - Context.getDataManager().clearPositionsHistory(); + Context.getDataManager().clearHistory(); } catch (SQLException error) { Log.warning(error); } diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 0c5f458a2..2aeb759f6 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -308,12 +308,15 @@ public class DataManager { .executeQuery(Position.class); } - public void clearPositionsHistory() throws SQLException { - long historyDays = config.getInteger("database.positionsHistoryDays"); + public void clearHistory() throws SQLException { + long historyDays = config.getInteger("database.historyDays"); if (historyDays != 0) { QueryBuilder.create(dataSource, getQuery("database.deletePositions")) .setDate("serverTime", new Date(System.currentTimeMillis() - historyDays * 24 * 3600 * 1000)) .executeUpdate(); + QueryBuilder.create(dataSource, getQuery("database.deleteEvents")) + .setDate("serverTime", new Date(System.currentTimeMillis() - historyDays * 24 * 3600 * 1000)) + .executeUpdate(); } } -- cgit v1.2.3