Completes: U4-4369 Remove the need for an Areas folder for the installer

This commit is contained in:
Shannon
2014-03-11 18:09:54 +11:00
parent f432e23a47
commit 19b7a9dfff
10 changed files with 40 additions and 25 deletions

View File

@@ -307,11 +307,11 @@
<Compile Include="..\SolutionInfo.cs">
<Link>Properties\SolutionInfo.cs</Link>
</Compile>
<Compile Include="Areas\UmbracoInstall\Legacy\LoadStarterKits.ascx.cs">
<Compile Include="Umbraco\Install\Legacy\LoadStarterKits.ascx.cs">
<DependentUpon>loadStarterKits.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Areas\UmbracoInstall\Legacy\LoadStarterKits.ascx.designer.cs">
<Compile Include="Umbraco\Install\Legacy\LoadStarterKits.ascx.designer.cs">
<DependentUpon>loadStarterKits.ascx</DependentUpon>
</Compile>
<Compile Include="Config\splashes\NoNodes.aspx.cs">
@@ -536,7 +536,7 @@
<Compile Include="Umbraco\TreeInit.aspx.designer.cs">
<DependentUpon>treeInit.aspx</DependentUpon>
</Compile>
<Content Include="Areas\UmbracoInstall\Legacy\loadStarterKits.ascx" />
<Content Include="Umbraco\Install\Legacy\loadStarterKits.ascx" />
<Content Include="Umbraco\ClientRedirect.aspx" />
<Content Include="Umbraco\create.aspx" />
<Content Include="Umbraco\Logout.aspx" />
@@ -573,7 +573,7 @@
<SubType>
</SubType>
</Content>
<Content Include="Areas\UmbracoInstall\Views\Web.config" />
<Content Include="Umbraco\Install\Views\Web.config" />
<None Include="Config\404handlers.Release.config">
<DependentUpon>404handlers.config</DependentUpon>
</None>
@@ -636,7 +636,7 @@
<Content Include="MacroScripts\Web.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Areas\UmbracoInstall\Views\Install\Index.cshtml" />
<Content Include="Umbraco\Install\Views\Index.cshtml" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
@@ -2502,7 +2502,6 @@
<Folder Include="App_Code\" />
<Folder Include="App_Data\" />
<Folder Include="App_Plugins\" />
<Folder Include="Areas\UmbracoInstall\Views\Shared\" />
<Folder Include="Css\" />
<Folder Include="MasterPages\" />
<Folder Include="Media\" />

View File

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

View File

@@ -11,6 +11,12 @@ 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
{
@@ -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");
}
}

View File

@@ -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"));
}
/// <summary>
@@ -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<int>(
// @"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<int>(
// @"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;
}

View File

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