nuget module installation fix
This commit is contained in:
parent
b15ff4732c
commit
3fc7e78e56
|
@ -74,7 +74,6 @@ namespace Oqtane.Infrastructure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool IsInstalled
|
public bool IsInstalled
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -212,6 +211,8 @@ namespace Oqtane.Infrastructure
|
||||||
|
|
||||||
private static void ModuleMigration(Assembly assembly, string connectionString)
|
private static void ModuleMigration(Assembly assembly, string connectionString)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Console.WriteLine($"Migrating assembly {assembly.FullName}");
|
||||||
var dbUpgradeConfig = DeployChanges.To.SqlDatabase(connectionString)
|
var dbUpgradeConfig = DeployChanges.To.SqlDatabase(connectionString)
|
||||||
.WithScriptsEmbeddedInAssembly(assembly); // scripts must be included as Embedded Resources
|
.WithScriptsEmbeddedInAssembly(assembly); // scripts must be included as Embedded Resources
|
||||||
var dbUpgrade = dbUpgradeConfig.Build();
|
var dbUpgrade = dbUpgradeConfig.Build();
|
||||||
|
@ -241,14 +242,16 @@ namespace Oqtane.Infrastructure
|
||||||
|
|
||||||
private static void TenantMigration(string connectionString, string dataDirectory)
|
private static void TenantMigration(string connectionString, string dataDirectory)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Tenant migration");
|
||||||
var assemblies = AppDomain.CurrentDomain.GetAssemblies()
|
var assemblies = AppDomain.CurrentDomain.GetAssemblies()
|
||||||
.Where(item => item.FullName != null && item.FullName.Contains(".Module.")).ToArray();
|
.Where(item => item.FullName != null && item.FullName.ToLower().Contains(".module.")).ToArray();
|
||||||
|
|
||||||
// get tenants
|
// get tenants
|
||||||
using (var db = new InstallationContext(connectionString))
|
using (var db = new InstallationContext(connectionString))
|
||||||
{
|
{
|
||||||
foreach (var tenant in db.Tenant.ToList())
|
foreach (var tenant in db.Tenant.ToList())
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"Migrating tenant {tenant.Name}");
|
||||||
connectionString = NormalizeConnectionString(tenant.DBConnectionString, dataDirectory);
|
connectionString = NormalizeConnectionString(tenant.DBConnectionString, dataDirectory);
|
||||||
// upgrade framework
|
// upgrade framework
|
||||||
var dbUpgradeConfig = DeployChanges.To.SqlDatabase(connectionString)
|
var dbUpgradeConfig = DeployChanges.To.SqlDatabase(connectionString)
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace Oqtane.Infrastructure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (install && restart)
|
if (install)
|
||||||
{
|
{
|
||||||
if (restart)
|
if (restart)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,8 +16,11 @@ namespace Oqtane.Server
|
||||||
var host = BuildWebHost(args);
|
var host = BuildWebHost(args);
|
||||||
using (var serviceScope = host.Services.GetRequiredService<IServiceScopeFactory>().CreateScope())
|
using (var serviceScope = host.Services.GetRequiredService<IServiceScopeFactory>().CreateScope())
|
||||||
{
|
{
|
||||||
var manager = serviceScope.ServiceProvider.GetService<DatabaseManager>();
|
var installationManager = serviceScope.ServiceProvider.GetService<IInstallationManager>();
|
||||||
manager.StartupMigration();
|
// install any modules or themes stored in nugget, then restart app to ensure all is loaded in order
|
||||||
|
installationManager.InstallPackages("Modules,Themes", true);
|
||||||
|
var databaseManager = serviceScope.ServiceProvider.GetService<DatabaseManager>();
|
||||||
|
databaseManager.StartupMigration();
|
||||||
}
|
}
|
||||||
host.Run();
|
host.Run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ namespace Oqtane
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IInstallationManager installationManager)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IInstallationManager installationManager, DatabaseManager databaseManager)
|
||||||
{
|
{
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
|
@ -214,9 +214,6 @@ namespace Oqtane
|
||||||
app.UseHsts();
|
app.UseHsts();
|
||||||
}
|
}
|
||||||
|
|
||||||
// install any modules or themes
|
|
||||||
installationManager.InstallPackages("Modules,Themes", false);
|
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user