Removes the DatabaseSchemaValidationHealthCheck for now until we can improve it

Fixes #3132
This commit is contained in:
Sebastiaan Janssen
2018-10-03 10:26:47 +02:00
parent 985e1cc1b7
commit 93ae55c919
2 changed files with 0 additions and 64 deletions

View File

@@ -1,63 +0,0 @@
using System.Collections.Generic;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Services;
namespace Umbraco.Web.HealthCheck.Checks.DataIntegrity
{
/// <summary>
/// U4-9544 Health check to detect if the database has any missing indexes or constraints
/// </summary>
[HealthCheck(
"0873D589-2064-4EA3-A152-C43417FE00A4",
"Database Schema Validation",
Description = "This checks the Umbraco database by doing a comparison of current indexes and schema items with the current state of the database and returns any problems it found. Useful to detect if the database hasn't been upgraded correctly.",
Group = "Data Integrity")]
public class DatabaseSchemaValidationHealthCheck : HealthCheck
{
private readonly DatabaseContext _databaseContext;
private readonly ILocalizedTextService _textService;
private readonly ILogger _logger;
public DatabaseSchemaValidationHealthCheck(HealthCheckContext healthCheckContext) : base(healthCheckContext)
{
_databaseContext = HealthCheckContext.ApplicationContext.DatabaseContext;
_textService = healthCheckContext.ApplicationContext.Services.TextService;
_logger = healthCheckContext.ApplicationContext.ProfilingLogger.Logger;
}
public override HealthCheckStatus ExecuteAction(HealthCheckAction action)
{
return CheckDatabase();
}
public override IEnumerable<HealthCheckStatus> GetStatus()
{
//return the statuses
return new[] { CheckDatabase() };
}
private HealthCheckStatus CheckDatabase()
{
var results = _databaseContext.ValidateDatabaseSchema();
_logger.Warn(typeof(DatabaseSchemaValidationHealthCheck), _textService.Localize("databaseSchemaValidationCheckDatabaseLogMessage"));
foreach(var error in results.Errors)
{
_logger.Warn(typeof(DatabaseSchemaValidationHealthCheck), error.Item1 + ": " + error.Item2);
}
if(results.Errors.Count > 0)
return new HealthCheckStatus(_textService.Localize("healthcheck/databaseSchemaValidationCheckDatabaseErrors", new[] { results.Errors.Count.ToString() }))
{
ResultType = StatusResultType.Error,
View = "Umbraco.Dashboard.DatabaseSchemaValidationController"
};
return new HealthCheckStatus(_textService.Localize("healthcheck/databaseSchemaValidationCheckDatabaseOk"))
{
ResultType = StatusResultType.Success
};
}
}
}

View File

@@ -338,7 +338,6 @@
<Compile Include="Editors\CodeFileController.cs" />
<Compile Include="Editors\TourController.cs" />
<Compile Include="Features\EnabledFeatures.cs" />
<Compile Include="HealthCheck\Checks\DataIntegrity\DatabaseSchemaValidationHealthCheck.cs" />
<Compile Include="HealthCheck\Checks\Security\XssProtectionCheck.cs" />
<Compile Include="HealthCheck\Checks\Security\HstsCheck.cs" />
<Compile Include="Models\BackOfficeTourFilter.cs" />