|
|
@ -17,23 +17,21 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
|
|
|
|
|
|
|
|
|
|
|
|
public void Clean()
|
|
|
|
public void Clean()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
using (var mapper = _database.OpenConnection())
|
|
|
|
using var mapper = _database.OpenConnection();
|
|
|
|
{
|
|
|
|
var usedTags = new[] { "Notifications", "IndexerProxies", "Indexers", "Applications" }
|
|
|
|
var usedTags = new[] { "Notifications", "IndexerProxies", "Indexers", "Applications" }
|
|
|
|
.SelectMany(v => GetUsedTags(v, mapper))
|
|
|
|
.SelectMany(v => GetUsedTags(v, mapper))
|
|
|
|
.Distinct()
|
|
|
|
.Distinct()
|
|
|
|
.ToArray();
|
|
|
|
.ToArray();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (usedTags.Length > 0)
|
|
|
|
if (usedTags.Length > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var usedTagsList = string.Join(",", usedTags.Select(d => d.ToString()).ToArray());
|
|
|
|
var usedTagsList = string.Join(",", usedTags.Select(d => d.ToString()).ToArray());
|
|
|
|
|
|
|
|
|
|
|
|
mapper.Execute($"DELETE FROM \"Tags\" WHERE NOT \"Id\" IN ({usedTagsList})");
|
|
|
|
mapper.Execute($"DELETE FROM \"Tags\" WHERE NOT \"Id\" IN ({usedTagsList})");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mapper.Execute($"DELETE FROM \"Tags\"");
|
|
|
|
mapper.Execute("DELETE FROM \"Tags\"");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|