Delete favicons that are older than 10 days

This commit is contained in:
erri120 2020-07-10 14:03:07 +02:00
parent 843396f7c4
commit 49eb75c5dc
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135

View File

@ -89,6 +89,18 @@ namespace Wabbajack
Consts.FaviconCacheFolderPath.CreateDirectory();
var faviconIcon = Consts.FaviconCacheFolderPath.Combine($"{Login.SiteName}.ico");
if (faviconIcon.Exists)
{
var fsi = new FileInfo(faviconIcon.ToString());
var creationDate = fsi.CreationTimeUtc;
var now = DateTime.UtcNow;
//delete favicons older than 10 days
if ((now - creationDate).TotalDays > 10)
await faviconIcon.DeleteAsync();
}
if (faviconIcon.Exists)
{
await using var fs = await faviconIcon.OpenRead();