forked from LogBlock/LogBlock
Fixed clearlog deleting all log when using a keepLogDays higher than
24 days.
This commit is contained in:
@@ -28,7 +28,8 @@ public class ClearLog implements Runnable
|
|||||||
Statement state = null;
|
Statement state = null;
|
||||||
try {
|
try {
|
||||||
state = conn.createStatement();
|
state = conn.createStatement();
|
||||||
String time = new SimpleDateFormat("yy-MM-dd-HH-mm-ss").format(System.currentTimeMillis() - LogBlock.config.keepLogDays*86400000);
|
String time = new SimpleDateFormat("yy-MM-dd-HH-mm-ss").format(System.currentTimeMillis() - LogBlock.config.keepLogDays*86400000L);
|
||||||
|
LogBlock.log.info("Deleting log older than " + time);
|
||||||
ResultSet rs;
|
ResultSet rs;
|
||||||
for (String table : LogBlock.config.tables.values()) {
|
for (String table : LogBlock.config.tables.values()) {
|
||||||
rs = state.executeQuery("SELECT count(*) FROM `" + table + "` WHERE date < '" + time + "'");
|
rs = state.executeQuery("SELECT count(*) FROM `" + table + "` WHERE date < '" + time + "'");
|
||||||
|
Reference in New Issue
Block a user