From 71b117b9828f426e6bef6e5fe422251c1e658929 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:04:57 +0200 Subject: [PATCH] Dont seed when in upgrade mode, and maintenance page is enabled --- .../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 1cea1a236043..72d966830650 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; }