From 19b7a9dfff0e32b0bdec7bc24eb9ab580d378946 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 11 Mar 2014 18:09:54 +1100 Subject: [PATCH] Completes: U4-4369 Remove the need for an Areas folder for the installer --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 11 ++++--- .../Install}/Legacy/LoadStarterKits.ascx.cs | 0 .../Legacy/LoadStarterKits.ascx.designer.cs | 0 .../Install}/Legacy/loadStarterKits.ascx | 0 .../Install/Views}/Index.cshtml | 0 .../Install}/Views/Web.config | 0 .../developer/Packages/StarterKits.aspx.cs | 6 ++-- .../Install/Controllers/InstallController.cs | 9 +++++- src/Umbraco.Web/Install/InstallHelper.cs | 29 ++++++++++--------- src/Umbraco.Web/Install/UmbracoInstallArea.cs | 10 +++++-- 10 files changed, 40 insertions(+), 25 deletions(-) rename src/Umbraco.Web.UI/{Areas/UmbracoInstall => umbraco/Install}/Legacy/LoadStarterKits.ascx.cs (100%) rename src/Umbraco.Web.UI/{Areas/UmbracoInstall => umbraco/Install}/Legacy/LoadStarterKits.ascx.designer.cs (100%) rename src/Umbraco.Web.UI/{Areas/UmbracoInstall => umbraco/Install}/Legacy/loadStarterKits.ascx (100%) rename src/Umbraco.Web.UI/{Areas/UmbracoInstall/Views/Install => umbraco/Install/Views}/Index.cshtml (100%) rename src/Umbraco.Web.UI/{Areas/UmbracoInstall => umbraco/Install}/Views/Web.config (100%) diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 1f9d5ff564..827b0334f5 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -307,11 +307,11 @@ Properties\SolutionInfo.cs - + loadStarterKits.ascx ASPXCodeBehind - + loadStarterKits.ascx @@ -536,7 +536,7 @@ treeInit.aspx - + @@ -573,7 +573,7 @@ - + 404handlers.config @@ -636,7 +636,7 @@ Designer - + Designer @@ -2502,7 +2502,6 @@ - diff --git a/src/Umbraco.Web.UI/Areas/UmbracoInstall/Legacy/LoadStarterKits.ascx.cs b/src/Umbraco.Web.UI/umbraco/Install/Legacy/LoadStarterKits.ascx.cs similarity index 100% rename from src/Umbraco.Web.UI/Areas/UmbracoInstall/Legacy/LoadStarterKits.ascx.cs rename to src/Umbraco.Web.UI/umbraco/Install/Legacy/LoadStarterKits.ascx.cs diff --git a/src/Umbraco.Web.UI/Areas/UmbracoInstall/Legacy/LoadStarterKits.ascx.designer.cs b/src/Umbraco.Web.UI/umbraco/Install/Legacy/LoadStarterKits.ascx.designer.cs similarity index 100% rename from src/Umbraco.Web.UI/Areas/UmbracoInstall/Legacy/LoadStarterKits.ascx.designer.cs rename to src/Umbraco.Web.UI/umbraco/Install/Legacy/LoadStarterKits.ascx.designer.cs diff --git a/src/Umbraco.Web.UI/Areas/UmbracoInstall/Legacy/loadStarterKits.ascx b/src/Umbraco.Web.UI/umbraco/Install/Legacy/loadStarterKits.ascx similarity index 100% rename from src/Umbraco.Web.UI/Areas/UmbracoInstall/Legacy/loadStarterKits.ascx rename to src/Umbraco.Web.UI/umbraco/Install/Legacy/loadStarterKits.ascx diff --git a/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Install/Index.cshtml b/src/Umbraco.Web.UI/umbraco/Install/Views/Index.cshtml similarity index 100% rename from src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Install/Index.cshtml rename to src/Umbraco.Web.UI/umbraco/Install/Views/Index.cshtml diff --git a/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Web.config b/src/Umbraco.Web.UI/umbraco/Install/Views/Web.config similarity index 100% rename from src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Web.config rename to src/Umbraco.Web.UI/umbraco/Install/Views/Web.config diff --git a/src/Umbraco.Web.UI/umbraco/developer/Packages/StarterKits.aspx.cs b/src/Umbraco.Web.UI/umbraco/developer/Packages/StarterKits.aspx.cs index a4eca93c84..f673156fbf 100644 --- a/src/Umbraco.Web.UI/umbraco/developer/Packages/StarterKits.aspx.cs +++ b/src/Umbraco.Web.UI/umbraco/developer/Packages/StarterKits.aspx.cs @@ -1,5 +1,7 @@ using System; using System.Linq; +using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Web.UI.Install.Steps.Skinning; @@ -62,7 +64,7 @@ namespace Umbraco.Web.UI.Umbraco.Developer.Packages private void ShowStarterKits() { - if (Directory.Exists(Server.MapPath("~/Areas/UmbracoInstall/Legacy")) == false) + if (Directory.Exists(Server.MapPath(GlobalSettings.Path.EnsureEndsWith('/') + "install/Legacy")) == false) { InstallationDirectoryNotAvailable.Visible = true; StarterKitNotInstalled.Visible = false; @@ -71,7 +73,7 @@ namespace Umbraco.Web.UI.Umbraco.Developer.Packages } - var starterkitsctrl = (LoadStarterKits)LoadControl("~/Areas/UmbracoInstall/Legacy/loadStarterKits.ascx"); + var starterkitsctrl = (LoadStarterKits)LoadControl(GlobalSettings.Path.EnsureEndsWith('/') + "install/Legacy/loadStarterKits.ascx"); ph_starterkits.Controls.Add(starterkitsctrl); diff --git a/src/Umbraco.Web/Install/Controllers/InstallController.cs b/src/Umbraco.Web/Install/Controllers/InstallController.cs index 5606d0d5b3..97c8246e71 100644 --- a/src/Umbraco.Web/Install/Controllers/InstallController.cs +++ b/src/Umbraco.Web/Install/Controllers/InstallController.cs @@ -11,6 +11,12 @@ using Umbraco.Web.Security; namespace Umbraco.Web.Install.Controllers { + /// + /// The MVC Installation controller + /// + /// + /// NOTE: All views must have their full paths as we do not have a custom view engine for the installation views! + /// [InstallAuthorizeAttribute] public class InstallController : Controller { @@ -62,7 +68,8 @@ namespace Umbraco.Web.Install.Controllers //get the base umbraco folder ViewBag.UmbracoBaseFolder = IOHelper.ResolveUrl(SystemDirectories.Umbraco); - return View(); + //always ensure full path (see NOTE in the class remarks) + return View(GlobalSettings.Path.EnsureEndsWith('/') + "install/views/index.cshtml"); } } diff --git a/src/Umbraco.Web/Install/InstallHelper.cs b/src/Umbraco.Web/Install/InstallHelper.cs index 9fbf29bb41..ff57de7454 100644 --- a/src/Umbraco.Web/Install/InstallHelper.cs +++ b/src/Umbraco.Web/Install/InstallHelper.cs @@ -23,7 +23,7 @@ namespace Umbraco.Web.Install internal InstallHelper(UmbracoContext umbContext) { - _umbContext = umbContext; + _umbContext = umbContext; } @@ -68,8 +68,11 @@ namespace Umbraco.Web.Install internal void DeleteLegacyInstaller() { - if(Directory.Exists( IOHelper.MapPath( SystemDirectories.Install ))) + if (Directory.Exists(IOHelper.MapPath(SystemDirectories.Install))) Directory.Move(IOHelper.MapPath(SystemDirectories.Install), IOHelper.MapPath("~/app_data/temp/install_backup")); + + if (Directory.Exists(IOHelper.MapPath("~/Areas/UmbracoInstall"))) + Directory.Delete(IOHelper.MapPath("~/Areas/UmbracoInstall")); } /// @@ -86,7 +89,7 @@ namespace Umbraco.Web.Install //no version or conn string configured, must be a brand new install return true; } - + //now we have to check if this is really a new install, the db might be configured and might contain data if (_umbContext.Application.DatabaseContext.IsConnectionStringConfigured(databaseSettings) == false @@ -104,16 +107,16 @@ namespace Umbraco.Web.Install return true; } -// //check if there are any content types configured, if there isn't then we will consider this a new install -// result = _umbContext.Application.DatabaseContext.Database.ExecuteScalar( -// @"SELECT COUNT(*) FROM cmsContentType -// INNER JOIN umbracoNode ON cmsContentType.nodeId = umbracoNode.id -// WHERE umbracoNode.nodeObjectType = @contentType", new {contentType = Constants.ObjectTypes.DocumentType}); -// if (result == 0) -// { -// //no content types have been created -// return true; -// } + // //check if there are any content types configured, if there isn't then we will consider this a new install + // result = _umbContext.Application.DatabaseContext.Database.ExecuteScalar( + // @"SELECT COUNT(*) FROM cmsContentType + // INNER JOIN umbracoNode ON cmsContentType.nodeId = umbracoNode.id + // WHERE umbracoNode.nodeObjectType = @contentType", new {contentType = Constants.ObjectTypes.DocumentType}); + // if (result == 0) + // { + // //no content types have been created + // return true; + // } return false; } diff --git a/src/Umbraco.Web/Install/UmbracoInstallArea.cs b/src/Umbraco.Web/Install/UmbracoInstallArea.cs index 6077a93782..c1e47f4a66 100644 --- a/src/Umbraco.Web/Install/UmbracoInstallArea.cs +++ b/src/Umbraco.Web/Install/UmbracoInstallArea.cs @@ -1,6 +1,10 @@ -using System.Web.Http; +using System.Collections.Generic; +using System.Linq; +using System.Web.Http; using System.Web.Mvc; using System.Web.Routing; +using Microsoft.Web.Mvc; +using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Web.Editors; using Umbraco.Web.Install.Controllers; @@ -40,8 +44,8 @@ namespace Umbraco.Web.Install context.MapHttpRoute( "umbraco-install-api", "install/api/{action}/{id}", - new {controller = "InstallApi", action = "Status", id = RouteParameter.Optional}, - new[] {typeof (InstallApiController).Namespace}); + new { controller = "InstallApi", action = "Status", id = RouteParameter.Optional }, + new[] { typeof(InstallApiController).Namespace }); } public override string AreaName