From ce068a60d533cd2ba1c3c9b6d20214198305d153 Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 5 Mar 2014 12:08:35 +1100 Subject: [PATCH] Removes default instructions from the installer service, passing in empty instructions is ok now and the server will assign defaults if they are empty. --- .../src/installer/installer.service.js | 2 -- .../UmbracoInstall/Views/Install/Index.cshtml | 1 - .../Install/Controllers/InstallApiController.cs | 8 ++------ .../Install/Controllers/InstallController.cs | 8 +------- .../Install/InstallSteps/DatabaseConfigureStep.cs | 6 ++++++ .../InstallSteps/StarterKitDownloadStep.cs | 15 ++++++++++++--- src/Umbraco.Web/Install/Models/DatabaseModel.cs | 6 ++++++ 7 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/installer/installer.service.js b/src/Umbraco.Web.UI.Client/src/installer/installer.service.js index 181d3e77eb..7abde9262a 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/installer.service.js +++ b/src/Umbraco.Web.UI.Client/src/installer/installer.service.js @@ -11,8 +11,6 @@ angular.module("umbraco.install").factory('installerService', function($q, $time var _installerModel = { installId: undefined, instructions: { - DatabaseConfigure: { dbType: 0 }, - StarterKitDownload: Umbraco.Sys.ServerVariables.defaultStarterKit } }; diff --git a/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Install/Index.cshtml b/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Install/Index.cshtml index 8d5f89d6e0..1e3215dcd4 100644 --- a/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Install/Index.cshtml +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Install/Index.cshtml @@ -38,7 +38,6 @@ Umbraco.Sys = {}; Umbraco.Sys.ServerVariables = { "installApiBaseUrl": "@ViewBag.InstallApiBaseUrl", - "defaultStarterKit": "@ViewBag.DefaultPackageId", "umbracoBaseUrl": "@ViewBag.UmbracoBaseFolder" }; diff --git a/src/Umbraco.Web/Install/Controllers/InstallApiController.cs b/src/Umbraco.Web/Install/Controllers/InstallApiController.cs index d14a24fec2..8d28d3164b 100644 --- a/src/Umbraco.Web/Install/Controllers/InstallApiController.cs +++ b/src/Umbraco.Web/Install/Controllers/InstallApiController.cs @@ -130,13 +130,9 @@ namespace Umbraco.Web.Install.Controllers var step = InstallHelper.GetAllSteps().Single(x => x.Name == stepStatus.Name); JToken instruction = null; - if (step.HasUIElement) + //If this step has any instructions then extract them + if (installModel.Instructions.Any(x => x.Key == step.Name)) { - //Since this is a UI instruction, we will extract the model from it - if (installModel.Instructions.Any(x => x.Key == step.Name) == false) - { - throw new HttpResponseException(Request.CreateValidationErrorResponse("No instruction defined for step: " + step.Name)); - } instruction = installModel.Instructions[step.Name]; } diff --git a/src/Umbraco.Web/Install/Controllers/InstallController.cs b/src/Umbraco.Web/Install/Controllers/InstallController.cs index 9642b7973c..ada14bfe76 100644 --- a/src/Umbraco.Web/Install/Controllers/InstallController.cs +++ b/src/Umbraco.Web/Install/Controllers/InstallController.cs @@ -54,13 +54,7 @@ namespace Umbraco.Web.Install.Controllers case ValidateRequestAttempt.FailedNoContextId: return Redirect(SystemDirectories.Umbraco + "/AuthorizeUpgrade?redir=" + Server.UrlEncode(Request.RawUrl)); } - } - - //get a package GUID - var r = new org.umbraco.our.Repository(); - var modules = r.Modules(); - var defaultPackageId = modules.First().RepoGuid; - ViewBag.DefaultPackageId = defaultPackageId; + } //gen the install base url ViewBag.InstallApiBaseUrl = Url.GetUmbracoApiService("GetSetup", "InstallApi", "install").TrimEnd("GetSetup"); diff --git a/src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs b/src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs index b2d6f1e0c5..83858fa048 100644 --- a/src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs @@ -27,6 +27,12 @@ namespace Umbraco.Web.Install.InstallSteps public override InstallSetupResult Execute(DatabaseModel database) { + //if the database model is null then we will apply the defaults + if (database == null) + { + database = new DatabaseModel(); + } + if (CheckConnection(database) == false) { throw new InvalidOperationException("Could not connect to the database"); diff --git a/src/Umbraco.Web/Install/InstallSteps/StarterKitDownloadStep.cs b/src/Umbraco.Web/Install/InstallSteps/StarterKitDownloadStep.cs index ed9d7ce52b..45b42220b7 100644 --- a/src/Umbraco.Web/Install/InstallSteps/StarterKitDownloadStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/StarterKitDownloadStep.cs @@ -10,7 +10,7 @@ namespace Umbraco.Web.Install.InstallSteps { [InstallSetupStep(InstallationType.NewInstall, "StarterKitDownload", "starterKit", 30, "Downloading a starter website from our.umbraco.org, hold tight, this could take a little while")] - internal class StarterKitDownloadStep : InstallSetupStep + internal class StarterKitDownloadStep : InstallSetupStep { private readonly ApplicationContext _applicationContext; @@ -21,10 +21,19 @@ namespace Umbraco.Web.Install.InstallSteps private const string RepoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66"; - public override InstallSetupResult Execute(Guid starterKitId) + public override InstallSetupResult Execute(Guid? starterKitId) { + //if there is no value assigned then use the default starter kit + if (starterKitId.HasValue == false) + { + //get a default package GUID (currently the first one found) + var r = new org.umbraco.our.Repository(); + var modules = r.Modules(); + var defaultPackageId = modules.First().RepoGuid; + starterKitId = defaultPackageId; + } - var result = DownloadPackageFiles(starterKitId); + var result = DownloadPackageFiles(starterKitId.Value); return new InstallSetupResult(new Dictionary { diff --git a/src/Umbraco.Web/Install/Models/DatabaseModel.cs b/src/Umbraco.Web/Install/Models/DatabaseModel.cs index b63820d2c4..74bf2935e5 100644 --- a/src/Umbraco.Web/Install/Models/DatabaseModel.cs +++ b/src/Umbraco.Web/Install/Models/DatabaseModel.cs @@ -5,6 +5,12 @@ namespace Umbraco.Web.Install.Models [DataContract(Name = "database", Namespace = "")] public class DatabaseModel { + public DatabaseModel() + { + //defaults + DatabaseType = DatabaseType.SqlCe; + } + [DataMember(Name = "dbType")] public DatabaseType DatabaseType { get; set; }