Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
@ -37,27 +37,30 @@ namespace Oqtane.Infrastructure
|
||||
_cache = cache;
|
||||
}
|
||||
|
||||
public bool IsInstalled()
|
||||
public Installation IsInstalled()
|
||||
{
|
||||
var defaultConnectionString = NormalizeConnectionString(_config.GetConnectionString(SettingKeys.ConnectionStringKey));
|
||||
var result = !string.IsNullOrEmpty(defaultConnectionString);
|
||||
if (result)
|
||||
var result = new Installation { Success = false, Message = string.Empty };
|
||||
if (!string.IsNullOrEmpty(_config.GetConnectionString(SettingKeys.ConnectionStringKey)))
|
||||
{
|
||||
result.Success = true;
|
||||
using (var scope = _serviceScopeFactory.CreateScope())
|
||||
{
|
||||
var db = scope.ServiceProvider.GetRequiredService<MasterDBContext>();
|
||||
result = db.Database.CanConnect();
|
||||
if (result)
|
||||
if (db.Database.CanConnect())
|
||||
{
|
||||
try
|
||||
{
|
||||
result = db.Tenant.Any();
|
||||
var provisioned = db.Tenant.Any();
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = false;
|
||||
result.Message = "Master Database Not Installed Correctly";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Message = "Cannot Connect To Master Database";
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -84,7 +87,8 @@ namespace Oqtane.Infrastructure
|
||||
IsNewTenant = false
|
||||
};
|
||||
|
||||
if (!IsInstalled())
|
||||
var installation = IsInstalled();
|
||||
if (!installation.Success)
|
||||
{
|
||||
install.Aliases = GetInstallationConfig(SettingKeys.DefaultAliasKey, string.Empty);
|
||||
install.HostPassword = GetInstallationConfig(SettingKeys.HostPasswordKey, string.Empty);
|
||||
@ -107,6 +111,14 @@ namespace Oqtane.Infrastructure
|
||||
install.ConnectionString = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(installation.Message))
|
||||
{
|
||||
// problem with prior installation
|
||||
install.ConnectionString = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user