Fix #2339 - refactor module upgrade logic to remove requirement on ServerManagerType for modules which have no backend

This commit is contained in:
Shaun Walker 2022-08-06 16:13:28 -04:00
parent 83acda6d05
commit d8b4267668

View File

@ -485,13 +485,15 @@ namespace Oqtane.Infrastructure
foreach (var moduleDefinition in moduleDefinitions.GetModuleDefinitions()) foreach (var moduleDefinition in moduleDefinitions.GetModuleDefinitions())
{ {
if (!string.IsNullOrEmpty(moduleDefinition.ReleaseVersions) && !string.IsNullOrEmpty(moduleDefinition.ServerManagerType)) if (!string.IsNullOrEmpty(moduleDefinition.ReleaseVersions))
{
var moduleType = Type.GetType(moduleDefinition.ServerManagerType);
if (moduleType != null)
{ {
var versions = moduleDefinition.ReleaseVersions.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var versions = moduleDefinition.ReleaseVersions.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
using (var db = GetInstallationContext()) using (var db = GetInstallationContext())
{
if (!string.IsNullOrEmpty(moduleDefinition.ServerManagerType))
{
var moduleType = Type.GetType(moduleDefinition.ServerManagerType);
if (moduleType != null)
{ {
foreach (var tenant in db.Tenant.ToList()) foreach (var tenant in db.Tenant.ToList())
{ {
@ -530,6 +532,9 @@ namespace Oqtane.Infrastructure
} }
} }
} }
}
}
if (string.IsNullOrEmpty(result.Message) && moduleDefinition.Version != versions[versions.Length - 1]) if (string.IsNullOrEmpty(result.Message) && moduleDefinition.Version != versions[versions.Length - 1])
{ {
// get module definition from database to retain user customizable property values // get module definition from database to retain user customizable property values
@ -546,7 +551,6 @@ namespace Oqtane.Infrastructure
} }
} }
} }
}
if (string.IsNullOrEmpty(result.Message)) if (string.IsNullOrEmpty(result.Message))
{ {