2012-06-12 21:38:38 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Ninject;
|
|
|
|
|
using NLog;
|
|
|
|
|
using NzbDrone.Core.Helpers;
|
|
|
|
|
using NzbDrone.Core.Model.Notification;
|
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Jobs
|
|
|
|
|
{
|
|
|
|
|
public class SearchHistoryCleanupJob : IJob
|
|
|
|
|
{
|
|
|
|
|
private readonly SearchHistoryProvider _searchHistoryProvider;
|
|
|
|
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
|
public SearchHistoryCleanupJob(SearchHistoryProvider searchHistoryProvider)
|
|
|
|
|
{
|
|
|
|
|
_searchHistoryProvider = searchHistoryProvider;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public SearchHistoryCleanupJob()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
|
{
|
|
|
|
|
get { return "Search History Cleanup"; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TimeSpan DefaultInterval
|
|
|
|
|
{
|
|
|
|
|
get { return TimeSpan.FromHours(24); }
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-10 21:04:17 +02:00
|
|
|
|
public virtual void Start(ProgressNotification notification, dynamic options)
|
2012-06-12 21:38:38 +02:00
|
|
|
|
{
|
|
|
|
|
Logger.Info("Running search history cleanup.");
|
|
|
|
|
_searchHistoryProvider.Cleanup();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|