From 86a3f67871df47993c77df4fa8dbb123affbdc36 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 3 Dec 2025 09:08:01 +0800 Subject: [PATCH 1/2] Fix #5852: clear the cache after import content. --- .../HtmlText/Manager/HtmlTextManager.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Oqtane.Server/Modules/HtmlText/Manager/HtmlTextManager.cs b/Oqtane.Server/Modules/HtmlText/Manager/HtmlTextManager.cs index bca9f928..a60868be 100644 --- a/Oqtane.Server/Modules/HtmlText/Manager/HtmlTextManager.cs +++ b/Oqtane.Server/Modules/HtmlText/Manager/HtmlTextManager.cs @@ -1,3 +1,6 @@ +using System; +using System.Collections.Generic; +using System.Linq; using Oqtane.Infrastructure; using Oqtane.Models; using Oqtane.Modules.HtmlText.Repository; @@ -12,6 +15,7 @@ using Oqtane.Interfaces; using System.Collections.Generic; using System; using System.Threading.Tasks; +using Microsoft.Extensions.Caching.Memory; // ReSharper disable ConvertToUsingDeclaration @@ -23,15 +27,21 @@ namespace Oqtane.Modules.HtmlText.Manager private readonly IHtmlTextRepository _htmlText; private readonly IDBContextDependencies _DBContextDependencies; private readonly ISqlRepository _sqlRepository; + private readonly ITenantManager _tenantManager; + private readonly IMemoryCache _cache; public HtmlTextManager( IHtmlTextRepository htmlText, IDBContextDependencies DBContextDependencies, - ISqlRepository sqlRepository) + ISqlRepository sqlRepository, + ITenantManager tenantManager, + IMemoryCache cache) { _htmlText = htmlText; _DBContextDependencies = DBContextDependencies; _sqlRepository = sqlRepository; + _tenantManager = tenantManager; + _cache = cache; } public string ExportModule(Module module) @@ -71,6 +81,13 @@ namespace Oqtane.Modules.HtmlText.Manager htmlText.ModuleId = module.ModuleId; htmlText.Content = content; _htmlText.AddHtmlText(htmlText); + + //clear the cache for the module + var alias = _tenantManager.GetAlias(); + if(alias != null) + { + _cache.Remove($"HtmlText:{alias.SiteKey}:{module.ModuleId}"); + } } public bool Install(Tenant tenant, string version) From 47f42747cb1e46f49df2b84560951eb27b2ba9cf Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 3 Dec 2025 09:09:43 +0800 Subject: [PATCH 2/2] clean the usage. --- Oqtane.Server/Modules/HtmlText/Manager/HtmlTextManager.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/Oqtane.Server/Modules/HtmlText/Manager/HtmlTextManager.cs b/Oqtane.Server/Modules/HtmlText/Manager/HtmlTextManager.cs index a60868be..67f05805 100644 --- a/Oqtane.Server/Modules/HtmlText/Manager/HtmlTextManager.cs +++ b/Oqtane.Server/Modules/HtmlText/Manager/HtmlTextManager.cs @@ -10,10 +10,7 @@ using Oqtane.Repository; using Oqtane.Shared; using Oqtane.Migrations.Framework; using Oqtane.Documentation; -using System.Linq; using Oqtane.Interfaces; -using System.Collections.Generic; -using System; using System.Threading.Tasks; using Microsoft.Extensions.Caching.Memory;