1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +01:00

New: Translations support for Health Checks

This commit is contained in:
Qstick 2020-07-08 10:40:08 -04:00
parent 200c7487b9
commit bfc0361784
36 changed files with 247 additions and 72 deletions

View File

@ -1,6 +1,8 @@
using NUnit.Framework; using Moq;
using NUnit.Framework;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
@ -9,6 +11,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[TestFixture] [TestFixture]
public class AppDataLocationFixture : CoreTest<AppDataLocationCheck> public class AppDataLocationFixture : CoreTest<AppDataLocationCheck>
{ {
[SetUp]
public void Setup()
{
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
}
[Test] [Test]
public void should_return_warning_when_app_data_is_child_of_startup_folder() public void should_return_warning_when_app_data_is_child_of_startup_folder()
{ {

View File

@ -1,7 +1,9 @@
using System; using System;
using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -9,6 +11,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[TestFixture] [TestFixture]
public class DotnetVersionCheckFixture : CoreTest<DotnetVersionCheck> public class DotnetVersionCheckFixture : CoreTest<DotnetVersionCheck>
{ {
[SetUp]
public void Setup()
{
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
}
private void GivenOutput(string version) private void GivenOutput(string version)
{ {
WindowsOnly(); WindowsOnly();

View File

@ -1,8 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -10,6 +12,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[TestFixture] [TestFixture]
public class DownloadClientCheckFixture : CoreTest<DownloadClientCheck> public class DownloadClientCheckFixture : CoreTest<DownloadClientCheck>
{ {
[SetUp]
public void Setup()
{
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
}
[Test] [Test]
public void should_return_warning_when_download_client_has_not_been_configured() public void should_return_warning_when_download_client_has_not_been_configured()
{ {

View File

@ -1,6 +1,8 @@
using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -8,6 +10,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[TestFixture] [TestFixture]
public class ImportMechanismCheckFixture : CoreTest<ImportMechanismCheck> public class ImportMechanismCheckFixture : CoreTest<ImportMechanismCheck>
{ {
[SetUp]
public void Setup()
{
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
}
private void GivenCompletedDownloadHandling(bool? enabled = null) private void GivenCompletedDownloadHandling(bool? enabled = null)
{ {
if (enabled.HasValue) if (enabled.HasValue)

View File

@ -1,8 +1,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -22,6 +23,10 @@ public void SetUp()
Mocker.GetMock<IIndexerFactory>() Mocker.GetMock<IIndexerFactory>()
.Setup(s => s.RssEnabled(It.IsAny<bool>())) .Setup(s => s.RssEnabled(It.IsAny<bool>()))
.Returns(new List<IIndexer>()); .Returns(new List<IIndexer>());
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
} }
private void GivenIndexer(bool supportsRss, bool supportsSearch) private void GivenIndexer(bool supportsRss, bool supportsSearch)
@ -47,6 +52,10 @@ private void GivenRssFiltered()
Mocker.GetMock<IIndexerFactory>() Mocker.GetMock<IIndexerFactory>()
.Setup(s => s.RssEnabled(false)) .Setup(s => s.RssEnabled(false))
.Returns(new List<IIndexer> { _indexerMock.Object }); .Returns(new List<IIndexer> { _indexerMock.Object });
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("recent indexer errors");
} }
[Test] [Test]

View File

@ -1,8 +1,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -26,6 +27,10 @@ public void SetUp()
Mocker.GetMock<IIndexerFactory>() Mocker.GetMock<IIndexerFactory>()
.Setup(s => s.InteractiveSearchEnabled(It.IsAny<bool>())) .Setup(s => s.InteractiveSearchEnabled(It.IsAny<bool>()))
.Returns(new List<IIndexer>()); .Returns(new List<IIndexer>());
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
} }
private void GivenIndexer(bool supportsRss, bool supportsSearch) private void GivenIndexer(bool supportsRss, bool supportsSearch)
@ -62,6 +67,10 @@ private void GivenSearchFiltered()
Mocker.GetMock<IIndexerFactory>() Mocker.GetMock<IIndexerFactory>()
.Setup(s => s.InteractiveSearchEnabled(false)) .Setup(s => s.InteractiveSearchEnabled(false))
.Returns(new List<IIndexer> { _indexerMock.Object }); .Returns(new List<IIndexer> { _indexerMock.Object });
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("recent indexer errors");
} }
[Test] [Test]

View File

@ -4,6 +4,7 @@
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -24,6 +25,10 @@ public void SetUp()
Mocker.GetMock<IIndexerStatusService>() Mocker.GetMock<IIndexerStatusService>()
.Setup(v => v.GetBlockedProviders()) .Setup(v => v.GetBlockedProviders())
.Returns(_blockedIndexers); .Returns(_blockedIndexers);
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
} }
private Mock<IIndexer> GivenIndexer(int i, double backoffHours, double failureHours) private Mock<IIndexer> GivenIndexer(int i, double backoffHours, double failureHours)

View File

@ -1,7 +1,9 @@
using System; using System;
using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -9,6 +11,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[TestFixture] [TestFixture]
public class MonoVersionCheckFixture : CoreTest<MonoVersionCheck> public class MonoVersionCheckFixture : CoreTest<MonoVersionCheck>
{ {
[SetUp]
public void Setup()
{
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
}
private void GivenOutput(string version) private void GivenOutput(string version)
{ {
MonoOnly(); MonoOnly();

View File

@ -3,6 +3,7 @@
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.NetImport; using NzbDrone.Core.NetImport;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
@ -24,6 +25,10 @@ public void SetUp()
Mocker.GetMock<INetImportStatusService>() Mocker.GetMock<INetImportStatusService>()
.Setup(v => v.GetBlockedProviders()) .Setup(v => v.GetBlockedProviders())
.Returns(_blockedLists); .Returns(_blockedLists);
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
} }
private Mock<INetImport> GivenList(int i, double backoffHours, double failureHours) private Mock<INetImport> GivenList(int i, double backoffHours, double failureHours)

View File

@ -1,6 +1,8 @@
using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -8,6 +10,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[TestFixture] [TestFixture]
public class ReleaseBranchCheckFixture : CoreTest<ReleaseBranchCheck> public class ReleaseBranchCheckFixture : CoreTest<ReleaseBranchCheck>
{ {
[SetUp]
public void Setup()
{
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
}
private void GivenValidBranch(string branch) private void GivenValidBranch(string branch)
{ {
Mocker.GetMock<IConfigFileProvider>() Mocker.GetMock<IConfigFileProvider>()

View File

@ -1,15 +1,25 @@
using System.Collections.Generic; using System.Collections.Generic;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
{ {
[TestFixture] [TestFixture]
public class RemovedSeriesCheckFixture : CoreTest<RemovedSeriesCheck> public class RemovedMovieCheckFixture : CoreTest<RemovedMovieCheck>
{ {
[SetUp]
public void Setup()
{
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
}
private void GivenMovie(int amount, int deleted) private void GivenMovie(int amount, int deleted)
{ {
List<Movie> movie; List<Movie> movie;

View File

@ -5,6 +5,7 @@
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common.Disk; using NzbDrone.Common.Disk;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
@ -13,6 +14,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[TestFixture] [TestFixture]
public class RootFolderCheckFixture : CoreTest<RootFolderCheck> public class RootFolderCheckFixture : CoreTest<RootFolderCheck>
{ {
[SetUp]
public void Setup()
{
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
}
private void GivenMissingRootFolder() private void GivenMissingRootFolder()
{ {
var movies = Builder<Movie>.CreateListOfSize(1) var movies = Builder<Movie>.CreateListOfSize(1)

View File

@ -1,9 +1,10 @@
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common.Disk; using NzbDrone.Common.Disk;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Update; using NzbDrone.Core.Update;
@ -12,6 +13,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[TestFixture] [TestFixture]
public class UpdateCheckFixture : CoreTest<UpdateCheck> public class UpdateCheckFixture : CoreTest<UpdateCheck>
{ {
[SetUp]
public void Setup()
{
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
}
[Test] [Test]
public void should_return_error_when_app_folder_is_write_protected() public void should_return_error_when_app_folder_is_write_protected()
{ {

View File

@ -1,5 +1,6 @@
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Localization;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
{ {
@ -7,7 +8,8 @@ public class AppDataLocationCheck : HealthCheckBase
{ {
private readonly IAppFolderInfo _appFolderInfo; private readonly IAppFolderInfo _appFolderInfo;
public AppDataLocationCheck(IAppFolderInfo appFolderInfo) public AppDataLocationCheck(IAppFolderInfo appFolderInfo, ILocalizationService localizationService)
: base(localizationService)
{ {
_appFolderInfo = appFolderInfo; _appFolderInfo = appFolderInfo;
} }
@ -17,7 +19,7 @@ public override HealthCheck Check()
if (_appFolderInfo.StartUpFolder.IsParentPath(_appFolderInfo.AppDataFolder) || if (_appFolderInfo.StartUpFolder.IsParentPath(_appFolderInfo.AppDataFolder) ||
_appFolderInfo.StartUpFolder.PathEquals(_appFolderInfo.AppDataFolder)) _appFolderInfo.StartUpFolder.PathEquals(_appFolderInfo.AppDataFolder))
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Updating will not be possible to prevent deleting AppData on Update"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("AppDataLocationHealthCheckMessage"));
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

View File

@ -1,6 +1,7 @@
using System; using System;
using NLog; using NLog;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.Localization;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
{ {
@ -10,7 +11,8 @@ public class DotnetVersionCheck : HealthCheckBase
private readonly IOsInfo _osInfo; private readonly IOsInfo _osInfo;
private readonly Logger _logger; private readonly Logger _logger;
public DotnetVersionCheck(IPlatformInfo platformInfo, IOsInfo osInfo, Logger logger) public DotnetVersionCheck(IPlatformInfo platformInfo, IOsInfo osInfo, ILocalizationService localizationService, Logger logger)
: base(localizationService)
{ {
_platformInfo = platformInfo; _platformInfo = platformInfo;
_osInfo = osInfo; _osInfo = osInfo;
@ -47,13 +49,13 @@ public override HealthCheck Check()
_logger.Debug("Dotnet version is {0} or better: {1}", stableVersion, dotnetVersion); _logger.Debug("Dotnet version is {0} or better: {1}", stableVersion, dotnetVersion);
return new HealthCheck(GetType(), return new HealthCheck(GetType(),
HealthCheckResult.Notice, HealthCheckResult.Notice,
$"Currently installed .Net Framework {dotnetVersion} is supported but we recommend upgrading to at least {targetVersion}.", string.Format(_localizationService.GetLocalizedString("DotNetVersionCheckNotRecommendedMessage"), dotnetVersion, targetVersion),
"#currently-installed-net-framework-is-supported-but-upgrading-is-recommended"); "#currently-installed-net-framework-is-supported-but-upgrading-is-recommended");
} }
return new HealthCheck(GetType(), return new HealthCheck(GetType(),
HealthCheckResult.Error, HealthCheckResult.Error,
$"Currently installed .Net Framework {dotnetVersion} is old and unsupported. Please upgrade the .Net Framework to at least {targetVersion}.", string.Format(_localizationService.GetLocalizedString("DotNetVersionCheckOldUnsupportedMessage"), dotnetVersion, targetVersion),
"#currently-installed-net-framework-is-old-and-unsupported"); "#currently-installed-net-framework-is-old-and-unsupported");
} }

View File

@ -2,6 +2,7 @@
using System.Linq; using System.Linq;
using NLog; using NLog;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Localization;
using NzbDrone.Core.ThingiProvider.Events; using NzbDrone.Core.ThingiProvider.Events;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
@ -15,7 +16,8 @@ public class DownloadClientCheck : HealthCheckBase
private readonly IProvideDownloadClient _downloadClientProvider; private readonly IProvideDownloadClient _downloadClientProvider;
private readonly Logger _logger; private readonly Logger _logger;
public DownloadClientCheck(IProvideDownloadClient downloadClientProvider, Logger logger) public DownloadClientCheck(IProvideDownloadClient downloadClientProvider, ILocalizationService localizationService, Logger logger)
: base(localizationService)
{ {
_downloadClientProvider = downloadClientProvider; _downloadClientProvider = downloadClientProvider;
_logger = logger; _logger = logger;
@ -27,7 +29,7 @@ public override HealthCheck Check()
if (!downloadClients.Any()) if (!downloadClients.Any())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "No download client is available"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("DownloadClientCheckNoneAvailableMessage"));
} }
foreach (var downloadClient in downloadClients) foreach (var downloadClient in downloadClients)
@ -40,7 +42,7 @@ public override HealthCheck Check()
{ {
_logger.Debug(ex, "Unable to communicate with {0}", downloadClient.Definition.Name); _logger.Debug(ex, "Unable to communicate with {0}", downloadClient.Definition.Name);
var message = $"Unable to communicate with {downloadClient.Definition.Name}."; var message = string.Format(_localizationService.GetLocalizedString("DownloadClientCheckUnableToCommunicateMessage"), downloadClient.Definition.Name);
return new HealthCheck(GetType(), HealthCheckResult.Error, $"{message} {ex.Message}", "#unable-to-communicate-with-download-client"); return new HealthCheck(GetType(), HealthCheckResult.Error, $"{message} {ex.Message}", "#unable-to-communicate-with-download-client");
} }
} }

View File

@ -1,6 +1,7 @@
using System.Linq; using System.Linq;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Localization;
using NzbDrone.Core.ThingiProvider.Events; using NzbDrone.Core.ThingiProvider.Events;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
@ -13,7 +14,8 @@ public class DownloadClientStatusCheck : HealthCheckBase
private readonly IDownloadClientFactory _providerFactory; private readonly IDownloadClientFactory _providerFactory;
private readonly IDownloadClientStatusService _providerStatusService; private readonly IDownloadClientStatusService _providerStatusService;
public DownloadClientStatusCheck(IDownloadClientFactory providerFactory, IDownloadClientStatusService providerStatusService) public DownloadClientStatusCheck(IDownloadClientFactory providerFactory, IDownloadClientStatusService providerStatusService, ILocalizationService localizationService)
: base(localizationService)
{ {
_providerFactory = providerFactory; _providerFactory = providerFactory;
_providerStatusService = providerStatusService; _providerStatusService = providerStatusService;
@ -35,10 +37,10 @@ public override HealthCheck Check()
if (backOffProviders.Count == enabledProviders.Count) if (backOffProviders.Count == enabledProviders.Count)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, "All download clients are unavailable due to failures", "#download-clients-are-unavailable-due-to-failures"); return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("DownloadClientStatusCheckAllClientMessage"), "#download-clients-are-unavailable-due-to-failures");
} }
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Download clients unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#download-clients-are-unavailable-due-to-failures"); return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("DownloadClientStatusCheckSingleClientMessage"), string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#download-clients-are-unavailable-due-to-failures");
} }
} }
} }

View File

@ -1,6 +1,7 @@
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Configuration.Events; using NzbDrone.Core.Configuration.Events;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Localization;
using NzbDrone.Core.ThingiProvider.Events; using NzbDrone.Core.ThingiProvider.Events;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
@ -12,7 +13,8 @@ public class ImportMechanismCheck : HealthCheckBase
{ {
private readonly IConfigService _configService; private readonly IConfigService _configService;
public ImportMechanismCheck(IConfigService configService) public ImportMechanismCheck(IConfigService configService, ILocalizationService localizationService)
: base(localizationService)
{ {
_configService = configService; _configService = configService;
} }
@ -21,7 +23,7 @@ public override HealthCheck Check()
{ {
if (!_configService.EnableCompletedDownloadHandling) if (!_configService.EnableCompletedDownloadHandling)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("ImportMechanismHealthCheckMessage"));
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

View File

@ -1,5 +1,6 @@
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Localization;
using NzbDrone.Core.ThingiProvider.Events; using NzbDrone.Core.ThingiProvider.Events;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
@ -12,7 +13,8 @@ public class IndexerRssCheck : HealthCheckBase
{ {
private readonly IIndexerFactory _indexerFactory; private readonly IIndexerFactory _indexerFactory;
public IndexerRssCheck(IIndexerFactory indexerFactory) public IndexerRssCheck(IIndexerFactory indexerFactory, ILocalizationService localizationService)
: base(localizationService)
{ {
_indexerFactory = indexerFactory; _indexerFactory = indexerFactory;
} }
@ -23,14 +25,14 @@ public override HealthCheck Check()
if (enabled.Empty()) if (enabled.Empty())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, "No indexers available with RSS sync enabled, Radarr will not grab new releases automatically"); return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("IndexerRssHealthCheckNoIndexers"));
} }
var active = _indexerFactory.RssEnabled(true); var active = _indexerFactory.RssEnabled(true);
if (active.Empty()) if (active.Empty())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "All rss-capable indexers are temporarily unavailable due to recent indexer errors"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerRssHealthCheckNoAvailableIndexers"));
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

View File

@ -1,5 +1,6 @@
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Localization;
using NzbDrone.Core.ThingiProvider.Events; using NzbDrone.Core.ThingiProvider.Events;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
@ -12,7 +13,8 @@ public class IndexerSearchCheck : HealthCheckBase
{ {
private readonly IIndexerFactory _indexerFactory; private readonly IIndexerFactory _indexerFactory;
public IndexerSearchCheck(IIndexerFactory indexerFactory) public IndexerSearchCheck(IIndexerFactory indexerFactory, ILocalizationService localizationService)
: base(localizationService)
{ {
_indexerFactory = indexerFactory; _indexerFactory = indexerFactory;
} }
@ -23,21 +25,21 @@ public override HealthCheck Check()
if (automaticSearchEnabled.Empty()) if (automaticSearchEnabled.Empty())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Automatic Search enabled, Radarr will not provide any automatic search results"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAutomaticMessage"));
} }
var interactiveSearchEnabled = _indexerFactory.InteractiveSearchEnabled(false); var interactiveSearchEnabled = _indexerFactory.InteractiveSearchEnabled(false);
if (interactiveSearchEnabled.Empty()) if (interactiveSearchEnabled.Empty())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Interactive Search enabled, Radarr will not provide any interactive search results"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoInteractiveMessage"));
} }
var active = _indexerFactory.AutomaticSearchEnabled(true); var active = _indexerFactory.AutomaticSearchEnabled(true);
if (active.Empty()) if (active.Empty())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "All search-capable indexers are temporarily unavailable due to recent indexer errors"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAvailableIndexersMessage"));
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

View File

@ -1,6 +1,7 @@
using System.Linq; using System.Linq;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Localization;
using NzbDrone.Core.ThingiProvider.Events; using NzbDrone.Core.ThingiProvider.Events;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
@ -13,7 +14,8 @@ public class IndexerStatusCheck : HealthCheckBase
private readonly IIndexerFactory _providerFactory; private readonly IIndexerFactory _providerFactory;
private readonly IIndexerStatusService _providerStatusService; private readonly IIndexerStatusService _providerStatusService;
public IndexerStatusCheck(IIndexerFactory providerFactory, IIndexerStatusService providerStatusService) public IndexerStatusCheck(IIndexerFactory providerFactory, IIndexerStatusService providerStatusService, ILocalizationService localizationService)
: base(localizationService)
{ {
_providerFactory = providerFactory; _providerFactory = providerFactory;
_providerStatusService = providerStatusService; _providerStatusService = providerStatusService;
@ -35,10 +37,10 @@ public override HealthCheck Check()
if (backOffProviders.Count == enabledProviders.Count) if (backOffProviders.Count == enabledProviders.Count)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, "All indexers are unavailable due to failures", "#indexers-are-unavailable-due-to-failures"); return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("IndexerStatusCheckAllClientMessage"), "#indexers-are-unavailable-due-to-failures");
} }
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Indexers unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#indexers-are-unavailable-due-to-failures"); return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("IndexerStatusCheckSingleClientMessage"), string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#indexers-are-unavailable-due-to-failures");
} }
} }
} }

View File

@ -1,11 +1,17 @@
using System; using System;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using NzbDrone.Core.Localization;
using NzbDrone.Core.MediaFiles.MediaInfo; using NzbDrone.Core.MediaFiles.MediaInfo;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
{ {
public class MediaInfoDllCheck : HealthCheckBase public class MediaInfoDllCheck : HealthCheckBase
{ {
public MediaInfoDllCheck(ILocalizationService localizationService)
: base(localizationService)
{
}
[MethodImpl(MethodImplOptions.NoOptimization)] [MethodImpl(MethodImplOptions.NoOptimization)]
public override HealthCheck Check() public override HealthCheck Check()
{ {
@ -15,7 +21,7 @@ public override HealthCheck Check()
} }
catch (Exception e) catch (Exception e)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, $"MediaInfo Library could not be loaded {e.Message}"); return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("MediaInfoDllCheckMessage"), e.Message));
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

View File

@ -1,7 +1,8 @@
using System.Diagnostics; using System.Diagnostics;
using NLog; using NLog;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Localization;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
{ {
@ -12,7 +13,8 @@ public class MonoDebugCheck : HealthCheckBase
public override bool CheckOnSchedule => false; public override bool CheckOnSchedule => false;
public MonoDebugCheck(Logger logger, StackFrameHelper stackFrameHelper) public MonoDebugCheck(Logger logger, StackFrameHelper stackFrameHelper, ILocalizationService localizationService)
: base(localizationService)
{ {
_logger = logger; _logger = logger;
_stackFrameHelper = stackFrameHelper; _stackFrameHelper = stackFrameHelper;

View File

@ -1,8 +1,9 @@
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using NLog; using NLog;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Processes; using NzbDrone.Common.Processes;
using NzbDrone.Core.Localization;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
{ {
@ -14,7 +15,9 @@ public class MonoNotNetCoreCheck : HealthCheckBase
public MonoNotNetCoreCheck(IOsInfo osInfo, public MonoNotNetCoreCheck(IOsInfo osInfo,
IProcessProvider processProvider, IProcessProvider processProvider,
ILocalizationService localizationService,
Logger logger) Logger logger)
: base(localizationService)
{ {
_osInfo = osInfo; _osInfo = osInfo;
_processProvider = processProvider; _processProvider = processProvider;
@ -42,7 +45,7 @@ public override HealthCheck Check()
return new HealthCheck(GetType(), return new HealthCheck(GetType(),
HealthCheckResult.Warning, HealthCheckResult.Warning,
"Please upgrade to the .NET Core version of Radarr", _localizationService.GetLocalizedString("MonoNotNetCoreCheckMessage"),
"#update-to-net-core-version"); "#update-to-net-core-version");
} }

View File

@ -1,8 +1,9 @@
using System; using System;
using NLog; using NLog;
using NLog.Fluent; using NLog.Fluent;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Instrumentation.Extensions; using NzbDrone.Common.Instrumentation.Extensions;
using NzbDrone.Core.Localization;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
{ {
@ -11,7 +12,8 @@ public class MonoTlsCheck : HealthCheckBase
private readonly IPlatformInfo _platformInfo; private readonly IPlatformInfo _platformInfo;
private readonly Logger _logger; private readonly Logger _logger;
public MonoTlsCheck(IPlatformInfo platformInfo, Logger logger) public MonoTlsCheck(IPlatformInfo platformInfo, ILocalizationService localizationService, Logger logger)
: base(localizationService)
{ {
_platformInfo = platformInfo; _platformInfo = platformInfo;
_logger = logger; _logger = logger;
@ -33,7 +35,7 @@ public override HealthCheck Check()
.WriteSentryDebug("LegacyTlsProvider", monoVersion.ToString()) .WriteSentryDebug("LegacyTlsProvider", monoVersion.ToString())
.Write(); .Write();
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Sonarr Mono 4.x tls workaround still enabled, consider removing MONO_TLS_PROVIDER=legacy environment option"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("MonoTlsCheckMessage"));
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

View File

@ -1,6 +1,7 @@
using System; using System;
using NLog; using NLog;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.Localization;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
{ {
@ -9,7 +10,8 @@ public class MonoVersionCheck : HealthCheckBase
private readonly IPlatformInfo _platformInfo; private readonly IPlatformInfo _platformInfo;
private readonly Logger _logger; private readonly Logger _logger;
public MonoVersionCheck(IPlatformInfo platformInfo, Logger logger) public MonoVersionCheck(IPlatformInfo platformInfo, ILocalizationService localizationService, Logger logger)
: base(localizationService)
{ {
_platformInfo = platformInfo; _platformInfo = platformInfo;
_logger = logger; _logger = logger;

View File

@ -1,6 +1,7 @@
using System.Linq; using System.Linq;
using NzbDrone.Common.Disk; using NzbDrone.Common.Disk;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
@ -10,7 +11,8 @@ public class MountCheck : HealthCheckBase
private readonly IDiskProvider _diskProvider; private readonly IDiskProvider _diskProvider;
private readonly IMovieService _movieService; private readonly IMovieService _movieService;
public MountCheck(IDiskProvider diskProvider, IMovieService movieService) public MountCheck(IDiskProvider diskProvider, IMovieService movieService, ILocalizationService localizationService)
: base(localizationService)
{ {
_diskProvider = diskProvider; _diskProvider = diskProvider;
_movieService = movieService; _movieService = movieService;
@ -27,7 +29,7 @@ public override HealthCheck Check()
if (mounts.Any()) if (mounts.Any())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, "Mount containing a movie path is mounted read-only: " + string.Join(",", mounts.Select(m => m.Name)), "#movie-mount-ro"); return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("MountCheckMessage") + string.Join(", ", mounts.Select(m => m.Name)), "#movie-mount-ro");
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

View File

@ -1,5 +1,6 @@
using System.Linq; using System.Linq;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Localization;
using NzbDrone.Core.NetImport; using NzbDrone.Core.NetImport;
using NzbDrone.Core.ThingiProvider.Events; using NzbDrone.Core.ThingiProvider.Events;
@ -13,7 +14,8 @@ public class NetImportStatusCheck : HealthCheckBase
private readonly INetImportFactory _providerFactory; private readonly INetImportFactory _providerFactory;
private readonly INetImportStatusService _providerStatusService; private readonly INetImportStatusService _providerStatusService;
public NetImportStatusCheck(INetImportFactory providerFactory, INetImportStatusService providerStatusService) public NetImportStatusCheck(INetImportFactory providerFactory, INetImportStatusService providerStatusService, ILocalizationService localizationService)
: base(localizationService)
{ {
_providerFactory = providerFactory; _providerFactory = providerFactory;
_providerStatusService = providerStatusService; _providerStatusService = providerStatusService;
@ -35,10 +37,10 @@ public override HealthCheck Check()
if (backOffProviders.Count == enabledProviders.Count) if (backOffProviders.Count == enabledProviders.Count)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, "All lists are unavailable due to failures", "#lists-are-unavailable-due-to-failures"); return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("NetImportStatusCheckAllClientMessage"), "#lists-are-unavailable-due-to-failures");
} }
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Lists unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#lists-are-unavailable-due-to-failures"); return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("NetImportStatusCheckSingleClientMessage"), string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#lists-are-unavailable-due-to-failures");
} }
} }
} }

View File

@ -2,6 +2,7 @@
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Indexers.PassThePopcorn; using NzbDrone.Core.Indexers.PassThePopcorn;
using NzbDrone.Core.Localization;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
{ {
@ -9,7 +10,8 @@ public class PTPOldSettingsCheck : HealthCheckBase
{ {
private readonly IIndexerFactory _indexerFactory; private readonly IIndexerFactory _indexerFactory;
public PTPOldSettingsCheck(IIndexerFactory indexerFactory) public PTPOldSettingsCheck(IIndexerFactory indexerFactory, ILocalizationService localizationService)
: base(localizationService)
{ {
_indexerFactory = indexerFactory; _indexerFactory = indexerFactory;
} }
@ -23,7 +25,7 @@ public override HealthCheck Check()
if (ptpIndexerOldSettings.Count() > 0) if (ptpIndexerOldSettings.Count() > 0)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, $"The following PassThePopcorn indexers have deprecated settings and should be updated: {string.Join(",", ptpIndexerOldSettings)}"); return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("PtpOldSettingsCheckMessage"), string.Join(", ", ptpIndexerOldSettings)));
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using NLog; using NLog;
@ -6,6 +6,7 @@
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Configuration.Events; using NzbDrone.Core.Configuration.Events;
using NzbDrone.Core.Localization;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
{ {
@ -18,7 +19,8 @@ public class ProxyCheck : HealthCheckBase
private readonly IHttpRequestBuilderFactory _cloudRequestBuilder; private readonly IHttpRequestBuilderFactory _cloudRequestBuilder;
public ProxyCheck(IRadarrCloudRequestBuilder cloudRequestBuilder, IConfigService configService, IHttpClient client, Logger logger) public ProxyCheck(IRadarrCloudRequestBuilder cloudRequestBuilder, IConfigService configService, IHttpClient client, ILocalizationService localizationService, Logger logger)
: base(localizationService)
{ {
_configService = configService; _configService = configService;
_client = client; _client = client;
@ -34,7 +36,7 @@ public override HealthCheck Check()
var addresses = Dns.GetHostAddresses(_configService.ProxyHostname); var addresses = Dns.GetHostAddresses(_configService.ProxyHostname);
if (!addresses.Any()) if (!addresses.Any())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Failed to resolve the IP Address for the Configured Proxy Host {0}", _configService.ProxyHostname)); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckResolveIpMessage"), _configService.ProxyHostname));
} }
var request = _cloudRequestBuilder.Create() var request = _cloudRequestBuilder.Create()
@ -49,13 +51,13 @@ public override HealthCheck Check()
if (response.StatusCode == HttpStatusCode.BadRequest) if (response.StatusCode == HttpStatusCode.BadRequest)
{ {
_logger.Error("Proxy Health Check failed: {0}", response.StatusCode); _logger.Error("Proxy Health Check failed: {0}", response.StatusCode);
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy. StatusCode: {response.StatusCode}"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckBadRequestMessage"), response.StatusCode));
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Proxy Health Check failed"); _logger.Error(ex, "Proxy Health Check failed");
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy: {request.Url}"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckFailedToTestMessage"), request.Url));
} }
} }

View File

@ -2,6 +2,7 @@
using System.Linq; using System.Linq;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Configuration.Events; using NzbDrone.Core.Configuration.Events;
using NzbDrone.Core.Localization;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
{ {
@ -10,7 +11,8 @@ public class ReleaseBranchCheck : HealthCheckBase
{ {
private readonly IConfigFileProvider _configFileService; private readonly IConfigFileProvider _configFileService;
public ReleaseBranchCheck(IConfigFileProvider configFileService) public ReleaseBranchCheck(IConfigFileProvider configFileService, ILocalizationService localizationService)
: base(localizationService)
{ {
_configFileService = configFileService; _configFileService = configFileService;
} }
@ -23,10 +25,10 @@ public override HealthCheck Check()
{ {
if (currentBranch == "develop" || currentBranch == "nightly") if (currentBranch == "develop" || currentBranch == "nightly")
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Branch {0} is for a previous version of Radarr, set branch to 'Aphrodite' for further updates", _configFileService.Branch), "#branch-is-for-a-previous-version"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ReleaseBranchCheckPreviousVersionMessage"), _configFileService.Branch), "#branch-is-for-a-previous-version");
} }
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Branch {0} is not a valid Radarr release branch, you will not receive updates", _configFileService.Branch), "#branch-is-not-a-valid-release-branch"); return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("ReleaseBranchCheckOfficialBranchMessage"), _configFileService.Branch), "#branch-is-not-a-valid-release-branch");
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

View File

@ -8,6 +8,7 @@
using NzbDrone.Core.Datastore.Events; using NzbDrone.Core.Datastore.Events;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Download.Clients; using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Localization;
using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.RemotePathMappings;
using NzbDrone.Core.ThingiProvider.Events; using NzbDrone.Core.ThingiProvider.Events;
@ -30,7 +31,9 @@ public class RemotePathMappingCheck : HealthCheckBase, IProvideHealthCheck
public RemotePathMappingCheck(IDiskProvider diskProvider, public RemotePathMappingCheck(IDiskProvider diskProvider,
IProvideDownloadClient downloadClientProvider, IProvideDownloadClient downloadClientProvider,
IOsInfo osInfo, IOsInfo osInfo,
Logger logger) Logger logger,
ILocalizationService localizationService)
: base(localizationService)
{ {
_diskProvider = diskProvider; _diskProvider = diskProvider;
_downloadClientProvider = downloadClientProvider; _downloadClientProvider = downloadClientProvider;

View File

@ -1,5 +1,6 @@
using System.Linq; using System.Linq;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using NzbDrone.Core.Movies.Events; using NzbDrone.Core.Movies.Events;
@ -7,11 +8,12 @@ namespace NzbDrone.Core.HealthCheck.Checks
{ {
[CheckOn(typeof(MovieUpdatedEvent))] [CheckOn(typeof(MovieUpdatedEvent))]
[CheckOn(typeof(MoviesDeletedEvent), CheckOnCondition.FailedOnly)] [CheckOn(typeof(MoviesDeletedEvent), CheckOnCondition.FailedOnly)]
public class RemovedSeriesCheck : HealthCheckBase, ICheckOnCondition<MovieUpdatedEvent>, ICheckOnCondition<MoviesDeletedEvent> public class RemovedMovieCheck : HealthCheckBase, ICheckOnCondition<MovieUpdatedEvent>, ICheckOnCondition<MoviesDeletedEvent>
{ {
private readonly IMovieService _movieService; private readonly IMovieService _movieService;
public RemovedSeriesCheck(IMovieService movieService) public RemovedMovieCheck(IMovieService movieService, ILocalizationService localizationService)
: base(localizationService)
{ {
_movieService = movieService; _movieService = movieService;
} }
@ -29,10 +31,10 @@ public override HealthCheck Check()
if (deletedMovie.Count == 1) if (deletedMovie.Count == 1)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Movie {0} was removed from TMDb", movieText), "#movie-was-removed-from-tmdb"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemovedMovieCheckSingleMessage"), movieText), "#movie-was-removed-from-tmdb");
} }
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Movie {0} was removed from TMDb", movieText), "#movie-was-removed-from-tmdb"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemovedMovieCheckMultipleMessage"), movieText), "#movie-was-removed-from-tmdb");
} }
public bool ShouldCheckOnEvent(MoviesDeletedEvent message) public bool ShouldCheckOnEvent(MoviesDeletedEvent message)

View File

@ -1,5 +1,6 @@
using System.Linq; using System.Linq;
using NzbDrone.Common.Disk; using NzbDrone.Common.Disk;
using NzbDrone.Core.Localization;
using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using NzbDrone.Core.Movies.Events; using NzbDrone.Core.Movies.Events;
@ -17,7 +18,8 @@ public class RootFolderCheck : HealthCheckBase
private readonly IDiskProvider _diskProvider; private readonly IDiskProvider _diskProvider;
private readonly IRootFolderService _rootFolderService; private readonly IRootFolderService _rootFolderService;
public RootFolderCheck(IMovieService movieService, IDiskProvider diskProvider, IRootFolderService rootFolderService) public RootFolderCheck(IMovieService movieService, IDiskProvider diskProvider, IRootFolderService rootFolderService, ILocalizationService localizationService)
: base(localizationService)
{ {
_movieService = movieService; _movieService = movieService;
_diskProvider = diskProvider; _diskProvider = diskProvider;
@ -37,10 +39,10 @@ public override HealthCheck Check()
{ {
if (missingRootFolders.Count == 1) if (missingRootFolders.Count == 1)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, "Missing root folder: " + missingRootFolders.First(), "#missing-root-folder"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RootFolderCheckSingleMessage"), missingRootFolders.First()), "#missing-root-folder");
} }
var message = string.Format("Multiple root folders are missing: {0}", string.Join(" | ", missingRootFolders)); var message = string.Format(_localizationService.GetLocalizedString("RootFolderCheckMultipleMessage"), string.Join(" | ", missingRootFolders));
return new HealthCheck(GetType(), HealthCheckResult.Error, message, "#missing-root-folder"); return new HealthCheck(GetType(), HealthCheckResult.Error, message, "#missing-root-folder");
} }

View File

@ -5,6 +5,7 @@
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Configuration.Events; using NzbDrone.Core.Configuration.Events;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Update; using NzbDrone.Core.Update;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
@ -22,7 +23,9 @@ public UpdateCheck(IDiskProvider diskProvider,
IAppFolderInfo appFolderInfo, IAppFolderInfo appFolderInfo,
ICheckUpdateService checkUpdateService, ICheckUpdateService checkUpdateService,
IConfigFileProvider configFileProvider, IConfigFileProvider configFileProvider,
IOsInfo osInfo) IOsInfo osInfo,
ILocalizationService localizationService)
: base(localizationService)
{ {
_diskProvider = diskProvider; _diskProvider = diskProvider;
_appFolderInfo = appFolderInfo; _appFolderInfo = appFolderInfo;
@ -44,7 +47,7 @@ public override HealthCheck Check()
{ {
return new HealthCheck(GetType(), return new HealthCheck(GetType(),
HealthCheckResult.Error, HealthCheckResult.Error,
string.Format("Cannot install update because startup folder '{0}' is in an App Translocation folder.", startupFolder), string.Format(_localizationService.GetLocalizedString("UpdateCheckStartupTranslocationMessage"), startupFolder),
"#cannot-install-update-because-startup-folder-is-in-an-app-translocation-folder."); "#cannot-install-update-because-startup-folder-is-in-an-app-translocation-folder.");
} }
@ -52,7 +55,7 @@ public override HealthCheck Check()
{ {
return new HealthCheck(GetType(), return new HealthCheck(GetType(),
HealthCheckResult.Error, HealthCheckResult.Error,
string.Format("Cannot install update because startup folder '{0}' is not writable by the user '{1}'.", startupFolder, Environment.UserName), string.Format(_localizationService.GetLocalizedString("UpdateCheckStartupNotWritableMessage"), startupFolder, Environment.UserName),
"#cannot-install-update-because-startup-folder-is-not-writable-by-the-user"); "#cannot-install-update-because-startup-folder-is-not-writable-by-the-user");
} }
@ -60,7 +63,7 @@ public override HealthCheck Check()
{ {
return new HealthCheck(GetType(), return new HealthCheck(GetType(),
HealthCheckResult.Error, HealthCheckResult.Error,
string.Format("Cannot install update because UI folder '{0}' is not writable by the user '{1}'.", uiFolder, Environment.UserName), string.Format(_localizationService.GetLocalizedString("UpdateCheckUINotWritableMessage"), uiFolder, Environment.UserName),
"#cannot-install-update-because-ui-folder-is-not-writable-by-the-user"); "#cannot-install-update-because-ui-folder-is-not-writable-by-the-user");
} }
} }

View File

@ -1,7 +1,15 @@
namespace NzbDrone.Core.HealthCheck using NzbDrone.Core.Localization;
namespace NzbDrone.Core.HealthCheck
{ {
public abstract class HealthCheckBase : IProvideHealthCheck public abstract class HealthCheckBase : IProvideHealthCheck
{ {
public readonly ILocalizationService _localizationService;
public HealthCheckBase(ILocalizationService localizationService)
{
_localizationService = localizationService;
}
public abstract HealthCheck Check(); public abstract HealthCheck Check();
public virtual bool CheckOnStartup => true; public virtual bool CheckOnStartup => true;