From 86557a01cf2f3b2cb081c6190685fa543a36bff9 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Date: Tue, 15 Oct 2024 19:43:06 +0200 Subject: [PATCH] Dont seed when in upgrade mode, and maintenance page is enabled (#17275) --- .../NotificationHandlers/SeedingNotificationHandler.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.PublishedCache.HybridCache/NotificationHandlers/SeedingNotificationHandler.cs b/src/Umbraco.PublishedCache.HybridCache/NotificationHandlers/SeedingNotificationHandler.cs index 1cea1a2360..72d9668306 100644 --- a/src/Umbraco.PublishedCache.HybridCache/NotificationHandlers/SeedingNotificationHandler.cs +++ b/src/Umbraco.PublishedCache.HybridCache/NotificationHandlers/SeedingNotificationHandler.cs @@ -1,4 +1,6 @@ -using Umbraco.Cms.Core; +using Microsoft.Extensions.Options; +using Umbraco.Cms.Core; +using Umbraco.Cms.Core.Configuration.Models; using Umbraco.Cms.Core.Events; using Umbraco.Cms.Core.Notifications; using Umbraco.Cms.Core.Services; @@ -11,19 +13,21 @@ internal class SeedingNotificationHandler : INotificationAsyncHandler globalSettings) { _documentCacheService = documentCacheService; _mediaCacheService = mediaCacheService; _runtimeState = runtimeState; + _globalSettings = globalSettings.Value; } public async Task HandleAsync(UmbracoApplicationStartedNotification notification, CancellationToken cancellationToken) { - if (_runtimeState.Level <= RuntimeLevel.Install) + if (_runtimeState.Level <= RuntimeLevel.Install || (_runtimeState.Level == RuntimeLevel.Upgrade && _globalSettings.ShowMaintenancePageWhenInUpgradeState)) { return; }