improvements to purge job
This commit is contained in:
@ -124,6 +124,10 @@
|
||||
_osversion = systeminfo["osversion"];
|
||||
_serverpath = systeminfo["serverpath"];
|
||||
_servertime = systeminfo["servertime"];
|
||||
if (DateTime.TryParse(_servertime, out DateTime date))
|
||||
{
|
||||
_servertime += " (" + date.ToUniversalTime().ToString() + " UTC)";
|
||||
}
|
||||
_installationid = systeminfo["installationid"];
|
||||
|
||||
_detailederrors = systeminfo["detailederrors"];
|
||||
|
@ -42,23 +42,26 @@ namespace Oqtane.Infrastructure
|
||||
Dictionary<string, string> settings = GetSettings(settingRepository.GetSettings(EntityNames.Site, site.SiteId).ToList());
|
||||
|
||||
// purge event log
|
||||
int logretention = 30;
|
||||
if (settings.ContainsKey("LogRetention") && settings["LogRetention"] != "")
|
||||
int retention = 30; // 30 days
|
||||
if (settings.ContainsKey("LogRetention") && !string.IsNullOrEmpty(settings["LogRetention"]))
|
||||
{
|
||||
logretention = int.Parse(settings["LogRetention"]);
|
||||
retention = int.Parse(settings["LogRetention"]);
|
||||
}
|
||||
int count = logRepository.DeleteLogs(logretention);
|
||||
log += count.ToString() + " Event Logs Purged<br />";
|
||||
int count = logRepository.DeleteLogs(retention);
|
||||
log += count.ToString() + " Events Purged<br />";
|
||||
|
||||
// purge visitors
|
||||
int visitorrention = 30;
|
||||
if (settings.ContainsKey("VisitorRetention") && settings["VisitorRetention"] != "")
|
||||
if (site.VisitorTracking)
|
||||
{
|
||||
visitorrention = int.Parse(settings["VisitorRetention"]);
|
||||
retention = 30; // 30 days
|
||||
if (settings.ContainsKey("VisitorRetention") && !string.IsNullOrEmpty(settings["VisitorRetention"]))
|
||||
{
|
||||
retention = int.Parse(settings["VisitorRetention"]);
|
||||
}
|
||||
count = visitorRepository.DeleteVisitors(visitorrention);
|
||||
count = visitorRepository.DeleteVisitors(retention);
|
||||
log += count.ToString() + " Visitors Purged<br />";
|
||||
}
|
||||
}
|
||||
|
||||
return log;
|
||||
}
|
||||
|
Reference in New Issue
Block a user