diff --git a/src/Umbraco.Core/CompositionExtensions.cs b/src/Umbraco.Core/CompositionExtensions.cs
index 5b9abeeb45..218e2a04e3 100644
--- a/src/Umbraco.Core/CompositionExtensions.cs
+++ b/src/Umbraco.Core/CompositionExtensions.cs
@@ -1,11 +1,11 @@
using Umbraco.Core.Composing;
+using Umbraco.Core.HealthCheck;
using Umbraco.Core.Manifest;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web.Actions;
using Umbraco.Web.ContentApps;
using Umbraco.Web.Dashboards;
using Umbraco.Web.Editors;
-using Umbraco.Web.HealthCheck;
using Umbraco.Web.Routing;
using Umbraco.Web.Sections;
using Umbraco.Web.Tour;
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/AbstractConfigCheck.cs b/src/Umbraco.Core/Configuration/HealthChecks/AbstractConfigCheck.cs
deleted file mode 100644
index f3452131f0..0000000000
--- a/src/Umbraco.Core/Configuration/HealthChecks/AbstractConfigCheck.cs
+++ /dev/null
@@ -1,234 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using Microsoft.Extensions.Logging;
-using Umbraco.Core.Hosting;
-using Umbraco.Core.IO;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Services;
-
-namespace Umbraco.Web.HealthCheck.Checks.Config
-{
- public abstract class AbstractConfigCheck : HealthCheck
- {
- private readonly IHostingEnvironment _hostingEnvironment;
- private readonly ConfigurationService _configurationService;
-
- protected ILocalizedTextService TextService { get; }
- protected ILoggerFactory LoggerFactory { get; }
-
- ///
- /// Gets the config file path.
- ///
- public abstract string FilePath { get; }
-
- ///
- /// Gets XPath statement to the config element to check.
- ///
- public abstract string XPath { get; }
-
- ///
- /// Gets the values to compare against.
- ///
- public abstract IEnumerable Values { get; }
-
- ///
- /// Gets the current value
- ///
- public string CurrentValue { get; set; }
-
- ///
- /// Gets the provided value
- ///
- public string ProvidedValue { get; set; }
-
- ///
- /// Gets the comparison type for checking the value.
- ///
- public abstract ValueComparisonType ValueComparisonType { get; }
-
- ///
- /// Gets the flag indicating if the check is considered successful if the config value is missing (defaults to false - an error - if missing)
- ///
- public virtual bool ValidIfConfigMissing
- {
- get { return false; }
- }
-
- protected AbstractConfigCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILoggerFactory loggerFactory)
- {
- _hostingEnvironment = hostingEnvironment;
- TextService = textService;
- LoggerFactory = loggerFactory;
- _configurationService = new ConfigurationService(AbsoluteFilePath, XPath, textService, loggerFactory.CreateLogger());
- }
-
- ///
- /// Gets the name of the file.
- ///
- private string FileName => Path.GetFileName(FilePath);
-
- ///
- /// Gets the absolute file path.
- ///
- private string AbsoluteFilePath => _hostingEnvironment.MapPathContentRoot(FilePath);
-
- ///
- /// Gets the message for when the check has succeeded.
- ///
- public virtual string CheckSuccessMessage
- {
- get
- {
- return TextService.Localize("healthcheck/checkSuccessMessage",
- new[] { CurrentValue, Values.First(v => v.IsRecommended).Value, XPath, AbsoluteFilePath });
- }
- }
-
- ///
- /// Gets the message for when the check has failed.
- ///
- public virtual string CheckErrorMessage
- {
- get
- {
- return ValueComparisonType == ValueComparisonType.ShouldEqual
- ? TextService.Localize("healthcheck/checkErrorMessageDifferentExpectedValue",
- new[] { CurrentValue, Values.First(v => v.IsRecommended).Value, XPath, AbsoluteFilePath })
- : TextService.Localize("healthcheck/checkErrorMessageUnexpectedValue",
- new[] { CurrentValue, Values.First(v => v.IsRecommended).Value, XPath, AbsoluteFilePath });
- }
- }
-
- ///
- /// Gets the rectify success message.
- ///
- public virtual string RectifySuccessMessage
- {
- get
- {
- var recommendedValue = Values.FirstOrDefault(v => v.IsRecommended);
- var rectifiedValue = recommendedValue != null
- ? recommendedValue.Value
- : ProvidedValue;
- return TextService.Localize("healthcheck/rectifySuccessMessage",
- new[]
- {
- CurrentValue,
- rectifiedValue,
- XPath,
- AbsoluteFilePath
- });
- }
- }
-
- ///
- /// Gets a value indicating whether this check can be rectified automatically.
- ///
- public virtual bool CanRectify => ValueComparisonType == ValueComparisonType.ShouldEqual;
-
- ///
- /// Gets a value indicating whether this check can be rectified automatically if a value is provided.
- ///
- public virtual bool CanRectifyWithValue => ValueComparisonType == ValueComparisonType.ShouldNotEqual;
-
- public override IEnumerable GetStatus()
- {
- var successMessage = string.Format(CheckSuccessMessage, FileName, XPath, Values);
-
- var configValue = _configurationService.GetConfigurationValue();
- if (configValue.Success == false)
- {
- if (ValidIfConfigMissing)
- {
- return new[] { new HealthCheckStatus(successMessage) { ResultType = StatusResultType.Success } };
- }
-
- var errorMessage = configValue.Result;
- return new[] { new HealthCheckStatus(errorMessage) { ResultType = StatusResultType.Error } };
- }
-
- CurrentValue = configValue.Result;
-
- // need to update the successMessage with the CurrentValue
- successMessage = string.Format(CheckSuccessMessage, FileName, XPath, Values, CurrentValue);
-
- var valueFound = Values.Any(value => string.Equals(CurrentValue, value.Value, StringComparison.InvariantCultureIgnoreCase));
- if (ValueComparisonType == ValueComparisonType.ShouldEqual && valueFound || ValueComparisonType == ValueComparisonType.ShouldNotEqual && valueFound == false)
- {
- return new[] { new HealthCheckStatus(successMessage) { ResultType = StatusResultType.Success } };
- }
-
- // Declare the action for rectifying the config value
- var rectifyAction = new HealthCheckAction("rectify", Id)
- {
- Name = TextService.Localize("healthcheck/rectifyButton"),
- ValueRequired = CanRectifyWithValue,
- };
-
- var resultMessage = string.Format(CheckErrorMessage, FileName, XPath, Values, CurrentValue);
- return new[]
- {
- new HealthCheckStatus(resultMessage)
- {
- ResultType = StatusResultType.Error,
- Actions = CanRectify || CanRectifyWithValue ? new[] { rectifyAction } : new HealthCheckAction[0]
- }
- };
- }
-
- ///
- /// Rectifies this check.
- ///
- ///
- public virtual HealthCheckStatus Rectify()
- {
- if (ValueComparisonType == ValueComparisonType.ShouldNotEqual)
- throw new InvalidOperationException(TextService.Localize("healthcheck/cannotRectifyShouldNotEqual"));
-
- var recommendedValue = Values.First(v => v.IsRecommended).Value;
- return UpdateConfigurationValue(recommendedValue);
- }
-
- ///
- /// Rectifies this check with a provided value.
- ///
- /// Value provided
- ///
- public virtual HealthCheckStatus Rectify(string value)
- {
- if (ValueComparisonType == ValueComparisonType.ShouldEqual)
- throw new InvalidOperationException(TextService.Localize("healthcheck/cannotRectifyShouldEqualWithValue"));
-
- if (string.IsNullOrWhiteSpace(value))
- throw new InvalidOperationException(TextService.Localize("healthcheck/valueToRectifyNotProvided"));
-
- // Need to track provided value in order to correctly put together the rectify message
- ProvidedValue = value;
-
- return UpdateConfigurationValue(value);
- }
-
- private HealthCheckStatus UpdateConfigurationValue(string value)
- {
- var updateConfigFile = _configurationService.UpdateConfigFile(value);
-
- if (updateConfigFile.Success == false)
- {
- var message = updateConfigFile.Result;
- return new HealthCheckStatus(message) { ResultType = StatusResultType.Error };
- }
-
- var resultMessage = string.Format(RectifySuccessMessage, FileName, XPath, Values);
- return new HealthCheckStatus(resultMessage) { ResultType = StatusResultType.Success };
- }
-
- public override HealthCheckStatus ExecuteAction(HealthCheckAction action)
- {
- return string.IsNullOrEmpty(action.ProvidedValue)
- ? Rectify()
- : Rectify(action.ProvidedValue);
- }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/CompilationDebugCheck.cs b/src/Umbraco.Core/Configuration/HealthChecks/CompilationDebugCheck.cs
index b400093a34..a7b99ea205 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/CompilationDebugCheck.cs
+++ b/src/Umbraco.Core/Configuration/HealthChecks/CompilationDebugCheck.cs
@@ -1,33 +1,41 @@
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
-using Umbraco.Core.Hosting;
-using Umbraco.Core.IO;
+using Microsoft.Extensions.Options;
+using Umbraco.Core.Configuration.Models;
+using Umbraco.Core.HealthCheck;
+using Umbraco.Core.HealthCheck.Checks;
using Umbraco.Core.Services;
-namespace Umbraco.Web.HealthCheck.Checks.Config
+namespace Umbraco.Core.Configuration.HealthChecks
{
[HealthCheck("61214FF3-FC57-4B31-B5CF-1D095C977D6D", "Debug Compilation Mode",
Description = "Leaving debug compilation mode enabled can severely slow down a website and take up more memory on the server.",
Group = "Live Environment")]
- public class CompilationDebugCheck : AbstractConfigCheck
+ public class CompilationDebugCheck : AbstractSettingsCheck
{
- public CompilationDebugCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILoggerFactory loggerFactory)
- : base(textService, hostingEnvironment, loggerFactory)
- { }
+ private readonly IOptionsMonitor _hostingSettings;
- public override string FilePath => "~/Web.config";
+ public CompilationDebugCheck(ILocalizedTextService textService, ILoggerFactory loggerFactory, IOptionsMonitor hostingSettings)
+ : base(textService, loggerFactory)
+ {
+ _hostingSettings = hostingSettings;
+ }
- public override string XPath => "/configuration/system.web/compilation/@debug";
+ public override string ItemPath => Constants.Configuration.ConfigHostingDebug;
public override ValueComparisonType ValueComparisonType => ValueComparisonType.ShouldEqual;
- public override bool ValidIfConfigMissing => true;
-
public override IEnumerable Values => new List
{
- new AcceptableConfiguration { IsRecommended = true, Value = bool.FalseString.ToLower() }
+ new AcceptableConfiguration
+ {
+ IsRecommended = true,
+ Value = bool.FalseString.ToLower()
+ }
};
+ public override string CurrentValue => _hostingSettings.CurrentValue.Debug.ToString();
+
public override string CheckSuccessMessage => TextService.Localize("healthcheck/compilationDebugCheckSuccessMessage");
public override string CheckErrorMessage => TextService.Localize("healthcheck/compilationDebugCheckErrorMessage");
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/ConfigurationService.cs b/src/Umbraco.Core/Configuration/HealthChecks/ConfigurationService.cs
index 396d55b735..2459698b7a 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/ConfigurationService.cs
+++ b/src/Umbraco.Core/Configuration/HealthChecks/ConfigurationService.cs
@@ -1,109 +1,61 @@
using System;
-using System.IO;
-using System.Xml;
using Microsoft.Extensions.Logging;
+using Umbraco.Core.HealthCheck;
using Umbraco.Core.Services;
-namespace Umbraco.Web.HealthCheck.Checks.Config
+namespace Umbraco.Core.Configuration.HealthChecks
{
- // TODO: Add config transform for when config with specified XPath is not found
-
- public class ConfigurationService
+ public class ConfigurationService : IConfigurationService
{
- private readonly string _configFilePath;
- private readonly string _xPath;
private readonly ILocalizedTextService _textService;
private readonly ILogger _logger;
+ private readonly IConfigManipulator _configManipulator;
- /// The absolute file location of the configuration file
- /// The XPath to select the value
///
///
+ ///
///
- public ConfigurationService(string configFilePath, string xPath, ILocalizedTextService textService, ILogger logger)
+ public ConfigurationService(ILocalizedTextService textService, ILogger logger, IConfigManipulator configManipulator)
{
- _configFilePath = configFilePath;
- _xPath = xPath;
+ if (textService == null) HandleNullParameter(nameof(textService));
+ if (configManipulator == null) HandleNullParameter(nameof(configManipulator));
+ if (logger == null) HandleNullParameter(nameof(logger));
+
+ _configManipulator = configManipulator;
_textService = textService;
_logger = logger;
}
- ///
- /// Gets a value from a given configuration file with the given XPath
- ///
- public ConfigurationServiceResult GetConfigurationValue()
+ private void HandleNullParameter(string parameter)
{
- try
- {
- if (File.Exists(_configFilePath) == false)
- return new ConfigurationServiceResult
- {
- Success = false,
- Result = _textService.Localize("healthcheck/configurationServiceFileNotFound", new[] { _configFilePath })
- };
-
- var xmlDocument = new XmlDocument();
- xmlDocument.Load(_configFilePath);
-
- var xmlNode = xmlDocument.SelectSingleNode(_xPath);
- if (xmlNode == null)
- return new ConfigurationServiceResult
- {
- Success = false,
- Result = _textService.Localize("healthcheck/configurationServiceNodeNotFound", new[] { _xPath, _configFilePath })
- };
-
- return new ConfigurationServiceResult
- {
- Success = true,
- Result = string.Format(xmlNode.Value ?? xmlNode.InnerText)
- };
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error trying to get configuration value");
- return new ConfigurationServiceResult
- {
- Success = false,
- Result = _textService.Localize("healthcheck/configurationServiceError", new[] { ex.Message })
- };
- }
+ _logger.LogError("Error trying to get configuration value", parameter);
+ throw new ArgumentNullException(parameter);
}
///
- /// Updates a value in a given configuration file with the given XPath
+ /// Updates a value in a given configuration file with the given path
///
///
+ ///
///
- public ConfigurationServiceResult UpdateConfigFile(string value)
+ public ConfigurationServiceResult UpdateConfigFile(string value, string itemPath)
{
try
{
- if (File.Exists(_configFilePath) == false)
+ if (itemPath == null)
+ {
return new ConfigurationServiceResult
{
Success = false,
- Result = _textService.Localize("healthcheck/configurationServiceFileNotFound", new[] { _configFilePath })
+ Result = _textService.Localize("healthcheck/configurationServiceNodeNotFound", new[] { itemPath, value })
};
+ }
- var xmlDocument = new XmlDocument { PreserveWhitespace = true };
- xmlDocument.Load(_configFilePath);
-
- var node = xmlDocument.SelectSingleNode(_xPath);
- if (node == null)
- return new ConfigurationServiceResult
- {
- Success = false,
- Result = _textService.Localize("healthcheck/configurationServiceNodeNotFound", new[] { _xPath, _configFilePath })
- };
-
- if (node.NodeType == XmlNodeType.Element)
- node.InnerText = value;
- else
- node.Value = value;
-
- xmlDocument.Save(_configFilePath);
- return new ConfigurationServiceResult { Success = true };
+ _configManipulator.SaveConfigValue(itemPath, value);
+ return new ConfigurationServiceResult
+ {
+ Success = true
+ };
}
catch (Exception ex)
{
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/MacroErrorsCheck.cs b/src/Umbraco.Core/Configuration/HealthChecks/MacroErrorsCheck.cs
index 68e76dfc81..b31f23667d 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/MacroErrorsCheck.cs
+++ b/src/Umbraco.Core/Configuration/HealthChecks/MacroErrorsCheck.cs
@@ -1,27 +1,40 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
-using Umbraco.Core.Hosting;
-using Umbraco.Core.IO;
+using Microsoft.Extensions.Options;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Services;
-namespace Umbraco.Web.HealthCheck.Checks.Config
+namespace Umbraco.Core.HealthCheck.Checks.Configuration
{
[HealthCheck("D0F7599E-9B2A-4D9E-9883-81C7EDC5616F", "Macro errors",
- Description = "Checks to make sure macro errors are not set to throw a YSOD (yellow screen of death), which would prevent certain or all pages from loading completely.",
+ Description =
+ "Checks to make sure macro errors are not set to throw a YSOD (yellow screen of death), which would prevent certain or all pages from loading completely.",
Group = "Configuration")]
- public class MacroErrorsCheck : AbstractConfigCheck
+ public class MacroErrorsCheck : AbstractSettingsCheck
{
- public MacroErrorsCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILoggerFactory loggerFactory)
- : base(textService, hostingEnvironment, loggerFactory)
- { }
+ private readonly ILocalizedTextService _textService;
+ private readonly ILoggerFactory _loggerFactory;
+ private readonly IOptionsMonitor _contentSettings;
- public override string FilePath => "~/Config/umbracoSettings.config";
-
- public override string XPath => "/settings/content/MacroErrors";
+ public MacroErrorsCheck(ILocalizedTextService textService, ILoggerFactory loggerFactory,
+ IOptionsMonitor contentSettings)
+ : base(textService, loggerFactory)
+ {
+ _textService = textService;
+ _loggerFactory = loggerFactory;
+ _contentSettings = contentSettings;
+ }
public override ValueComparisonType ValueComparisonType => ValueComparisonType.ShouldEqual;
+ public override string ItemPath => Constants.Configuration.ConfigContentMacroErrors;
+
+
+ ///
+ /// Gets the values to compare against.
+ ///
public override IEnumerable Values
{
get
@@ -44,24 +57,35 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
}
}
+ public override string CurrentValue => _contentSettings.CurrentValue.MacroErrors.ToString();
+
+ ///
+ /// Gets the message for when the check has succeeded.
+ ///
public override string CheckSuccessMessage
{
get
{
- return TextService.Localize("healthcheck/macroErrorModeCheckSuccessMessage",
+ return _textService.Localize("healthcheck/macroErrorModeCheckSuccessMessage",
new[] { CurrentValue, Values.First(v => v.IsRecommended).Value });
}
}
+ ///
+ /// Gets the message for when the check has failed.
+ ///
public override string CheckErrorMessage
{
get
{
- return TextService.Localize("healthcheck/macroErrorModeCheckErrorMessage",
+ return _textService.Localize("healthcheck/macroErrorModeCheckErrorMessage",
new[] { CurrentValue, Values.First(v => v.IsRecommended).Value });
}
}
+ ///
+ /// Gets the rectify success message.
+ ///
public override string RectifySuccessMessage
{
get
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/TrySkipIisCustomErrorsCheck.cs b/src/Umbraco.Core/Configuration/HealthChecks/TrySkipIisCustomErrorsCheck.cs
index 76269d961c..9710080f35 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/TrySkipIisCustomErrorsCheck.cs
+++ b/src/Umbraco.Core/Configuration/HealthChecks/TrySkipIisCustomErrorsCheck.cs
@@ -2,32 +2,40 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
-using Umbraco.Core.IO;
using Umbraco.Core.Services;
-namespace Umbraco.Web.HealthCheck.Checks.Config
+namespace Umbraco.Core.HealthCheck.Checks.Configuration
{
+ [Obsolete("This is not currently in the appsettings.JSON and so can either be removed, or rewritten in .NET Core fashion")]
[HealthCheck("046A066C-4FB2-4937-B931-069964E16C66", "Try Skip IIS Custom Errors",
Description = "Starting with IIS 7.5, this must be set to true for Umbraco 404 pages to show. Otherwise, IIS will takeover and render its built-in error page.",
Group = "Configuration")]
- public class TrySkipIisCustomErrorsCheck : AbstractConfigCheck
+ public class TrySkipIisCustomErrorsCheck : AbstractSettingsCheck
{
+ private readonly ILocalizedTextService _textService;
+ private readonly ILoggerFactory _loggerFactory;
private readonly Version _iisVersion;
+ private readonly GlobalSettings _globalSettings;
- public TrySkipIisCustomErrorsCheck(ILocalizedTextService textService, ILoggerFactory loggerFactory,
- IHostingEnvironment hostingEnvironment)
- : base(textService, hostingEnvironment, loggerFactory)
+ public TrySkipIisCustomErrorsCheck(ILocalizedTextService textService, ILoggerFactory loggerFactory, IOptions globalSettings)
+ : base(textService, loggerFactory)
{
- _iisVersion = hostingEnvironment.IISVersion;
+ _textService = textService;
+ _loggerFactory = loggerFactory;
+ //TODO: detect if hosted in IIS, and then IIS version if we want to go this route
+ _iisVersion = new Version("7.5");
+ _globalSettings = globalSettings.Value;
}
- public override string FilePath => "~/Config/umbracoSettings.config";
-
- public override string XPath => "/settings/web.routing/@trySkipIisCustomErrors";
+ public override string ItemPath => "TBC";
public override ValueComparisonType ValueComparisonType => ValueComparisonType.ShouldEqual;
+ public override string CurrentValue => null;
+
public override IEnumerable Values
{
get
@@ -36,7 +44,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
var recommendedValue = _iisVersion >= new Version("7.5")
? bool.TrueString.ToLower()
: bool.FalseString.ToLower();
- return new List { new AcceptableConfiguration { IsRecommended = true, Value = recommendedValue } };
+ return new List { new AcceptableConfiguration { IsRecommended = true, Value = recommendedValue } };
}
}
@@ -44,7 +52,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
{
get
{
- return TextService.Localize("healthcheck/trySkipIisCustomErrorsCheckSuccessMessage",
+ return _textService.Localize("healthcheck/trySkipIisCustomErrorsCheckSuccessMessage",
new[] { Values.First(v => v.IsRecommended).Value, _iisVersion.ToString() });
}
}
@@ -53,7 +61,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
{
get
{
- return TextService.Localize("healthcheck/trySkipIisCustomErrorsCheckErrorMessage",
+ return _textService.Localize("healthcheck/trySkipIisCustomErrorsCheckErrorMessage",
new[] { CurrentValue, Values.First(v => v.IsRecommended).Value, _iisVersion.ToString() });
}
}
@@ -62,8 +70,10 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
{
get
{
- return TextService.Localize("healthcheck/trySkipIisCustomErrorsCheckRectifySuccessMessage",
- new[] { Values.First(v => v.IsRecommended).Value, _iisVersion.ToString() });
+ return _textService.Localize("healthcheck/trySkipIisCustomErrorsCheckRectifySuccessMessage",
+ new[] { "Not implemented" });
+
+ //new[] { Values.First(v => v.IsRecommended).Value, _iisVersion.ToString() });
}
}
}
diff --git a/src/Umbraco.Core/Configuration/Models/HealthChecksSettings.cs b/src/Umbraco.Core/Configuration/Models/HealthChecksSettings.cs
index 0903a8f242..7600b946fd 100644
--- a/src/Umbraco.Core/Configuration/Models/HealthChecksSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/HealthChecksSettings.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
-using Umbraco.Core.Configuration.HealthChecks;
+using Umbraco.Core.HealthCheck;
+using Umbraco.Core.HealthCheck.Checks;
namespace Umbraco.Core.Configuration.Models
{
diff --git a/src/Umbraco.Core/Constants-Configuration.cs b/src/Umbraco.Core/Constants-Configuration.cs
index c06ec8f1ec..2c9fe3caee 100644
--- a/src/Umbraco.Core/Constants-Configuration.cs
+++ b/src/Umbraco.Core/Constants-Configuration.cs
@@ -11,9 +11,23 @@
/// ":" is used as marker for nested objects in json. E.g. "Umbraco:CMS:" = {"Umbraco":{"CMS":{....}}
///
public const string ConfigPrefix = "Umbraco:CMS:";
+ public const string ConfigContentPrefix = ConfigPrefix + "Content:";
+ public const string ConfigContentNotificationsPrefix = ConfigContentPrefix + "Notifications:";
+ public const string ConfigCorePrefix = ConfigPrefix + "Core:";
+ public const string ConfigCustomErrorsPrefix = ConfigPrefix + "CustomErrors:";
+ public const string ConfigGlobalPrefix = ConfigPrefix + "Global:";
+ public const string ConfigHostingPrefix = ConfigPrefix + "Hosting:";
+ public const string ConfigModelsBuilderPrefix = ConfigPrefix + "ModelsBuilder:";
+ public const string ConfigSecurityPrefix = ConfigPrefix + "Security:";
+
+ public const string ConfigContentNotificationsEmail = ConfigContentNotificationsPrefix + "Email";
+ public const string ConfigContentMacroErrors = ConfigContentPrefix + "MacroErrors";
+ public const string ConfigGlobalUseHttps = ConfigGlobalPrefix + "UseHttps";
+ public const string ConfigHostingDebug = ConfigHostingPrefix + "Debug";
+ public const string ConfigCustomErrorsMode = ConfigCustomErrorsPrefix + "Mode";
public const string ConfigActiveDirectory = ConfigPrefix + "ActiveDirectory";
public const string ConfigContent = ConfigPrefix + "Content";
- public const string ConfigCoreDebug = ConfigPrefix + "Core:Debug";
+ public const string ConfigCoreDebug = ConfigCorePrefix + "Debug";
public const string ConfigExceptionFilter = ConfigPrefix + "ExceptionFilter";
public const string ConfigGlobal = ConfigPrefix + "Global";
public const string ConfigHealthChecks = ConfigPrefix + "HealthChecks";
@@ -27,14 +41,13 @@
public const string ConfigNuCache = ConfigPrefix + "NuCache";
public const string ConfigRequestHandler = ConfigPrefix + "RequestHandler";
public const string ConfigRuntime = ConfigPrefix + "Runtime";
+ public const string ConfigRuntimeMinification = ConfigPrefix + "RuntimeMinification";
+ public const string ConfigRuntimeMinificationVersion = ConfigRuntimeMinification + ":Version";
public const string ConfigSecurity = ConfigPrefix + "Security";
public const string ConfigTours = ConfigPrefix + "Tours";
public const string ConfigTypeFinder = ConfigPrefix + "TypeFinder";
public const string ConfigWebRouting = ConfigPrefix + "WebRouting";
public const string ConfigUserPassword = ConfigPrefix + "Security:UserPassword";
-
- public const string ConfigRuntimeMinification = ConfigPrefix + "RuntimeMinification";
- public const string ConfigRuntimeMinificationVersion = ConfigRuntimeMinification + ":Version";
}
}
}
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/AcceptableConfiguration.cs b/src/Umbraco.Core/HealthCheck/AcceptableConfiguration.cs
similarity index 74%
rename from src/Umbraco.Core/Configuration/HealthChecks/AcceptableConfiguration.cs
rename to src/Umbraco.Core/HealthCheck/AcceptableConfiguration.cs
index b71bba1d14..f879172a5d 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/AcceptableConfiguration.cs
+++ b/src/Umbraco.Core/HealthCheck/AcceptableConfiguration.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Web.HealthCheck.Checks.Config
+namespace Umbraco.Core.HealthCheck
{
public class AcceptableConfiguration
{
diff --git a/src/Umbraco.Core/HealthCheck/Checks/AbstractSettingsCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/AbstractSettingsCheck.cs
new file mode 100644
index 0000000000..62543dcfbd
--- /dev/null
+++ b/src/Umbraco.Core/HealthCheck/Checks/AbstractSettingsCheck.cs
@@ -0,0 +1,160 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Extensions.Logging;
+using Umbraco.Core.Services;
+
+namespace Umbraco.Core.HealthCheck.Checks
+{
+ public abstract class AbstractSettingsCheck : HealthCheck
+ {
+ protected ILocalizedTextService TextService { get; }
+ protected ILoggerFactory LoggerFactory { get; }
+
+ ///
+ /// Gets key within the JSON to check, in the colon-delimited format
+ /// https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.1
+ ///
+ public abstract string ItemPath { get; }
+
+ ///
+ /// Gets the values to compare against.
+ ///
+ public abstract IEnumerable Values { get; }
+
+ ///
+ /// Gets the current value of the config setting
+ ///
+ public abstract string CurrentValue { get; }
+
+ ///
+ /// Gets the provided value
+ ///
+ public string ProvidedValue { get; set; }
+
+ ///
+ /// Gets the comparison type for checking the value.
+ ///
+ public abstract ValueComparisonType ValueComparisonType { get; }
+
+ protected AbstractSettingsCheck(ILocalizedTextService textService, ILoggerFactory loggerFactory)
+ {
+ TextService = textService;
+ LoggerFactory = loggerFactory;
+ }
+
+ ///
+ /// Gets the message for when the check has succeeded.
+ ///
+ public virtual string CheckSuccessMessage
+ {
+ get
+ {
+ return TextService.Localize("healthcheck/checkSuccessMessage", new[] { CurrentValue, Values.First(v => v.IsRecommended).Value, ItemPath });
+ }
+ }
+
+ ///
+ /// Gets the message for when the check has failed.
+ ///
+ public virtual string CheckErrorMessage
+ {
+ get
+ {
+ return ValueComparisonType == ValueComparisonType.ShouldEqual
+ ? TextService.Localize("healthcheck/checkErrorMessageDifferentExpectedValue",
+ new[] { CurrentValue, Values.First(v => v.IsRecommended).Value, ItemPath })
+ : TextService.Localize("healthcheck/checkErrorMessageUnexpectedValue",
+ new[] { CurrentValue, Values.First(v => v.IsRecommended).Value, ItemPath });
+ }
+ }
+
+ ///
+ /// Gets the rectify success message.
+ ///
+ public virtual string RectifySuccessMessage
+ {
+ get
+ {
+ AcceptableConfiguration recommendedValue = Values.FirstOrDefault(v => v.IsRecommended);
+ string rectifiedValue = recommendedValue != null ? recommendedValue.Value : ProvidedValue;
+ return TextService.Localize("healthcheck/rectifySuccessMessage",
+ new[]
+ {
+ CurrentValue,
+ rectifiedValue,
+ ItemPath
+ });
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether this check can be rectified automatically.
+ ///
+ public virtual bool CanRectify => ValueComparisonType == ValueComparisonType.ShouldEqual;
+
+ ///
+ /// Gets a value indicating whether this check can be rectified automatically if a value is provided.
+ ///
+ public virtual bool CanRectifyWithValue => ValueComparisonType == ValueComparisonType.ShouldNotEqual;
+
+ public override IEnumerable GetStatus()
+ {
+ // update the successMessage with the CurrentValue
+ var successMessage = string.Format(CheckSuccessMessage, ItemPath, Values, CurrentValue);
+ bool valueFound = Values.Any(value => string.Equals(CurrentValue, value.Value, StringComparison.InvariantCultureIgnoreCase));
+
+ if (ValueComparisonType == ValueComparisonType.ShouldEqual
+ && valueFound || ValueComparisonType == ValueComparisonType.ShouldNotEqual
+ && valueFound == false)
+ {
+ return new[]
+ {
+ new HealthCheckStatus(successMessage)
+ {
+ ResultType = StatusResultType.Success
+ }
+ };
+ }
+
+ // Declare the action for rectifying the config value
+ var rectifyAction = new HealthCheckAction("rectify", Id)
+ {
+ Name = TextService.Localize("healthcheck/rectifyButton"),
+ ValueRequired = CanRectifyWithValue
+ };
+
+ string resultMessage = string.Format(CheckErrorMessage, ItemPath, Values, CurrentValue);
+ return new[]
+ {
+ new HealthCheckStatus(resultMessage)
+ {
+ ResultType = StatusResultType.Error,
+ Actions = CanRectify || CanRectifyWithValue ? new[] { rectifyAction } : new HealthCheckAction[0]
+ }
+ };
+ }
+
+ ///
+ /// Rectifies this check.
+ ///
+ ///
+ public virtual HealthCheckStatus Rectify(HealthCheckAction action)
+ {
+ if (ValueComparisonType == ValueComparisonType.ShouldNotEqual)
+ {
+ throw new InvalidOperationException(TextService.Localize("healthcheck/cannotRectifyShouldNotEqual"));
+ }
+
+ //TODO: show message instead of actually fixing config
+ string recommendedValue = Values.First(v => v.IsRecommended).Value;
+ string resultMessage = string.Format(RectifySuccessMessage, ItemPath, Values);
+ return new HealthCheckStatus(resultMessage) { ResultType = StatusResultType.Success };
+ }
+
+ public override HealthCheckStatus ExecuteAction(HealthCheckAction action)
+ {
+ return Rectify(action);
+ }
+ }
+}
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/NotificationEmailCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/Configuration/NotificationEmailCheck.cs
similarity index 61%
rename from src/Umbraco.Core/Configuration/HealthChecks/NotificationEmailCheck.cs
rename to src/Umbraco.Core/HealthCheck/Checks/Configuration/NotificationEmailCheck.cs
index bac2cf1c3c..a6e6a83c47 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/NotificationEmailCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/Checks/Configuration/NotificationEmailCheck.cs
@@ -1,25 +1,26 @@
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
-using Umbraco.Core.Hosting;
-using Umbraco.Core.IO;
+using Microsoft.Extensions.Options;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Services;
-namespace Umbraco.Web.HealthCheck.Checks.Config
+namespace Umbraco.Core.HealthCheck.Checks.Configuration
{
[HealthCheck("3E2F7B14-4B41-452B-9A30-E67FBC8E1206", "Notification Email Settings",
Description = "If notifications are used, the 'from' email address should be specified and changed from the default value.",
Group = "Configuration")]
- public class NotificationEmailCheck : AbstractConfigCheck
+ public class NotificationEmailCheck : AbstractSettingsCheck
{
+ private readonly IOptionsMonitor _contentSettings;
private const string DefaultFromEmail = "your@email.here";
- public NotificationEmailCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILoggerFactory loggerFactory)
- : base(textService, hostingEnvironment, loggerFactory)
- { }
+ public NotificationEmailCheck(ILocalizedTextService textService, ILoggerFactory loggerFactory, IOptionsMonitor contentSettings)
+ : base(textService, loggerFactory)
+ {
+ _contentSettings = contentSettings;
+ }
- public override string FilePath => "~/Config/umbracoSettings.config";
-
- public override string XPath => "/settings/content/notifications/email";
+ public override string ItemPath => Constants.Configuration.ConfigContentNotificationsEmail;
public override ValueComparisonType ValueComparisonType => ValueComparisonType.ShouldNotEqual;
@@ -28,8 +29,11 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
new AcceptableConfiguration { IsRecommended = false, Value = DefaultFromEmail }
};
- public override string CheckSuccessMessage => TextService.Localize("healthcheck/notificationEmailsCheckSuccessMessage", new [] { CurrentValue } );
+ public override string CurrentValue => _contentSettings.CurrentValue.Notifications.Email;
+
+ public override string CheckSuccessMessage => TextService.Localize("healthcheck/notificationEmailsCheckSuccessMessage", new[] { CurrentValue });
public override string CheckErrorMessage => TextService.Localize("healthcheck/notificationEmailsCheckErrorMessage", new[] { DefaultFromEmail });
+
}
}
diff --git a/src/Umbraco.Core/HealthCheck/Checks/Data/DatabaseIntegrityCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/Data/DatabaseIntegrityCheck.cs
index a18edb175a..0fb34950bd 100644
--- a/src/Umbraco.Core/HealthCheck/Checks/Data/DatabaseIntegrityCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/Checks/Data/DatabaseIntegrityCheck.cs
@@ -5,7 +5,7 @@ using System.Text;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
-namespace Umbraco.Web.HealthCheck.Checks.Data
+namespace Umbraco.Core.HealthCheck.Checks.Data
{
[HealthCheck(
"73DD0C1C-E0CA-4C31-9564-1DCA509788AF",
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/DisabledHealthCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/DisabledHealthCheck.cs
similarity index 80%
rename from src/Umbraco.Core/Configuration/HealthChecks/DisabledHealthCheck.cs
rename to src/Umbraco.Core/HealthCheck/Checks/DisabledHealthCheck.cs
index c962014bd5..99ff05ed55 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/DisabledHealthCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/Checks/DisabledHealthCheck.cs
@@ -1,6 +1,6 @@
using System;
-namespace Umbraco.Core.Configuration.HealthChecks
+namespace Umbraco.Core.HealthCheck.Checks
{
public class DisabledHealthCheck
{
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/CustomErrorsCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/LiveEnvironment/CustomErrorsCheck.cs
similarity index 78%
rename from src/Umbraco.Core/Configuration/HealthChecks/CustomErrorsCheck.cs
rename to src/Umbraco.Core/HealthCheck/Checks/LiveEnvironment/CustomErrorsCheck.cs
index 9b14847bdf..b003506205 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/CustomErrorsCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/Checks/LiveEnvironment/CustomErrorsCheck.cs
@@ -1,24 +1,20 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
-using Umbraco.Core.Hosting;
-using Umbraco.Core.IO;
using Umbraco.Core.Services;
-namespace Umbraco.Web.HealthCheck.Checks.Config
+namespace Umbraco.Core.HealthCheck.Checks.LiveEnvironment
{
[HealthCheck("4090C0A1-2C52-4124-92DD-F028FD066A64", "Custom Errors",
Description = "Leaving custom errors off will display a complete stack trace to your visitors if an exception occurs.",
Group = "Live Environment")]
- public class CustomErrorsCheck : AbstractConfigCheck
+ public class CustomErrorsCheck : AbstractSettingsCheck
{
- public CustomErrorsCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILoggerFactory loggerFactory)
- : base(textService, hostingEnvironment, loggerFactory)
+ public CustomErrorsCheck(ILocalizedTextService textService, ILoggerFactory loggerFactory)
+ : base(textService, loggerFactory)
{ }
- public override string FilePath => "~/Web.config";
-
- public override string XPath => "/configuration/system.web/customErrors/@mode";
+ public override string ItemPath => Constants.Configuration.ConfigCustomErrorsMode;
public override ValueComparisonType ValueComparisonType => ValueComparisonType.ShouldEqual;
@@ -28,6 +24,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
new AcceptableConfiguration { IsRecommended = false, Value = "On" }
};
+ public override string CurrentValue { get; }
+
public override string CheckSuccessMessage
{
get
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/TraceCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/LiveEnvironment/TraceCheck.cs
similarity index 68%
rename from src/Umbraco.Core/Configuration/HealthChecks/TraceCheck.cs
rename to src/Umbraco.Core/HealthCheck/Checks/LiveEnvironment/TraceCheck.cs
index a2c5a84c55..03a6ecfde2 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/TraceCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/Checks/LiveEnvironment/TraceCheck.cs
@@ -1,24 +1,19 @@
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
-using Umbraco.Core.Hosting;
-using Umbraco.Core.IO;
using Umbraco.Core.Services;
-namespace Umbraco.Web.HealthCheck.Checks.Config
+namespace Umbraco.Core.HealthCheck.Checks.LiveEnvironment
{
[HealthCheck("9BED6EF4-A7F3-457A-8935-B64E9AA8BAB3", "Trace Mode",
Description = "Leaving trace mode enabled can make valuable information about your system available to hackers.",
Group = "Live Environment")]
- public class TraceCheck : AbstractConfigCheck
+ public class TraceCheck : AbstractSettingsCheck
{
-
- public TraceCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILoggerFactory loggerFactory)
- : base(textService, hostingEnvironment, loggerFactory)
+ public TraceCheck(ILocalizedTextService textService, ILoggerFactory loggerFactory)
+ : base(textService, loggerFactory)
{ }
- public override string FilePath => "~/Web.config";
-
- public override string XPath => "/configuration/system.web/trace/@enabled";
+ public override string ItemPath => "/configuration/system.web/trace/@enabled";
public override ValueComparisonType ValueComparisonType => ValueComparisonType.ShouldEqual;
@@ -27,10 +22,13 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
new AcceptableConfiguration { IsRecommended = true, Value = bool.FalseString.ToLower() }
};
+ public override string CurrentValue { get; }
+
public override string CheckSuccessMessage => TextService.Localize("healthcheck/traceModeCheckSuccessMessage");
public override string CheckErrorMessage => TextService.Localize("healthcheck/traceModeCheckErrorMessage");
public override string RectifySuccessMessage => TextService.Localize("healthcheck/traceModeCheckRectifySuccessMessage");
+
}
}
diff --git a/src/Umbraco.Core/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs
index d6fbfae813..1618daf028 100644
--- a/src/Umbraco.Core/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs
@@ -2,27 +2,13 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Options;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Install;
using Umbraco.Core.IO;
using Umbraco.Core.Services;
-namespace Umbraco.Web.HealthCheck.Checks.Permissions
+namespace Umbraco.Core.HealthCheck.Checks.Permissions
{
- internal enum PermissionCheckRequirement
- {
- Required,
- Optional
- }
-
- internal enum PermissionCheckFor
- {
- Folder,
- File
- }
-
[HealthCheck(
"53DBA282-4A79-4B67-B958-B29EC40FCC23",
"Folder & File Permissions",
@@ -31,14 +17,14 @@ namespace Umbraco.Web.HealthCheck.Checks.Permissions
public class FolderAndFilePermissionsCheck : HealthCheck
{
private readonly ILocalizedTextService _textService;
- private readonly GlobalSettings _globalSettings;
+ private readonly IOptionsMonitor _globalSettings;
private readonly IFilePermissionHelper _filePermissionHelper;
private readonly IIOHelper _ioHelper;
- public FolderAndFilePermissionsCheck(ILocalizedTextService textService, IOptions globalSettings, IFilePermissionHelper filePermissionHelper, IIOHelper ioHelper)
+ public FolderAndFilePermissionsCheck(ILocalizedTextService textService, IOptionsMonitor globalSettings, IFilePermissionHelper filePermissionHelper, IIOHelper ioHelper)
{
_textService = textService;
- _globalSettings = globalSettings.Value;
+ _globalSettings = globalSettings;
_filePermissionHelper = filePermissionHelper;
_ioHelper = ioHelper;
}
@@ -74,10 +60,10 @@ namespace Umbraco.Web.HealthCheck.Checks.Permissions
{ Constants.SystemDirectories.Preview, PermissionCheckRequirement.Required },
{ Constants.SystemDirectories.AppPlugins, PermissionCheckRequirement.Required },
{ Constants.SystemDirectories.Config, PermissionCheckRequirement.Optional },
- { _globalSettings.UmbracoCssPath, PermissionCheckRequirement.Optional },
- { _globalSettings.UmbracoMediaPath, PermissionCheckRequirement.Optional },
- { _globalSettings.UmbracoScriptsPath, PermissionCheckRequirement.Optional },
- { _globalSettings.UmbracoPath, PermissionCheckRequirement.Optional },
+ { _globalSettings.CurrentValue.UmbracoCssPath, PermissionCheckRequirement.Optional },
+ { _globalSettings.CurrentValue.UmbracoMediaPath, PermissionCheckRequirement.Optional },
+ { _globalSettings.CurrentValue.UmbracoScriptsPath, PermissionCheckRequirement.Optional },
+ { _globalSettings.CurrentValue.UmbracoPath, PermissionCheckRequirement.Optional },
{ Constants.SystemDirectories.MvcViews, PermissionCheckRequirement.Optional }
};
@@ -97,7 +83,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Permissions
//now check the special folders
var requiredPathCheckResult2 = _filePermissionHelper.EnsureDirectories(
- GetPathsToCheck(pathsToCheckWithRestarts, PermissionCheckRequirement.Required), out var requiredFailedPaths2, writeCausesRestart:true);
+ GetPathsToCheck(pathsToCheckWithRestarts, PermissionCheckRequirement.Required), out var requiredFailedPaths2, writeCausesRestart: true);
var optionalPathCheckResult2 = _filePermissionHelper.EnsureDirectories(
GetPathsToCheck(pathsToCheckWithRestarts, PermissionCheckRequirement.Optional), out var optionalFailedPaths2, writeCausesRestart: true);
@@ -139,9 +125,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Permissions
.ToArray();
}
- private HealthCheckStatus GetStatus(bool requiredPathCheckResult, IEnumerable requiredFailedPaths,
- bool optionalPathCheckResult, IEnumerable optionalFailedPaths,
- PermissionCheckFor checkingFor)
+ private HealthCheckStatus GetStatus(bool requiredPathCheckResult, IEnumerable requiredFailedPaths, bool optionalPathCheckResult, IEnumerable optionalFailedPaths, PermissionCheckFor checkingFor)
{
// Return error if any required paths fail the check, or warning if any optional ones do
var resultType = StatusResultType.Success;
@@ -164,12 +148,11 @@ namespace Umbraco.Web.HealthCheck.Checks.Permissions
}
var actions = new List();
- return
- new HealthCheckStatus(message)
- {
- ResultType = resultType,
- Actions = actions
- };
+ return new HealthCheckStatus(message)
+ {
+ ResultType = resultType,
+ Actions = actions
+ };
}
private string GetMessageForPathCheckFailure(string messageKey, IEnumerable failedPaths)
diff --git a/src/Umbraco.Core/HealthCheck/Checks/Permissions/PermissionCheckFor.cs b/src/Umbraco.Core/HealthCheck/Checks/Permissions/PermissionCheckFor.cs
new file mode 100644
index 0000000000..bd914d064d
--- /dev/null
+++ b/src/Umbraco.Core/HealthCheck/Checks/Permissions/PermissionCheckFor.cs
@@ -0,0 +1,8 @@
+namespace Umbraco.Core.HealthCheck.Checks.Permissions
+{
+ internal enum PermissionCheckFor
+ {
+ Folder,
+ File
+ }
+}
diff --git a/src/Umbraco.Core/HealthCheck/Checks/Permissions/PermissionCheckRequirement.cs b/src/Umbraco.Core/HealthCheck/Checks/Permissions/PermissionCheckRequirement.cs
new file mode 100644
index 0000000000..f77fdbf2e3
--- /dev/null
+++ b/src/Umbraco.Core/HealthCheck/Checks/Permissions/PermissionCheckRequirement.cs
@@ -0,0 +1,8 @@
+namespace Umbraco.Core.HealthCheck.Checks.Permissions
+{
+ internal enum PermissionCheckRequirement
+ {
+ Required,
+ Optional
+ }
+}
diff --git a/src/Umbraco.Core/HealthCheck/Checks/Security/BaseHttpHeaderCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/Security/BaseHttpHeaderCheck.cs
index 149ad4a48a..5bf92342bf 100644
--- a/src/Umbraco.Core/HealthCheck/Checks/Security/BaseHttpHeaderCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/Checks/Security/BaseHttpHeaderCheck.cs
@@ -4,13 +4,11 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
-using System.Xml.Linq;
-using System.Xml.XPath;
-using Umbraco.Core;
-using Umbraco.Core.IO;
+using Microsoft.Extensions.Configuration;
using Umbraco.Core.Services;
+using Umbraco.Web;
-namespace Umbraco.Web.HealthCheck.Checks.Security
+namespace Umbraco.Core.HealthCheck.Checks.Security
{
public abstract class BaseHttpHeaderCheck : HealthCheck
{
@@ -23,16 +21,14 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
private readonly string _localizedTextPrefix;
private readonly bool _metaTagOptionAvailable;
private readonly IRequestAccessor _requestAccessor;
- private readonly IIOHelper _ioHelper;
protected BaseHttpHeaderCheck(
IRequestAccessor requestAccessor,
ILocalizedTextService textService,
- string header, string value, string localizedTextPrefix, bool metaTagOptionAvailable, IIOHelper ioHelper)
+ string header, string value, string localizedTextPrefix, bool metaTagOptionAvailable)
{
TextService = textService ?? throw new ArgumentNullException(nameof(textService));
_requestAccessor = requestAccessor;
- _ioHelper = ioHelper;
_header = header;
_value = value;
_localizedTextPrefix = localizedTextPrefix;
@@ -72,7 +68,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
var success = false;
// Access the site home page and check for the click-jack protection header or meta tag
- var url = _requestAccessor.GetApplicationUrl();
+ var url = _requestAccessor.GetApplicationUrl();
var request = WebRequest.Create(url);
request.Method = "GET";
try
@@ -146,7 +142,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
private HealthCheckStatus SetHeaderInConfig()
{
var errorMessage = string.Empty;
- var success = SaveHeaderToConfigFile(out errorMessage);
+ //TODO: edit to show fix suggestion instead of making fix
+ var success = true;
if (success)
{
@@ -158,64 +155,10 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
}
return
- new HealthCheckStatus(TextService.Localize("healthcheck/setHeaderInConfigError", new [] { errorMessage }))
+ new HealthCheckStatus(TextService.Localize("healthcheck/setHeaderInConfigError", new[] { errorMessage }))
{
ResultType = StatusResultType.Error
};
}
-
- private bool SaveHeaderToConfigFile(out string errorMessage)
- {
- try
- {
- // There don't look to be any useful classes defined in https://msdn.microsoft.com/en-us/library/system.web.configuration(v=vs.110).aspx
- // for working with the customHeaders section, so working with the XML directly.
- var configFile = _ioHelper.MapPath("~/Web.config");
- var doc = XDocument.Load(configFile);
- var systemWebServerElement = doc.XPathSelectElement("/configuration/system.webServer");
- var httpProtocolElement = systemWebServerElement.Element("httpProtocol");
- if (httpProtocolElement == null)
- {
- httpProtocolElement = new XElement("httpProtocol");
- systemWebServerElement.Add(httpProtocolElement);
- }
-
- var customHeadersElement = httpProtocolElement.Element("customHeaders");
- if (customHeadersElement == null)
- {
- customHeadersElement = new XElement("customHeaders");
- httpProtocolElement.Add(customHeadersElement);
- }
-
- var removeHeaderElement = customHeadersElement.Elements("remove")
- .SingleOrDefault(x => x.Attribute("name")?.Value.Equals(_value, StringComparison.InvariantCultureIgnoreCase) == true);
- if (removeHeaderElement == null)
- {
- customHeadersElement.Add(
- new XElement("remove",
- new XAttribute("name", _header)));
- }
-
- var addHeaderElement = customHeadersElement.Elements("add")
- .SingleOrDefault(x => x.Attribute("name")?.Value.Equals(_header, StringComparison.InvariantCultureIgnoreCase) == true);
- if (addHeaderElement == null)
- {
- customHeadersElement.Add(
- new XElement("add",
- new XAttribute("name", _header),
- new XAttribute("value", _value)));
- }
-
- doc.Save(configFile);
-
- errorMessage = string.Empty;
- return true;
- }
- catch (Exception ex)
- {
- errorMessage = ex.Message;
- return false;
- }
- }
}
}
diff --git a/src/Umbraco.Core/HealthCheck/Checks/Security/ClickJackingCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/Security/ClickJackingCheck.cs
index 048b26afca..a7b4c0ba85 100644
--- a/src/Umbraco.Core/HealthCheck/Checks/Security/ClickJackingCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/Checks/Security/ClickJackingCheck.cs
@@ -1,8 +1,7 @@
-using Umbraco.Core;
-using Umbraco.Core.IO;
-using Umbraco.Core.Services;
+using Umbraco.Core.Services;
+using Umbraco.Web;
-namespace Umbraco.Web.HealthCheck.Checks.Security
+namespace Umbraco.Core.HealthCheck.Checks.Security
{
[HealthCheck(
"ED0D7E40-971E-4BE8-AB6D-8CC5D0A6A5B0",
@@ -11,8 +10,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
Group = "Security")]
public class ClickJackingCheck : BaseHttpHeaderCheck
{
- public ClickJackingCheck(IRequestAccessor requestAccessor, ILocalizedTextService textService, IIOHelper ioHelper)
- : base(requestAccessor, textService, "X-Frame-Options", "sameorigin", "clickJacking", true, ioHelper)
+ public ClickJackingCheck(IRequestAccessor requestAccessor, ILocalizedTextService textService)
+ : base(requestAccessor, textService, "X-Frame-Options", "sameorigin", "clickJacking", true)
{
}
}
diff --git a/src/Umbraco.Core/HealthCheck/Checks/Security/ExcessiveHeadersCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/Security/ExcessiveHeadersCheck.cs
index 06367ace13..9cf1127bb0 100644
--- a/src/Umbraco.Core/HealthCheck/Checks/Security/ExcessiveHeadersCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/Checks/Security/ExcessiveHeadersCheck.cs
@@ -2,10 +2,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Net;
-using Umbraco.Core;
using Umbraco.Core.Services;
+using Umbraco.Web;
-namespace Umbraco.Web.HealthCheck.Checks.Security
+namespace Umbraco.Core.HealthCheck.Checks.Security
{
[HealthCheck(
"92ABBAA2-0586-4089-8AE2-9A843439D577",
diff --git a/src/Umbraco.Core/HealthCheck/Checks/Security/HstsCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/Security/HstsCheck.cs
index 61879142f2..ee8f733fca 100644
--- a/src/Umbraco.Core/HealthCheck/Checks/Security/HstsCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/Checks/Security/HstsCheck.cs
@@ -1,8 +1,7 @@
-using Umbraco.Core;
-using Umbraco.Core.IO;
-using Umbraco.Core.Services;
+using Umbraco.Core.Services;
+using Umbraco.Web;
-namespace Umbraco.Web.HealthCheck.Checks.Security
+namespace Umbraco.Core.HealthCheck.Checks.Security
{
[HealthCheck(
"E2048C48-21C5-4BE1-A80B-8062162DF124",
@@ -16,8 +15,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
// and the blog post of Troy Hunt (https://www.troyhunt.com/understanding-http-strict-transport/)
// If you want do to it perfectly, you have to submit it https://hstspreload.org/,
// but then you should include subdomains and I wouldn't suggest to do that for Umbraco-sites.
- public HstsCheck(IRequestAccessor requestAccessor, ILocalizedTextService textService, IIOHelper ioHelper)
- : base(requestAccessor, textService, "Strict-Transport-Security", "max-age=10886400", "hSTS", true, ioHelper)
+ public HstsCheck(IRequestAccessor requestAccessor, ILocalizedTextService textService)
+ : base(requestAccessor, textService, "Strict-Transport-Security", "max-age=10886400", "hSTS", true)
{
}
}
diff --git a/src/Umbraco.Core/HealthCheck/Checks/Security/HttpsCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/Security/HttpsCheck.cs
index 3f788f7460..6bba41b7d5 100644
--- a/src/Umbraco.Core/HealthCheck/Checks/Security/HttpsCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/Checks/Security/HttpsCheck.cs
@@ -3,15 +3,14 @@ using System.Collections.Generic;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Extensions.Logging;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.IO;
using Umbraco.Core.Services;
-using Umbraco.Web.HealthCheck.Checks.Config;
using Umbraco.Core.Configuration.Models;
using Microsoft.Extensions.Options;
+using Umbraco.Core.Configuration.HealthChecks;
+using Umbraco.Core.IO;
+using Umbraco.Web;
-namespace Umbraco.Web.HealthCheck.Checks.Security
+namespace Umbraco.Core.HealthCheck.Checks.Security
{
[HealthCheck(
"EB66BB3B-1BCD-4314-9531-9DA2C1D6D9A7",
@@ -21,22 +20,20 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
public class HttpsCheck : HealthCheck
{
private readonly ILocalizedTextService _textService;
- private readonly GlobalSettings _globalSettings;
- private readonly IIOHelper _ioHelper;
+ private readonly IOptionsMonitor _globalSettings;
private readonly IRequestAccessor _requestAccessor;
- private readonly ILogger _logger;
-
+ private readonly ILogger _logger;
private const string FixHttpsSettingAction = "fixHttpsSetting";
+ string itemPath => Constants.Configuration.ConfigGlobalUseHttps;
public HttpsCheck(ILocalizedTextService textService,
- IOptions globalSettings,
+ IOptionsMonitor globalSettings,
IIOHelper ioHelper,
IRequestAccessor requestAccessor,
- ILogger logger)
+ ILogger logger)
{
_textService = textService;
- _globalSettings = globalSettings.Value;
- _ioHelper = ioHelper;
+ _globalSettings = globalSettings;
_requestAccessor = requestAccessor;
_logger = logger;
}
@@ -75,7 +72,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
// Attempt to access the site over HTTPS to see if it HTTPS is supported
// and a valid certificate has been configured
var url = _requestAccessor.GetApplicationUrl().ToString().Replace("http:", "https:");
- var request = (HttpWebRequest) WebRequest.Create(url);
+ var request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "HEAD";
try
@@ -119,8 +116,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
if (exception != null)
{
message = exception.Status == WebExceptionStatus.TrustFailure
- ? _textService.Localize("healthcheck/httpsCheckInvalidCertificate", new [] { exception.Message })
- : _textService.Localize("healthcheck/healthCheckInvalidUrl", new [] { url, exception.Message });
+ ? _textService.Localize("healthcheck/httpsCheckInvalidCertificate", new[] { exception.Message })
+ : _textService.Localize("healthcheck/healthCheckInvalidUrl", new[] { url, exception.Message });
}
else
{
@@ -132,33 +129,31 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
var actions = new List();
- return
- new HealthCheckStatus(message)
- {
- ResultType = result,
- Actions = actions
- };
+ return new HealthCheckStatus(message)
+ {
+ ResultType = result,
+ Actions = actions
+ };
}
private HealthCheckStatus CheckIfCurrentSchemeIsHttps()
{
- var uri = _requestAccessor.GetApplicationUrl();
+ var uri = _requestAccessor.GetApplicationUrl();
var success = uri.Scheme == "https";
var actions = new List();
- return
- new HealthCheckStatus(_textService.Localize("healthcheck/httpsCheckIsCurrentSchemeHttps", new[] { success ? string.Empty : "not" }))
- {
- ResultType = success ? StatusResultType.Success : StatusResultType.Error,
- Actions = actions
- };
+ return new HealthCheckStatus(_textService.Localize("healthcheck/httpsCheckIsCurrentSchemeHttps", new[] { success ? string.Empty : "not" }))
+ {
+ ResultType = success ? StatusResultType.Success : StatusResultType.Error,
+ Actions = actions
+ };
}
private HealthCheckStatus CheckHttpsConfigurationSetting()
{
- var httpsSettingEnabled = _globalSettings.UseHttps;
- var uri = _requestAccessor.GetApplicationUrl();
+ bool httpsSettingEnabled = _globalSettings.CurrentValue.UseHttps;
+ Uri uri = _requestAccessor.GetApplicationUrl();
var actions = new List();
string resultMessage;
@@ -171,46 +166,34 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
else
{
if (httpsSettingEnabled == false)
+ {
actions.Add(new HealthCheckAction(FixHttpsSettingAction, Id)
{
Name = _textService.Localize("healthcheck/httpsCheckEnableHttpsButton"),
Description = _textService.Localize("healthcheck/httpsCheckEnableHttpsDescription")
});
+ }
resultMessage = _textService.Localize("healthcheck/httpsCheckConfigurationCheckResult",
- new[] {httpsSettingEnabled.ToString(), httpsSettingEnabled ? string.Empty : "not"});
- resultType = httpsSettingEnabled ? StatusResultType.Success: StatusResultType.Error;
+ new[] { httpsSettingEnabled.ToString(), httpsSettingEnabled ? string.Empty : "not" });
+ resultType = httpsSettingEnabled ? StatusResultType.Success : StatusResultType.Error;
}
- return
- new HealthCheckStatus(resultMessage)
- {
- ResultType = resultType,
- Actions = actions
- };
+ return new HealthCheckStatus(resultMessage)
+ {
+ ResultType = resultType,
+ Actions = actions
+ };
}
private HealthCheckStatus FixHttpsSetting()
{
- var configFile = _ioHelper.MapPath("~/Web.config");
- const string xPath = "/configuration/appSettings/add[@key='Umbraco.Core.UseHttps']/@value";
- var configurationService = new ConfigurationService(configFile, xPath, _textService, _logger);
- var updateConfigFile = configurationService.UpdateConfigFile("true");
+ //TODO: return message instead of actual fix
- if (updateConfigFile.Success)
+ return new HealthCheckStatus(_textService.Localize("healthcheck/httpsCheckEnableHttpsSuccess"))
{
- return
- new HealthCheckStatus(_textService.Localize("healthcheck/httpsCheckEnableHttpsSuccess"))
- {
- ResultType = StatusResultType.Success
- };
- }
-
- return
- new HealthCheckStatus(_textService.Localize("healthcheck/httpsCheckEnableHttpsError", new [] { updateConfigFile.Result }))
- {
- ResultType = StatusResultType.Error
- };
+ ResultType = StatusResultType.Success
+ };
}
}
}
diff --git a/src/Umbraco.Core/HealthCheck/Checks/Security/NoSniffCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/Security/NoSniffCheck.cs
index 0b6fb9e347..c392842049 100644
--- a/src/Umbraco.Core/HealthCheck/Checks/Security/NoSniffCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/Checks/Security/NoSniffCheck.cs
@@ -1,8 +1,7 @@
-using Umbraco.Core;
-using Umbraco.Core.IO;
-using Umbraco.Core.Services;
+using Umbraco.Core.Services;
+using Umbraco.Web;
-namespace Umbraco.Web.HealthCheck.Checks.Security
+namespace Umbraco.Core.HealthCheck.Checks.Security
{
[HealthCheck(
"1CF27DB3-EFC0-41D7-A1BB-EA912064E071",
@@ -11,8 +10,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
Group = "Security")]
public class NoSniffCheck : BaseHttpHeaderCheck
{
- public NoSniffCheck(IRequestAccessor requestAccessor, ILocalizedTextService textService, IIOHelper ioHelper)
- : base(requestAccessor, textService, "X-Content-Type-Options", "nosniff", "noSniff", false, ioHelper)
+ public NoSniffCheck(IRequestAccessor requestAccessor, ILocalizedTextService textService)
+ : base(requestAccessor, textService, "X-Content-Type-Options", "nosniff", "noSniff", false)
{
}
}
diff --git a/src/Umbraco.Core/HealthCheck/Checks/Security/XssProtectionCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/Security/XssProtectionCheck.cs
index 7d658e2082..a5f0f28f22 100644
--- a/src/Umbraco.Core/HealthCheck/Checks/Security/XssProtectionCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/Checks/Security/XssProtectionCheck.cs
@@ -1,8 +1,7 @@
-using Umbraco.Core;
-using Umbraco.Core.IO;
-using Umbraco.Core.Services;
+using Umbraco.Core.Services;
+using Umbraco.Web;
-namespace Umbraco.Web.HealthCheck.Checks.Security
+namespace Umbraco.Core.HealthCheck.Checks.Security
{
[HealthCheck(
"F4D2B02E-28C5-4999-8463-05759FA15C3A",
@@ -16,8 +15,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
// and the blog post of Troy Hunt (https://www.troyhunt.com/understanding-http-strict-transport/)
// If you want do to it perfectly, you have to submit it https://hstspreload.appspot.com/,
// but then you should include subdomains and I wouldn't suggest to do that for Umbraco-sites.
- public XssProtectionCheck(IRequestAccessor requestAccessor,ILocalizedTextService textService, IIOHelper ioHelper)
- : base(requestAccessor, textService, "X-XSS-Protection", "1; mode=block", "xssProtection", true, ioHelper)
+ public XssProtectionCheck(IRequestAccessor requestAccessor,ILocalizedTextService textService)
+ : base(requestAccessor, textService, "X-XSS-Protection", "1; mode=block", "xssProtection", true)
{
}
}
diff --git a/src/Umbraco.Core/HealthCheck/Checks/Services/SmtpCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/Services/SmtpCheck.cs
index 77b1201ef6..9e1a6f84af 100644
--- a/src/Umbraco.Core/HealthCheck/Checks/Services/SmtpCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/Checks/Services/SmtpCheck.cs
@@ -3,12 +3,10 @@ using System.Collections.Generic;
using System.IO;
using System.Net.Sockets;
using Microsoft.Extensions.Options;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Services;
-namespace Umbraco.Web.HealthCheck.Checks.Services
+namespace Umbraco.Core.HealthCheck.Checks.Services
{
[HealthCheck(
"1B5D221B-CE99-4193-97CB-5F3261EC73DF",
@@ -18,12 +16,12 @@ namespace Umbraco.Web.HealthCheck.Checks.Services
public class SmtpCheck : HealthCheck
{
private readonly ILocalizedTextService _textService;
- private readonly GlobalSettings _globalSettings;
+ private readonly IOptionsMonitor _globalSettings;
- public SmtpCheck(ILocalizedTextService textService, IOptions globalSettings)
+ public SmtpCheck(ILocalizedTextService textService, IOptionsMonitor globalSettings)
{
_textService = textService;
- _globalSettings = globalSettings.Value;
+ _globalSettings = globalSettings;
}
///
@@ -50,7 +48,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Services
{
var success = false;
- var smtpSettings = _globalSettings.Smtp;
+ var smtpSettings = _globalSettings.CurrentValue.Smtp;
string message;
if (smtpSettings == null)
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/ConfigurationServiceResult.cs b/src/Umbraco.Core/HealthCheck/ConfigurationServiceResult.cs
similarity index 73%
rename from src/Umbraco.Core/Configuration/HealthChecks/ConfigurationServiceResult.cs
rename to src/Umbraco.Core/HealthCheck/ConfigurationServiceResult.cs
index 3b1400da5b..b4940f927a 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/ConfigurationServiceResult.cs
+++ b/src/Umbraco.Core/HealthCheck/ConfigurationServiceResult.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Web.HealthCheck.Checks.Config
+namespace Umbraco.Core.HealthCheck
{
public class ConfigurationServiceResult
{
diff --git a/src/Umbraco.Core/HealthCheck/HealthCheck.cs b/src/Umbraco.Core/HealthCheck/HealthCheck.cs
index 73defd2fef..89a1f41f4d 100644
--- a/src/Umbraco.Core/HealthCheck/HealthCheck.cs
+++ b/src/Umbraco.Core/HealthCheck/HealthCheck.cs
@@ -1,24 +1,25 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
-using Umbraco.Core;
using Umbraco.Core.Composing;
-namespace Umbraco.Web.HealthCheck
+namespace Umbraco.Core.HealthCheck
{
///
- /// Provides a base class for health checks.
+ /// Provides a base class for health checks, filling in the healthcheck metadata on construction
///
[DataContract(Name = "healthCheck", Namespace = "")]
public abstract class HealthCheck : IDiscoverable
{
protected HealthCheck()
{
- //Fill in the metadata
- var thisType = GetType();
- var meta = thisType.GetCustomAttribute(false);
+ Type thisType = GetType();
+ HealthCheckAttribute meta = thisType.GetCustomAttribute(false);
if (meta == null)
- throw new InvalidOperationException($"The health check {thisType} requires a {typeof (HealthCheckAttribute)}");
+ {
+ throw new InvalidOperationException($"The health check {thisType} requires a {typeof(HealthCheckAttribute)}");
+ }
+
Name = meta.Name;
Description = meta.Description;
Group = meta.Group;
@@ -49,7 +50,5 @@ namespace Umbraco.Web.HealthCheck
///
///
public abstract HealthCheckStatus ExecuteAction(HealthCheckAction action);
-
- // TODO: What else?
}
}
diff --git a/src/Umbraco.Core/HealthCheck/HealthCheckAction.cs b/src/Umbraco.Core/HealthCheck/HealthCheckAction.cs
index b64eb6746a..e1771a4262 100644
--- a/src/Umbraco.Core/HealthCheck/HealthCheckAction.cs
+++ b/src/Umbraco.Core/HealthCheck/HealthCheckAction.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
-namespace Umbraco.Web.HealthCheck
+namespace Umbraco.Core.HealthCheck
{
[DataContract(Name = "healthCheckAction", Namespace = "")]
public class HealthCheckAction
diff --git a/src/Umbraco.Core/HealthCheck/HealthCheckAttribute.cs b/src/Umbraco.Core/HealthCheck/HealthCheckAttribute.cs
index fe206f3186..bd8c10f899 100644
--- a/src/Umbraco.Core/HealthCheck/HealthCheckAttribute.cs
+++ b/src/Umbraco.Core/HealthCheck/HealthCheckAttribute.cs
@@ -1,6 +1,6 @@
using System;
-namespace Umbraco.Web.HealthCheck
+namespace Umbraco.Core.HealthCheck
{
///
/// Metadata attribute for Health checks
diff --git a/src/Umbraco.Core/HealthCheck/HealthCheckCollection.cs b/src/Umbraco.Core/HealthCheck/HealthCheckCollection.cs
index 6de442b765..fc8d5dff25 100644
--- a/src/Umbraco.Core/HealthCheck/HealthCheckCollection.cs
+++ b/src/Umbraco.Core/HealthCheck/HealthCheckCollection.cs
@@ -1,11 +1,11 @@
using System.Collections.Generic;
using Umbraco.Core.Composing;
-namespace Umbraco.Web.HealthCheck
+namespace Umbraco.Core.HealthCheck
{
- public class HealthCheckCollection : BuilderCollectionBase
+ public class HealthCheckCollection : BuilderCollectionBase
{
- public HealthCheckCollection(IEnumerable items)
+ public HealthCheckCollection(IEnumerable items)
: base(items)
{ }
}
diff --git a/src/Umbraco.Core/HealthCheck/HealthCheckGroup.cs b/src/Umbraco.Core/HealthCheck/HealthCheckGroup.cs
index f01c65f854..2cd1040896 100644
--- a/src/Umbraco.Core/HealthCheck/HealthCheckGroup.cs
+++ b/src/Umbraco.Core/HealthCheck/HealthCheckGroup.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
-namespace Umbraco.Web.HealthCheck
+namespace Umbraco.Core.HealthCheck
{
[DataContract(Name = "healthCheckGroup", Namespace = "")]
public class HealthCheckGroup
diff --git a/src/Umbraco.Core/HealthCheck/HealthCheckNotificationMethodAttribute.cs b/src/Umbraco.Core/HealthCheck/HealthCheckNotificationMethodAttribute.cs
index d9da271d58..f78df14942 100644
--- a/src/Umbraco.Core/HealthCheck/HealthCheckNotificationMethodAttribute.cs
+++ b/src/Umbraco.Core/HealthCheck/HealthCheckNotificationMethodAttribute.cs
@@ -1,6 +1,6 @@
using System;
-namespace Umbraco.Web.HealthCheck
+namespace Umbraco.Core.HealthCheck
{
///
/// Metadata attribute for health check notification methods
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/HealthCheckNotificationVerbosity.cs b/src/Umbraco.Core/HealthCheck/HealthCheckNotificationVerbosity.cs
similarity index 52%
rename from src/Umbraco.Core/Configuration/HealthChecks/HealthCheckNotificationVerbosity.cs
rename to src/Umbraco.Core/HealthCheck/HealthCheckNotificationVerbosity.cs
index 95e5ca8e03..74cd4eb93b 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/HealthCheckNotificationVerbosity.cs
+++ b/src/Umbraco.Core/HealthCheck/HealthCheckNotificationVerbosity.cs
@@ -1,6 +1,4 @@
-using System.Runtime.Serialization;
-
-namespace Umbraco.Core.Configuration.HealthChecks
+namespace Umbraco.Core.HealthCheck
{
public enum HealthCheckNotificationVerbosity
{
diff --git a/src/Umbraco.Core/HealthCheck/HealthCheckStatus.cs b/src/Umbraco.Core/HealthCheck/HealthCheckStatus.cs
index 245267ff8e..2eb873603f 100644
--- a/src/Umbraco.Core/HealthCheck/HealthCheckStatus.cs
+++ b/src/Umbraco.Core/HealthCheck/HealthCheckStatus.cs
@@ -2,7 +2,7 @@
using System.Linq;
using System.Runtime.Serialization;
-namespace Umbraco.Web.HealthCheck
+namespace Umbraco.Core.HealthCheck
{
///
/// The status returned for a health check when it performs it check
diff --git a/src/Umbraco.Core/HealthCheck/HeathCheckCollectionBuilder.cs b/src/Umbraco.Core/HealthCheck/HeathCheckCollectionBuilder.cs
index e616ba49ae..0894cb1912 100644
--- a/src/Umbraco.Core/HealthCheck/HeathCheckCollectionBuilder.cs
+++ b/src/Umbraco.Core/HealthCheck/HeathCheckCollectionBuilder.cs
@@ -1,6 +1,6 @@
using Umbraco.Core.Composing;
-namespace Umbraco.Web.HealthCheck
+namespace Umbraco.Core.HealthCheck
{
public class HealthCheckCollectionBuilder : LazyCollectionBuilderBase
{
diff --git a/src/Umbraco.Core/HealthCheck/IConfigurationService.cs b/src/Umbraco.Core/HealthCheck/IConfigurationService.cs
new file mode 100644
index 0000000000..dc513bb765
--- /dev/null
+++ b/src/Umbraco.Core/HealthCheck/IConfigurationService.cs
@@ -0,0 +1,7 @@
+namespace Umbraco.Core.HealthCheck
+{
+ public interface IConfigurationService
+ {
+ ConfigurationServiceResult UpdateConfigFile(string value, string itemPath);
+ }
+}
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/INotificationMethod.cs b/src/Umbraco.Core/HealthCheck/INotificationMethod.cs
similarity index 86%
rename from src/Umbraco.Core/Configuration/HealthChecks/INotificationMethod.cs
rename to src/Umbraco.Core/HealthCheck/INotificationMethod.cs
index 84bf55e160..9c4ec70cfe 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/INotificationMethod.cs
+++ b/src/Umbraco.Core/HealthCheck/INotificationMethod.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace Umbraco.Core.Configuration.HealthChecks
+namespace Umbraco.Core.HealthCheck
{
public interface INotificationMethod
{
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/INotificationMethodSettings.cs b/src/Umbraco.Core/HealthCheck/INotificationMethodSettings.cs
similarity index 69%
rename from src/Umbraco.Core/Configuration/HealthChecks/INotificationMethodSettings.cs
rename to src/Umbraco.Core/HealthCheck/INotificationMethodSettings.cs
index e41c82b393..01ad667d94 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/INotificationMethodSettings.cs
+++ b/src/Umbraco.Core/HealthCheck/INotificationMethodSettings.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Core.Configuration.HealthChecks
+namespace Umbraco.Core.HealthCheck
{
public interface INotificationMethodSettings
{
diff --git a/src/Umbraco.Core/HealthCheck/StatusResultType.cs b/src/Umbraco.Core/HealthCheck/StatusResultType.cs
index c6bd50f247..3f2c392933 100644
--- a/src/Umbraco.Core/HealthCheck/StatusResultType.cs
+++ b/src/Umbraco.Core/HealthCheck/StatusResultType.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Web.HealthCheck
+namespace Umbraco.Core.HealthCheck
{
public enum StatusResultType
{
diff --git a/src/Umbraco.Core/Configuration/HealthChecks/ValueComparisonType.cs b/src/Umbraco.Core/HealthCheck/ValueComparisonType.cs
similarity index 65%
rename from src/Umbraco.Core/Configuration/HealthChecks/ValueComparisonType.cs
rename to src/Umbraco.Core/HealthCheck/ValueComparisonType.cs
index 8df40da9f9..c5dd6517a8 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/ValueComparisonType.cs
+++ b/src/Umbraco.Core/HealthCheck/ValueComparisonType.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Web.HealthCheck.Checks.Config
+namespace Umbraco.Core.HealthCheck
{
public enum ValueComparisonType
{
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 07dea8d299..2b3efc9349 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -15,6 +15,7 @@
+
diff --git a/src/Umbraco.Infrastructure/HealthCheck/HealthCheckResults.cs b/src/Umbraco.Infrastructure/HealthCheck/HealthCheckResults.cs
index 7eebf61b22..1561645be9 100644
--- a/src/Umbraco.Infrastructure/HealthCheck/HealthCheckResults.cs
+++ b/src/Umbraco.Infrastructure/HealthCheck/HealthCheckResults.cs
@@ -3,11 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using HeyRed.MarkdownSharp;
-using Umbraco.Composing;
-using Umbraco.Core.Configuration.HealthChecks;
using Microsoft.Extensions.Logging;
+using Umbraco.Composing;
+using Umbraco.Core.HealthCheck;
-namespace Umbraco.Web.HealthCheck
+namespace Umbraco.Infrastructure.HealthCheck
{
public class HealthCheckResults
{
@@ -16,7 +16,7 @@ namespace Umbraco.Web.HealthCheck
private ILogger Logger => Current.Logger; // TODO: inject
- public HealthCheckResults(IEnumerable checks)
+ public HealthCheckResults(IEnumerable checks)
{
_results = checks.ToDictionary(
t => t.Name,
diff --git a/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/EmailNotificationMethod.cs b/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/EmailNotificationMethod.cs
index 49981b0b9a..d925ce14bf 100644
--- a/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/EmailNotificationMethod.cs
+++ b/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/EmailNotificationMethod.cs
@@ -5,9 +5,10 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.Configuration;
-using Umbraco.Core.Configuration.HealthChecks;
using Umbraco.Core.Configuration.Models;
+using Umbraco.Core.HealthCheck;
using Umbraco.Core.Services;
+using Umbraco.Infrastructure.HealthCheck;
namespace Umbraco.Web.HealthCheck.NotificationMethods
{
diff --git a/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/IHealthCheckNotificationMethod.cs b/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/IHealthCheckNotificationMethod.cs
index f6e8f1d1c5..fdf72251be 100644
--- a/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/IHealthCheckNotificationMethod.cs
+++ b/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/IHealthCheckNotificationMethod.cs
@@ -1,6 +1,7 @@
using System.Threading;
using System.Threading.Tasks;
using Umbraco.Core.Composing;
+using Umbraco.Infrastructure.HealthCheck;
namespace Umbraco.Web.HealthCheck.NotificationMethods
{
diff --git a/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/NotificationMethodBase.cs b/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/NotificationMethodBase.cs
index 2c0c5bcc1f..39025df2ab 100644
--- a/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/NotificationMethodBase.cs
+++ b/src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/NotificationMethodBase.cs
@@ -3,8 +3,10 @@ using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
-using Umbraco.Core.Configuration.HealthChecks;
using Umbraco.Core.Configuration.Models;
+using Umbraco.Core.HealthCheck;
+using Umbraco.Core.HealthCheck.Checks;
+using Umbraco.Infrastructure.HealthCheck;
namespace Umbraco.Web.HealthCheck.NotificationMethods
{
diff --git a/src/Umbraco.Infrastructure/Runtime/CoreInitialComposer.cs b/src/Umbraco.Infrastructure/Runtime/CoreInitialComposer.cs
index 601a12ac1c..f9ec706ab7 100644
--- a/src/Umbraco.Infrastructure/Runtime/CoreInitialComposer.cs
+++ b/src/Umbraco.Infrastructure/Runtime/CoreInitialComposer.cs
@@ -58,7 +58,9 @@ using Umbraco.Web.Trees;
using IntegerValidator = Umbraco.Core.PropertyEditors.Validators.IntegerValidator;
using TextStringValueConverter = Umbraco.Core.PropertyEditors.ValueConverters.TextStringValueConverter;
using Microsoft.Extensions.Logging;
-
+using Umbraco.Core.Configuration.HealthChecks;
+using Umbraco.Core.HealthCheck;
+using Umbraco.Core.HealthCheck.Checks;
namespace Umbraco.Core.Runtime
{
@@ -205,7 +207,7 @@ namespace Umbraco.Core.Runtime
// Config manipulator
composition.RegisterUnique();
-
+
// register the umbraco context factory
// composition.RegisterUnique();
composition.RegisterUnique();
@@ -298,7 +300,7 @@ namespace Umbraco.Core.Runtime
// register *all* checks, except those marked [HideFromTypeFinder] of course
composition.HealthChecks()
- .Add(() => composition.TypeLoader.GetTypes());
+ .Add(() => composition.TypeLoader.GetTypes());
composition.WithCollectionBuilder()
diff --git a/src/Umbraco.Infrastructure/Scheduling/HealthCheckNotifier.cs b/src/Umbraco.Infrastructure/Scheduling/HealthCheckNotifier.cs
index 6198e7845d..33eff2c949 100644
--- a/src/Umbraco.Infrastructure/Scheduling/HealthCheckNotifier.cs
+++ b/src/Umbraco.Infrastructure/Scheduling/HealthCheckNotifier.cs
@@ -3,11 +3,13 @@ using System.Threading;
using System.Threading.Tasks;
using Umbraco.Core;
using Umbraco.Core.Configuration.Models;
+using Umbraco.Core.HealthCheck;
using Umbraco.Core.Logging;
using Umbraco.Core.Scoping;
using Umbraco.Core.Sync;
using Umbraco.Web.HealthCheck;
using Microsoft.Extensions.Logging;
+using Umbraco.Infrastructure.HealthCheck;
namespace Umbraco.Web.Scheduling
{
diff --git a/src/Umbraco.Infrastructure/Scheduling/SchedulerComponent.cs b/src/Umbraco.Infrastructure/Scheduling/SchedulerComponent.cs
index c96071ff04..6e4b4bb629 100644
--- a/src/Umbraco.Infrastructure/Scheduling/SchedulerComponent.cs
+++ b/src/Umbraco.Infrastructure/Scheduling/SchedulerComponent.cs
@@ -7,8 +7,8 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.Composing;
-using Umbraco.Core.Configuration.HealthChecks;
using Umbraco.Core.Configuration.Models;
+using Umbraco.Core.HealthCheck;
using Umbraco.Core.Hosting;
using Umbraco.Core.Logging;
using Umbraco.Core.Scoping;
diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/HealthChecks/HealthCheckResultsTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/HealthChecks/HealthCheckResultsTests.cs
index 39a9ca6211..e18ab64716 100644
--- a/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/HealthChecks/HealthCheckResultsTests.cs
+++ b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/HealthChecks/HealthCheckResultsTests.cs
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using NUnit.Framework;
-using Umbraco.Core.Configuration.HealthChecks;
+using Umbraco.Core.HealthCheck;
+using Umbraco.Core.HealthCheck.Checks;
+using Umbraco.Infrastructure.HealthCheck;
using Umbraco.Web.HealthCheck;
namespace Umbraco.Tests.Web.HealthChecks
diff --git a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs
index 9f109d7bbf..874cb6fe1d 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs
@@ -14,6 +14,7 @@ using Umbraco.Core.Hosting;
using Umbraco.Core.Media;
using Umbraco.Core.WebAssets;
using Umbraco.Extensions;
+using Umbraco.Web.BackOffice.HealthCheck;
using Umbraco.Web.BackOffice.Profiling;
using Umbraco.Web.BackOffice.PropertyEditors;
using Umbraco.Web.BackOffice.Routing;
diff --git a/src/Umbraco.Web.BackOffice/HealthCheck/HealthCheckController.cs b/src/Umbraco.Web.BackOffice/HealthCheck/HealthCheckController.cs
index 99535d3d30..768ede1787 100644
--- a/src/Umbraco.Web.BackOffice/HealthCheck/HealthCheckController.cs
+++ b/src/Umbraco.Web.BackOffice/HealthCheck/HealthCheckController.cs
@@ -2,16 +2,16 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
-using Umbraco.Core;
-using Umbraco.Core.Configuration.HealthChecks;
-using Umbraco.Web.BackOffice.Filters;
-using Umbraco.Web.HealthCheck;
-using Umbraco.Web.Common.Attributes;
-using Umbraco.Core.Configuration.Models;
using Microsoft.Extensions.Options;
+using Umbraco.Core;
+using Umbraco.Core.Configuration.Models;
+using Umbraco.Core.HealthCheck;
+using Umbraco.Web.BackOffice.Controllers;
+using Umbraco.Web.BackOffice.Filters;
+using Umbraco.Web.Common.Attributes;
using Microsoft.Extensions.Logging;
-namespace Umbraco.Web.BackOffice.Controllers
+namespace Umbraco.Web.BackOffice.HealthCheck
{
///
/// The API controller used to display the health check info and execute any actions
@@ -85,7 +85,7 @@ namespace Umbraco.Web.BackOffice.Controllers
return check.ExecuteAction(action);
}
- private HealthCheck.HealthCheck GetCheckById(Guid id)
+ private Core.HealthCheck.HealthCheck GetCheckById(Guid id)
{
var check = _checks
.Where(x => _disabledCheckIds.Contains(x.Id) == false)
diff --git a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/cs.xml b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/cs.xml
index 914ac366cd..739b8d4684 100644
--- a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/cs.xml
+++ b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/cs.xml
@@ -2029,7 +2029,6 @@
Try Skip IIS Custom Errors je aktuálně nastaveno na '%0%'. Doporučuje se nastavit %1% pro vaši verzi služby IIS (%2%).
Try Skip IIS Custom Errors úspěšně nastaveno na '%0%'.
- Soubor neexistuje: '%0%'.
'% 0%' v konfiguračním souboru '% 1%'.]]>
Došlo k chybě, zkontrolujte ji v logu: %0%.
Databáze - Databázové schéma je pro tuto verzi Umbraco správné
@@ -2059,6 +2058,10 @@
Režim sledování je aktuálně povolen. Před spuštěním se doporučuje toto nastavení deaktivovat.
Režim sledování byl úspěšně deaktivován.
Všechny složky mají nastavena správná oprávnění.
+
+ Soubor neexistuje: '%0%'.
diff --git a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/de.xml b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/de.xml
index 86b1d6c130..cb95283bb7 100644
--- a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/de.xml
+++ b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/de.xml
@@ -2101,7 +2101,6 @@
"trySkipIisCustomErrors" ist auf '%0%' gestellt und Sie verwenden IIS-Version '%1%'.
"trySkipIisCustomErrors" ist aktuell auf '%0%' gestellt. Für Ihre IIS-Version (%2%) wird empfohlen, diese auf '%1%' zu stellen.
"trySkipIisCustomErrors" wurde erfolgreich auf '%0%' gestellt.
- Folgende Datei ist nicht vorhanden: '%0%'.
'%0%' wurde nicht in der Konfigurationsdatei '%1%' gefunden.]]>
Es trat ein Fehler auf, für eine vollständige Fehlermeldung suchen Sie in den Logs nach: %0%
Datenbank - Das Datenbank-Schema ist korrekt für diese Umbraco-Version
@@ -2130,6 +2129,10 @@
Trace-Modus ist gegenwertig eingeschaltet. Es ist empfehlenswert diesen vor Live-Gang abzuschalten.
Trace-Modus wurde erfolgreich abgeschaltet.
Alle Ordner haben die korrekten Zugriffsrechte.
+
+ Folgende Datei ist nicht vorhanden: '%0%'.
%0%.]]>
%0%. Falls nicht in diese geschrieben wird, brauchen Sie nichts zu unternehmen.]]>
Alle Dateien haben die korrekten Zugriffsrechte.
diff --git a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en.xml
index 6b1fa7e420..0d1188db50 100644
--- a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en.xml
+++ b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en.xml
@@ -2095,7 +2095,6 @@ To manage your website, simply open the Umbraco back office and start adding con
Try Skip IIS Custom Errors is currently '%0%'. It is recommended to set this to '%1%' for your IIS version (%2%).
Try Skip IIS Custom Errors successfully set to '%0%'.
- File does not exist: '%0%'.
'%0%' in config file '%1%'.]]>
There was an error, check log for full error: %0%.
Database - The database schema is correct for this version of Umbraco
@@ -2125,6 +2124,10 @@ To manage your website, simply open the Umbraco back office and start adding con
Trace mode is currently enabled. It is recommended to disable this setting before go live.
Trace mode successfully disabled.
All folders have the correct permissions set.
+
+ File does not exist: '%0%'.
diff --git a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en_us.xml
index c45049087d..0599caee9c 100644
--- a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en_us.xml
+++ b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en_us.xml
@@ -2116,7 +2116,6 @@ To manage your website, simply open the Umbraco back office and start adding con
Try Skip IIS Custom Errors is currently '%0%'. It is recommended to set this to '%1%' for your IIS version (%2%).
Try Skip IIS Custom Errors successfully set to '%0%'.
- File does not exist: '%0%'.
'%0%' in config file '%1%'.]]>
There was an error, check log for full error: %0%.
Database - The database schema is correct for this version of Umbraco
@@ -2152,6 +2151,10 @@ To manage your website, simply open the Umbraco back office and start adding con
%0%.]]>
%0%. If they aren't being written to no action need be taken.]]>
All files have the correct permissions set.
+
+ File does not exist: '%0%'.
diff --git a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/es.xml b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/es.xml
index c35c84ebdc..678afa10d6 100644
--- a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/es.xml
+++ b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/es.xml
@@ -1568,8 +1568,6 @@
Intentar saltar Errores Personalizados de IIS está '%0%'. Se recomienda configurarlo como '%1%' para tu versión (%2%) de IIS.
Intentar saltar Errores Personalizados de IIS se configuró como con '%0%' éxito.
- Archivo no existe: '%0%'.
- '%0%' en archivo de configuración '%1%'.]]>
Hubo un error, revisa los logs para ver el error completo: %0%.
El certificado de tu sitio es válido.
Error validando certificado: '%0%'
@@ -1601,6 +1599,10 @@
%0%.]]>
%0%. Opcional.]]>
Todos los archivos tienen los permisos correspondientes.
+
+ '%0%' en archivo de configuración '%1%'.]]>
diff --git a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/fr.xml b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/fr.xml
index b83ee4f9fe..17875e53e4 100644
--- a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/fr.xml
+++ b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/fr.xml
@@ -2040,7 +2040,6 @@ Pour gérer votre site, ouvrez simplement le backoffice Umbraco et commencez à
Try Skip IIS Custom Errors est actuellement fixé à '%0%'. Il est recommandé de fixer la valeur à '%1%' pour votre version IIS (%2%).
Try Skip IIS Custom Errors a été rectifié avec succès à la valeur '%0%'.
- Le fichier n'existe pas : '%0%'.
'%0%' dans le fichier config '%1%'.]]>
Une erreur est survenue, consultez le log pour voir l'erreur complète : %0%.
Base de données - Le schéma de la base de données est correct pour cette version de Umbraco
@@ -2070,6 +2069,10 @@ Pour gérer votre site, ouvrez simplement le backoffice Umbraco et commencez à
Le mode tracing est actuellement activé. Il est recommandé de désactiver cette configuration avant la mise en ligne.
Le mode tracing a été désactivé avec succès.
Tous les répertoires ont les configurations de permissions adéquates.
+
+ Le fichier n'existe pas : '%0%'.
@@ -2355,4 +2358,4 @@ Pour gérer votre site, ouvrez simplement le backoffice Umbraco et commencez à
]]>
-
\ No newline at end of file
+
diff --git a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/nl.xml b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/nl.xml
index 8361383b58..27894b4a1d 100644
--- a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/nl.xml
+++ b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/nl.xml
@@ -1326,7 +1326,6 @@ Echter, Runway biedt een gemakkelijke basis om je snel op weg te helpen. Als je
Try Skip IIS Custom foutmeldingen is ingesteld op '%0%'. Het wordt voor de gebruikte IIS versie (%2%) aangeraden deze in te stellen op '%1%'.
Try Skip IIS Custom foutmeldingen ingesteld op '%0%'.
- Het volgende bestand bestaat niet: '%0%'.
'%0%' kon niet gevonden worden in configuratie bestand '%1%'.]]>
Er is een fout opgetreden. Bekijk de log file voor de volledige fout: %0%.
Het cerficaat van de website is ongeldig.
@@ -1357,6 +1356,10 @@ Echter, Runway biedt een gemakkelijke basis om je snel op weg te helpen. Als je
%0%.]]>
%0%. Als deze niet in gebruik zijn voor deze omgeving hoeft er geen actie te worden ondernomen.]]>
All files have the correct permissions set.
+
+ Het volgende bestand bestaat niet: '%0%'.
diff --git a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/pl.xml b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/pl.xml
index fd806041c5..1c095448b5 100644
--- a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/pl.xml
+++ b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/pl.xml
@@ -1403,7 +1403,6 @@ Naciśnij przycisk instaluj, aby zainstalować bazę danych Umb
Try Skip IIS Custom Errors wynosi obecnie '%0%'. Zalecane jest ustawienie go na '%1%' dla Twojego IIS w wersji (%2%).
Try Skip IIS Custom Errors ustawiono z powodzeniem na '%0%'.
- Plik nie istnieje: '%0%'.
'%0%' w pliku konfiguracyjnym '%1%'.]]>
Wystąpił błąd, sprawdź logi, aby wyświetlić pełen opis błędu: %0%.
Certifikat Twojej strony jest poprawny.
@@ -1436,6 +1435,7 @@ Naciśnij przycisk instaluj, aby zainstalować bazę danych Umb
%0%.]]>
%0%. Jeśli nie będzie nic w nich pisane, żadne działania nie muszą być podejmowane.]]>
Wszystkie pliki mają ustawione poprawne uprawnienia.
+ Plik nie istnieje: '%0%'.
diff --git a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/ru.xml b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/ru.xml
index 7a3e099262..6654543ec8 100644
--- a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/ru.xml
+++ b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/ru.xml
@@ -694,7 +694,6 @@
Параметр 'Try Skip IIS Custom Errors' сейчас установлен в '%0%'. Рекомендуется установить в '%1%' для Вашего текущего IIS версии (%2%).
Параметр 'Try Skip IIS Custom Errors' успешно установлен в '%0%'.
- Файл не существует: '%0%'.
'%0%' в файле конфигурации '%1%'.]]>
Обнаружена ошибка, для получения полной информации обратитесь к журналу: %0%.
Ошибка проверки адреса URL %0% - '%1%'
@@ -725,6 +724,10 @@
%0%.]]>
%0%. Если в них не разрешена запись, не нужно предпринимать никаких действий.]]>
Все файлы имеют корректно установленные параметры безопасности.
+
+ Файл не существует: '%0%'.
diff --git a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/zh.xml b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/zh.xml
index 5210b46bcc..5a470583a8 100644
--- a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/zh.xml
+++ b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/zh.xml
@@ -1190,7 +1190,6 @@
Try Skip IIS Custom Errors is currently '%0%'. It is recommended to set this to '%1%' for your IIS version (%2%).
Try Skip IIS Custom Errors successfully set to '%0%'.
- File does not exist: '%0%'.
'%0%' in config file '%1%'.]]>
There was an error, check log for full error: %0%.
Your site certificate was marked as valid.
@@ -1221,6 +1220,10 @@
%0%.]]>
%0%. If they aren't being written to no action need be taken.]]>
All files have the correct permissions set.
+
+ File does not exist: '%0%'.
diff --git a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/zh_tw.xml b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/zh_tw.xml
index 320c3f63d8..06e8ec3e54 100644
--- a/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/zh_tw.xml
+++ b/src/Umbraco.Web.UI.NetCore/umbraco/config/lang/zh_tw.xml
@@ -1170,7 +1170,6 @@
嘗試略過IIS自訂錯誤目前設為 %0%,然而在您使用的IIS版本為 %2% 時,建議設定是 %1%。
嘗試略過IIS自訂錯誤已成功設為 %0%。
- 檔案不存在:%0%。
'%1%'中無法找到'%0%'。]]>
有錯誤產生,請參閱下列錯誤的紀錄:%0%。
憑證驗證錯誤:%0%
@@ -1200,6 +1199,10 @@
%0%。]]>
%0%。如果無須寫入,不需採取行動。]]>
所有檔案已有正確權限設定。
+
+ 檔案不存在:%0%。
diff --git a/src/Umbraco.Web/Composing/Current.cs b/src/Umbraco.Web/Composing/Current.cs
index 44468f2943..0889a9c019 100644
--- a/src/Umbraco.Web/Composing/Current.cs
+++ b/src/Umbraco.Web/Composing/Current.cs
@@ -10,6 +10,7 @@ using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Persistence;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
+using Umbraco.Core.HealthCheck;
using Umbraco.Core.Hosting;
using Umbraco.Core.Mapping;
using Umbraco.Core.Templates;