From 942dddb5e492f4bb591faadec0888aa0feb10648 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Mon, 18 Dec 2017 21:34:13 +0100 Subject: [PATCH] Removed old CDH Migration checker. --- .../Checks/ImportMechanismCheck.cs | 101 ------------------ src/NzbDrone.Core/NzbDrone.Core.csproj | 1 - 2 files changed, 102 deletions(-) delete mode 100644 src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs diff --git a/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs deleted file mode 100644 index 0ef0a3d0b..000000000 --- a/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using NzbDrone.Common.Disk; -using NzbDrone.Core.Configuration; -using NzbDrone.Core.Configuration.Events; -using NzbDrone.Core.Download; -using NzbDrone.Core.Download.Clients; -using NzbDrone.Core.Download.Clients.Nzbget; -using NzbDrone.Core.Download.Clients.Sabnzbd; -using NzbDrone.Core.ThingiProvider.Events; - -namespace NzbDrone.Core.HealthCheck.Checks -{ - [CheckOn(typeof(ProviderUpdatedEvent))] - [CheckOn(typeof(ProviderDeletedEvent))] - [CheckOn(typeof(ConfigSavedEvent))] - public class ImportMechanismCheck : HealthCheckBase - { - private readonly IConfigService _configService; - private readonly IProvideDownloadClient _provideDownloadClient; - - - public ImportMechanismCheck(IConfigService configService, IProvideDownloadClient provideDownloadClient) - { - _configService = configService; - _provideDownloadClient = provideDownloadClient; - } - - public override HealthCheck Check() - { - var droneFactoryFolder = new OsPath(_configService.DownloadedEpisodesFolder); - List downloadClients; - - try - { - downloadClients = _provideDownloadClient.GetDownloadClients().Select(v => new ImportMechanismCheckStatus - { - DownloadClient = v, - Status = v.GetStatus() - }).ToList(); - } - catch (Exception) - { - // One or more download clients failed, assume the health is okay and verify later - return new HealthCheck(GetType()); - } - - var downloadClientIsLocalHost = downloadClients.All(v => v.Status.IsLocalhost); - var downloadClientOutputInDroneFactory = !droneFactoryFolder.IsEmpty && - downloadClients.Any(v => v.Status.OutputRootFolders != null && - v.Status.OutputRootFolders.Any(droneFactoryFolder.Contains)); - - if (!_configService.IsDefined("EnableCompletedDownloadHandling")) - { - // Migration helper logic - if (!downloadClientIsLocalHost) - { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Multi-Computer unsupported)", "Migrating-to-Completed-Download-Handling#Unsupported-download-client-on-different-computer"); - } - - if (downloadClients.All(v => v.DownloadClient is Sabnzbd)) - { - // With Sabnzbd we can check if the category should be changed. - if (downloadClientOutputInDroneFactory) - { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Sabnzbd - Conflicting Category)", "Migrating-to-Completed-Download-Handling#sabnzbd-conflicting-download-client-category"); - } - - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Sabnzbd)", "Migrating-to-Completed-Download-Handling#sabnzbd-enable-completed-download-handling"); - } - - if (downloadClients.All(v => v.DownloadClient is Nzbget)) - { - // With Nzbget we can check if the category should be changed. - if (downloadClientOutputInDroneFactory) - { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Nzbget - Conflicting Category)", "Migrating-to-Completed-Download-Handling#nzbget-conflicting-download-client-category"); - } - - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Nzbget)", "Migrating-to-Completed-Download-Handling#nzbget-enable-completed-download-handling"); - } - - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible", "Migrating-to-Completed-Download-Handling"); - } - - if (!_configService.EnableCompletedDownloadHandling && droneFactoryFolder.IsEmpty) - { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling or configure Drone factory"); - } - - return new HealthCheck(GetType()); - } - } - - public class ImportMechanismCheckStatus - { - public IDownloadClient DownloadClient { get; set; } - public DownloadClientInfo Status { get; set; } - } -} diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 5a3e222e1..80a8e29a2 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -579,7 +579,6 @@ -