Skip to content

Commit

Permalink
Update the method determining whether to installation is fresh or not…
Browse files Browse the repository at this point in the history
… by taking into accont empty database
  • Loading branch information
sebastien-sougnez committed Nov 23, 2018
1 parent dd6e764 commit 35343f1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Umbraco.Core/DatabaseContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ private static bool ServerStartsWithTcp(string server)
/// </remarks>
/// <param name="connectionString"></param>
/// <param name="providerName"></param>
private void SaveConnectionString(string connectionString, string providerName)
internal void SaveConnectionString(string connectionString, string providerName)
{
//Set the connection string for the new datalayer
var connectionStringSettings = string.IsNullOrEmpty(providerName)
Expand Down Expand Up @@ -932,4 +932,4 @@ public void Dispose()
}
*/
}
}
}
21 changes: 16 additions & 5 deletions src/Umbraco.Web/Install/InstallHelper.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.UI;
using Semver;
using umbraco.BusinessLogic;
using Umbraco.Core;
using Umbraco.Core.Configuration;
Expand Down Expand Up @@ -113,14 +108,18 @@ internal void InstallStatus(bool isCompleted, string errorMsg)
{
// check that it's a valid Guid
if (installId == Guid.Empty)
{
installId = Guid.NewGuid();
}
}
}
installCookie.SetValue(installId.ToString());

string dbProvider = string.Empty;
if (IsBrandNewInstall == false)
{
dbProvider = ApplicationContext.Current.DatabaseContext.DatabaseProvider.ToString();
}

org.umbraco.update.CheckForUpgrade check = new org.umbraco.update.CheckForUpgrade();
check.Install(installId,
Expand Down Expand Up @@ -149,6 +148,16 @@ private bool IsBrandNewInstall
get
{
var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName];

if (_umbContext.Application.DatabaseContext.IsConnectionStringConfigured(databaseSettings)
&& !_umbContext.Application.DatabaseContext.SqlSyntax.GetTablesInSchema(_umbContext.Application.DatabaseContext.Database).Any())
{
GlobalSettings.ConfigurationStatus = string.Empty;
_umbContext.Application.DatabaseContext.SaveConnectionString(string.Empty, string.Empty);

return true;
}

if (GlobalSettings.ConfigurationStatus.IsNullOrWhiteSpace()
&& _umbContext.Application.DatabaseContext.IsConnectionStringConfigured(databaseSettings) == false)
{
Expand Down Expand Up @@ -193,7 +202,9 @@ private bool IsBrandNewInstall
internal IEnumerable<Package> GetStarterKits()
{
if (_httpClient == null)
{
_httpClient = new HttpClient();
}

var packages = new List<Package>();
try
Expand Down

0 comments on commit 35343f1

Please sign in to comment.