Gets the IsConfigured check checking the migration data, updates the install controller to ensure there's no infinite redirects and to use the IsUpgrading flag. Now to add entries to the table when the migrations have executed.

This commit is contained in:
Shannon
2015-06-22 16:22:47 +02:00
parent a1d7f2d8b3
commit 8e1e7a8676
8 changed files with 85 additions and 61 deletions

View File

@@ -37,30 +37,23 @@ namespace Umbraco.Web.Install.Controllers
[HttpGet]
public ActionResult Index()
{
//if this is not an upgrade we will log in with the default user.
// It's not considered an upgrade if the ConfigurationStatus is missing or empty or if the db is not configured.
if (string.IsNullOrWhiteSpace(GlobalSettings.ConfigurationStatus) == false
&& ApplicationContext.Current.DatabaseContext.IsDatabaseConfigured)
if (ApplicationContext.Current.IsConfigured)
{
Version current;
if (Version.TryParse(GlobalSettings.ConfigurationStatus, out current))
{
//check if we are on the current version, and not let the installer execute
if (current == UmbracoVersion.Current)
{
return Redirect(SystemDirectories.Umbraco.EnsureEndsWith('/'));
}
}
return Redirect(SystemDirectories.Umbraco.EnsureEndsWith('/'));
}
if (ApplicationContext.Current.IsUpgrading)
{
var result = _umbracoContext.Security.ValidateCurrentUser(false);
switch (result)
{
case ValidateRequestAttempt.FailedNoPrivileges:
case ValidateRequestAttempt.FailedNoContextId:
return Redirect(SystemDirectories.Umbraco + "/AuthorizeUpgrade?redir=" + Server.UrlEncode(Request.RawUrl));
case ValidateRequestAttempt.FailedNoContextId:
return Redirect(SystemDirectories.Umbraco + "/AuthorizeUpgrade?redir=" + Server.UrlEncode(Request.RawUrl));
}
}
}
//gen the install base url
ViewBag.InstallApiBaseUrl = Url.GetUmbracoApiService("GetSetup", "InstallApi", "UmbracoInstall").TrimEnd("GetSetup");