more install bits

This commit is contained in:
Shannon
2014-02-26 18:25:59 +11:00
parent 00f2afe454
commit f9475305bb
6 changed files with 206 additions and 7 deletions

View File

@@ -1,9 +1,15 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Web.Http;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Web.Install.Models;
using Umbraco.Web.WebApi;
namespace Umbraco.Web.Install.Controllers
{
[AngularJsonOnlyConfiguration]
[HttpInstallAuthorize]
public class InstallApiController : ApiController
{
@@ -24,5 +30,88 @@ namespace Umbraco.Web.Install.Controllers
/// </summary>
public UmbracoContext UmbracoContext { get; private set; }
/// <summary>
/// Gets the install setup
/// </summary>
/// <returns></returns>
public InstallSetup GetSetup()
{
var status = new InstallSetup()
{
Status = GlobalSettings.ConfigurationStatus.IsNullOrWhiteSpace() ? InstallStatus.NewInstall : InstallStatus.Upgrade
};
//TODO: Check for user/site token
var steps = new List<InstallStep>();
if (status.Status == InstallStatus.NewInstall)
{
steps.AddRange(new[]
{
new InstallStep()
{
Name = "User",
View = "user"
},
new InstallStep()
{
Name = "Database",
View = "database"
},
new InstallStep()
{
Name = "StarterKit",
View = "starterKit"
},
});
}
else
{
//TODO: Add steps for upgrades
}
return status;
}
/// <summary>
/// Checks if the db can be connected to
/// </summary>
/// <returns></returns>
public HttpResponseMessage PostCheckDbConnection()
{
throw new NotImplementedException();
}
/// <summary>
/// Checks if the db credentials are correct
/// </summary>
/// <returns></returns>
public HttpResponseMessage PostCheckDbCredentials()
{
throw new NotImplementedException();
}
/// <summary>
/// Does the install
/// </summary>
/// <returns></returns>
public HttpResponseMessage PostPerformInstall(InstallInstructions model)
{
var steps = GetSetup();
InstallStatusTracker.Initialize(steps.Steps);
throw new NotImplementedException();
}
/// <summary>
/// Returns the current install status
/// </summary>
/// <returns></returns>
public IDictionary<string, bool> GetStatus()
{
return InstallStatusTracker.GetStatus();
}
}
}