Removes default instructions from the installer service, passing in empty instructions is ok now and the server will assign defaults if they are empty.

This commit is contained in:
Shannon
2014-03-05 12:08:35 +11:00
parent 7f7f3202d2
commit ce068a60d5
7 changed files with 27 additions and 19 deletions

View File

@@ -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
}
};

View File

@@ -38,7 +38,6 @@
Umbraco.Sys = {};
Umbraco.Sys.ServerVariables = {
"installApiBaseUrl": "@ViewBag.InstallApiBaseUrl",
"defaultStarterKit": "@ViewBag.DefaultPackageId",
"umbracoBaseUrl": "@ViewBag.UmbracoBaseFolder"
};
</script>

View File

@@ -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];
}

View File

@@ -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");

View File

@@ -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");

View File

@@ -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<Guid>
internal class StarterKitDownloadStep : InstallSetupStep<Guid?>
{
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<string, object>
{

View File

@@ -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; }