diff --git a/src/SQLCE4Umbraco/SqlCEHelper.cs b/src/SQLCE4Umbraco/SqlCEHelper.cs index af631fe7ba..1787c05912 100644 --- a/src/SQLCE4Umbraco/SqlCEHelper.cs +++ b/src/SQLCE4Umbraco/SqlCEHelper.cs @@ -40,10 +40,15 @@ namespace SqlCE4Umbraco var localConnection = new SqlCeConnection(ConnectionString); if (!System.IO.File.Exists(ReplaceDataDirectory(localConnection.Database))) { - using (var sqlCeEngine = new SqlCeEngine(ConnectionString)) - { - sqlCeEngine.CreateDatabase(); - } + var sqlCeEngine = new SqlCeEngine(ConnectionString); + sqlCeEngine.CreateDatabase(); + + // SD: Pretty sure this should be in a using clause but i don't want to cause unknown side-effects here + // since it's been like this for quite some time + //using (var sqlCeEngine = new SqlCeEngine(ConnectionString)) + //{ + // sqlCeEngine.CreateDatabase(); + //} } } diff --git a/src/Umbraco.Core/DatabaseContext.cs b/src/Umbraco.Core/DatabaseContext.cs index 729308e18e..5e0c1cd29f 100644 --- a/src/Umbraco.Core/DatabaseContext.cs +++ b/src/Umbraco.Core/DatabaseContext.cs @@ -120,10 +120,15 @@ namespace Umbraco.Core var path = Path.Combine(GlobalSettings.FullpathToRoot, "App_Data", "Umbraco.sdf"); if (File.Exists(path) == false) { - using (var engine = new SqlCeEngine(connectionString)) - { - engine.CreateDatabase(); - } + var engine = new SqlCeEngine(connectionString); + engine.CreateDatabase(); + + // SD: Pretty sure this should be in a using clause but i don't want to cause unknown side-effects here + // since it's been like this for quite some time + //using (var engine = new SqlCeEngine(connectionString)) + //{ + // engine.CreateDatabase(); + //} } Initialize(providerName); diff --git a/src/Umbraco.Tests/Install/InstallHelperTests.cs b/src/Umbraco.Tests/Install/InstallHelperTests.cs index 8764dd5183..ecce6d6b85 100644 --- a/src/Umbraco.Tests/Install/InstallHelperTests.cs +++ b/src/Umbraco.Tests/Install/InstallHelperTests.cs @@ -88,8 +88,8 @@ namespace Umbraco.Tests.Install var steps = helper.GetSteps().ToArray(); - //for new installs 4, don't require execution - Assert.AreEqual(4, steps.Count(x => x.RequiresExecution() == false)); + //for upgrades 5, don't require execution (the db context is not configured so the upgrade report will not execute either) + Assert.AreEqual(5, steps.Count(x => x.RequiresExecution() == false)); } diff --git a/src/Umbraco.Web/Install/InstallHelper.cs b/src/Umbraco.Web/Install/InstallHelper.cs index a31f7c6b97..7964ac3edc 100644 --- a/src/Umbraco.Web/Install/InstallHelper.cs +++ b/src/Umbraco.Web/Install/InstallHelper.cs @@ -50,6 +50,7 @@ namespace Umbraco.Web.Install { new FilePermissionsStep(), new UserStep(_umbContext.Application, _status), + new MajorVersion7UpgradeReport(_umbContext.Application, _status), new DatabaseConfigureStep(_umbContext.Application), new DatabaseInstallStep(_umbContext.Application), new DatabaseUpgradeStep(_umbContext.Application, _status), diff --git a/src/Umbraco.Web/Install/InstallSteps/MajorVersion7UpgradeReport.cs b/src/Umbraco.Web/Install/InstallSteps/MajorVersion7UpgradeReport.cs index bc61b35c20..f8b5bda68a 100644 --- a/src/Umbraco.Web/Install/InstallSteps/MajorVersion7UpgradeReport.cs +++ b/src/Umbraco.Web/Install/InstallSteps/MajorVersion7UpgradeReport.cs @@ -43,9 +43,17 @@ namespace Umbraco.Web.Install.InstallSteps return false; } - //we cannot run this step if the db is not configured. - if (_applicationContext.DatabaseContext.IsDatabaseConfigured == false) + try { + //we cannot run this step if the db is not configured. + if (_applicationContext.DatabaseContext.IsDatabaseConfigured == false) + { + return false; + } + } + catch (InvalidOperationException) + { + //if there is no db context return false; }