2016-06-13 17:42:05 +02:00
|
|
|
|
using System.Collections.Generic;
|
2020-09-21 13:04:57 +02:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2020-05-25 14:50:51 +02:00
|
|
|
|
using Umbraco.Core.Hosting;
|
2020-01-07 13:08:21 +01:00
|
|
|
|
using Umbraco.Core.IO;
|
2016-06-13 17:42:05 +02:00
|
|
|
|
using Umbraco.Core.Services;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.HealthCheck.Checks.Config
|
|
|
|
|
|
{
|
|
|
|
|
|
[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
|
|
|
|
|
|
{
|
2020-09-21 13:04:57 +02:00
|
|
|
|
public CompilationDebugCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILoggerFactory loggerFactory)
|
|
|
|
|
|
: base(textService, hostingEnvironment, loggerFactory)
|
2016-09-01 19:06:08 +02:00
|
|
|
|
{ }
|
2016-06-13 17:42:05 +02:00
|
|
|
|
|
2016-09-01 19:06:08 +02:00
|
|
|
|
public override string FilePath => "~/Web.config";
|
2016-06-13 17:42:05 +02:00
|
|
|
|
|
2016-09-01 19:06:08 +02:00
|
|
|
|
public override string XPath => "/configuration/system.web/compilation/@debug";
|
2016-06-13 17:42:05 +02:00
|
|
|
|
|
2016-09-01 19:06:08 +02:00
|
|
|
|
public override ValueComparisonType ValueComparisonType => ValueComparisonType.ShouldEqual;
|
2016-06-13 17:42:05 +02:00
|
|
|
|
|
2017-09-08 19:39:13 +02:00
|
|
|
|
public override bool ValidIfConfigMissing => true;
|
|
|
|
|
|
|
2016-09-01 19:06:08 +02:00
|
|
|
|
public override IEnumerable<AcceptableConfiguration> Values => new List<AcceptableConfiguration>
|
2016-06-13 17:42:05 +02:00
|
|
|
|
{
|
2016-09-01 19:06:08 +02:00
|
|
|
|
new AcceptableConfiguration { IsRecommended = true, Value = bool.FalseString.ToLower() }
|
|
|
|
|
|
};
|
2016-06-13 17:42:05 +02:00
|
|
|
|
|
2016-09-01 19:06:08 +02:00
|
|
|
|
public override string CheckSuccessMessage => TextService.Localize("healthcheck/compilationDebugCheckSuccessMessage");
|
2016-06-13 17:42:05 +02:00
|
|
|
|
|
2016-09-01 19:06:08 +02:00
|
|
|
|
public override string CheckErrorMessage => TextService.Localize("healthcheck/compilationDebugCheckErrorMessage");
|
2016-06-13 17:42:05 +02:00
|
|
|
|
|
2016-09-01 19:06:08 +02:00
|
|
|
|
public override string RectifySuccessMessage => TextService.Localize("healthcheck/compilationDebugCheckRectifySuccessMessage");
|
2016-06-13 17:42:05 +02:00
|
|
|
|
}
|
2017-07-20 11:21:28 +02:00
|
|
|
|
}
|