#792 Include registration date into purging logic

- Take MAX(reg_date, login_date) as timestamp to compare against
- Remove the second "all" parameter to include entries with 0 registration date -> we expect registration date to always be set to the current date, so the parameter becomes obsolete
This commit is contained in:
ljacqu
2017-10-15 18:29:01 +02:00
parent 1df5308e56
commit ea58e20c3d
12 changed files with 50 additions and 93 deletions
@@ -60,7 +60,7 @@ public class PurgeService {
calendar.add(Calendar.DATE, -daysBeforePurge);
long until = calendar.getTimeInMillis();
runPurge(null, until, false);
runPurge(null, until);
}
/**
@@ -69,11 +69,10 @@ public class PurgeService {
*
* @param sender Sender running the command
* @param until The last login threshold in milliseconds
* @param includeEntriesWithLastLoginZero True to also purge players with lastlogin = 0, false otherwise
*/
public void runPurge(CommandSender sender, long until, boolean includeEntriesWithLastLoginZero) {
public void runPurge(CommandSender sender, long until) {
//todo: note this should may run async because it may executes a SQL-Query
Set<String> toPurge = dataSource.getRecordsToPurge(until, includeEntriesWithLastLoginZero);
Set<String> toPurge = dataSource.getRecordsToPurge(until);
if (Utils.isCollectionEmpty(toPurge)) {
logAndSendMessage(sender, "No players to purge");
return;