mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-20 07:37:47 +01:00
- do the check for old GeoLite data correctly.
This commit is contained in:
parent
10e5ae08e2
commit
5c690d722a
@ -39,11 +39,9 @@ public class GeoLiteAPI {
|
|||||||
}
|
}
|
||||||
final File pluginFolder = AuthMe.getInstance().getDataFolder();
|
final File pluginFolder = AuthMe.getInstance().getDataFolder();
|
||||||
final File data = new File(pluginFolder, "GeoIP.dat");
|
final File data = new File(pluginFolder, "GeoIP.dat");
|
||||||
boolean dataIsOld = (System.currentTimeMillis() - data.lastModified()) > TimeUnit.DAYS.toMillis(30);
|
|
||||||
if (dataIsOld && !data.delete()) {
|
|
||||||
ConsoleLogger.showError("Failed to delete GeoLiteAPI database");
|
|
||||||
}
|
|
||||||
if (data.exists()) {
|
if (data.exists()) {
|
||||||
|
boolean dataIsOld = (System.currentTimeMillis() - data.lastModified()) > TimeUnit.DAYS.toMillis(30);
|
||||||
|
if (!dataIsOld) {
|
||||||
try {
|
try {
|
||||||
lookupService = new LookupService(data);
|
lookupService = new LookupService(data);
|
||||||
ConsoleLogger.info(LICENSE);
|
ConsoleLogger.info(LICENSE);
|
||||||
@ -52,6 +50,11 @@ public class GeoLiteAPI {
|
|||||||
ConsoleLogger.logException("Failed to load GeoLiteAPI database", e);
|
ConsoleLogger.logException("Failed to load GeoLiteAPI database", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (!data.delete()) {
|
||||||
|
ConsoleLogger.showError("Failed to delete GeoLiteAPI database");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Ok, let's try to download the data file!
|
// Ok, let's try to download the data file!
|
||||||
downloadTask = new Thread(new Runnable() {
|
downloadTask = new Thread(new Runnable() {
|
||||||
|
Loading…
Reference in New Issue
Block a user