diff --git a/Oqtane.Server/Infrastructure/UpgradeManager.cs b/Oqtane.Server/Infrastructure/UpgradeManager.cs index df18a555..532bc3d0 100644 --- a/Oqtane.Server/Infrastructure/UpgradeManager.cs +++ b/Oqtane.Server/Infrastructure/UpgradeManager.cs @@ -7,11 +7,15 @@ using Oqtane.Infrastructure.SiteTemplates; using Oqtane.Models; using Oqtane.Repository; using Oqtane.Shared; +using Oqtane.UI; +using Org.BouncyCastle.Pqc.Crypto.Lms; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; +using System.Reflection.Metadata; +using System.Runtime.Serialization; namespace Oqtane.Infrastructure { @@ -90,6 +94,9 @@ namespace Oqtane.Infrastructure case "6.2.0": Upgrade_6_2_0(tenant, scope); break; + case "6.2.1": + Upgrade_6_2_1(tenant, scope); + break; } } } @@ -598,6 +605,25 @@ namespace Oqtane.Infrastructure AddPagesToSites(scope, tenant, pageTemplates); } + private void Upgrade_6_2_1(Tenant tenant, IServiceScope scope) + { + // remove text editor files moved to new location + string[] files = { + "js/quill.min.js.map", + "js/quill1.3.7.min.js", + "js/quill.min.js", + "js/quill-blot-formatter.min.js", + "js/quill-interop.js", + "css/quill/quill1.3.7.bubble.css", + "css/quill/quill.bubble.css", + "css/quill/quill1.3.7.snow.css", + "css/quill/quill.snow.css", + "oqtane-black.png" + }; + + RemoveFiles(tenant, files, "6.2.1"); + } + private void AddPagesToSites(IServiceScope scope, Tenant tenant, List pageTemplates) { var tenants = scope.ServiceProvider.GetRequiredService(); @@ -618,8 +644,8 @@ namespace Oqtane.Infrastructure { try { - var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); - var filepath = Path.Combine(binFolder, assembly); + var bin = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); + var filepath = Path.Combine(bin, assembly); if (System.IO.File.Exists(filepath)) System.IO.File.Delete(filepath); } catch (Exception ex) @@ -630,5 +656,26 @@ namespace Oqtane.Infrastructure } } } + + private void RemoveFiles(Tenant tenant, string[] files, string version) + { + if (tenant.Name == TenantNames.Master) + { + foreach (var file in files) + { + try + { + var wwwroot = _environment.WebRootPath; + var filepath = Path.Combine(wwwroot, file); + if (System.IO.File.Exists(filepath)) System.IO.File.Delete(filepath); + } + catch (Exception ex) + { + // error deleting file + _filelogger.LogError(Utilities.LogMessage(this, $"Oqtane Error: {version} Upgrade Error Removing {file} - {ex}")); + } + } + } + } } }