From 93ae55c91921062753697d5e4a8f0127a6aed587 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 3 Oct 2018 10:26:47 +0200 Subject: [PATCH] Removes the DatabaseSchemaValidationHealthCheck for now until we can improve it Fixes #3132 --- .../DatabaseSchemaValidationHealthCheck.cs | 63 ------------------- src/Umbraco.Web/Umbraco.Web.csproj | 1 - 2 files changed, 64 deletions(-) delete mode 100644 src/Umbraco.Web/HealthCheck/Checks/DataIntegrity/DatabaseSchemaValidationHealthCheck.cs diff --git a/src/Umbraco.Web/HealthCheck/Checks/DataIntegrity/DatabaseSchemaValidationHealthCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/DataIntegrity/DatabaseSchemaValidationHealthCheck.cs deleted file mode 100644 index 4371d80309..0000000000 --- a/src/Umbraco.Web/HealthCheck/Checks/DataIntegrity/DatabaseSchemaValidationHealthCheck.cs +++ /dev/null @@ -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 -{ - /// - /// U4-9544 Health check to detect if the database has any missing indexes or constraints - /// - [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 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 - }; - } - } -} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 7e961bf7af..66cce9b1bf 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -338,7 +338,6 @@ -