Files
Umbraco-CMS/src/Umbraco.Web/Install/Controllers/InstallController.cs
T
Sebastiaan Janssen a3c99531bf U4-8898 Blank login screen after upgrade to 7.5.x
Moves the updating of the CDF version to the very beginning before we even redirect to the login screen so it is nicely cachebusted
2016-09-03 10:23:17 +02:00

77 lines
2.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Web.Security;
namespace Umbraco.Web.Install.Controllers
{
/// <summary>
/// The MVC Installation controller
/// </summary>
/// <remarks>
/// NOTE: All views must have their full paths as we do not have a custom view engine for the installation views!
/// </remarks>
[InstallAuthorizeAttribute]
public class InstallController : Controller
{
private readonly UmbracoContext _umbracoContext;
public InstallController()
: this(UmbracoContext.Current)
{
}
public InstallController(UmbracoContext umbracoContext)
{
_umbracoContext = umbracoContext;
}
[HttpGet]
public ActionResult Index()
{
if (ApplicationContext.Current.IsConfigured)
{
return Redirect(SystemDirectories.Umbraco.EnsureEndsWith('/'));
}
if (ApplicationContext.Current.IsUpgrading)
{
// Update ClientDependency version
var clientDependencyConfig = new ClientDependencyConfiguration(ApplicationContext.Current.ProfilingLogger.Logger);
var clientDependencyUpdated = clientDependencyConfig.IncreaseVersionNumber();
var result = _umbracoContext.Security.ValidateCurrentUser(false);
switch (result)
{
case ValidateRequestAttempt.FailedNoPrivileges:
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");
//get the base umbraco folder
ViewBag.UmbracoBaseFolder = IOHelper.ResolveUrl(SystemDirectories.Umbraco);
InstallHelper ih = new InstallHelper(_umbracoContext);
ih.InstallStatus(false, "");
//always ensure full path (see NOTE in the class remarks)
return View(GlobalSettings.Path.EnsureEndsWith('/') + "install/views/index.cshtml");
}
}
}