diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index 67eefd07a2..d45e8583a5 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -221,7 +221,7 @@ namespace Umbraco.Core.Configuration /// The fullpath to root. public static string FullpathToRoot { - get { return HttpRuntime.AppDomainAppPath; } + get { return IOHelper.GetRootDirectorySafe(); } } /// diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings.cs b/src/Umbraco.Core/Configuration/UmbracoSettings.cs index 9abf225166..c24810c57c 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings.cs @@ -1062,7 +1062,7 @@ namespace Umbraco.Core.Configuration get { // default: true - return _useLegacySchema ?? GetKeyValue("/settings/content/UseLegacyXmlSchema", true); + return _useLegacySchema ?? GetKeyValue("/settings/content/UseLegacyXmlSchema", false); } internal set { diff --git a/src/Umbraco.Tests/ContentStores/PublishContentStoreTests.cs b/src/Umbraco.Tests/ContentStores/PublishContentStoreTests.cs index a8a335dd5a..bbbcff3c00 100644 --- a/src/Umbraco.Tests/ContentStores/PublishContentStoreTests.cs +++ b/src/Umbraco.Tests/ContentStores/PublishContentStoreTests.cs @@ -2,6 +2,7 @@ using System.Linq; using System.Xml; using NUnit.Framework; using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Tests.TestHelpers; using Umbraco.Web; using Umbraco.Web.Routing; @@ -65,7 +66,7 @@ namespace Umbraco.Tests.ContentStores public void SetUp() { TestHelper.SetupLog4NetForTests(); - Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false; + _httpContextFactory = new FakeHttpContextFactory("~/Home"); //ensure the StateHelper is using our custom context StateHelper.HttpContext = _httpContextFactory.HttpContext; @@ -105,9 +106,7 @@ namespace Umbraco.Tests.ContentStores [TearDown] public void TearDown() { - //TODO: need to reset everything! - - Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false; + UmbracoSettings.ResetSetters(); } [Test] diff --git a/src/Umbraco.Tests/PublishedContent/StronglyTypedQueryTests.cs b/src/Umbraco.Tests/PublishedContent/StronglyTypedQueryTests.cs index 45ef120481..a69d5f917c 100644 --- a/src/Umbraco.Tests/PublishedContent/StronglyTypedQueryTests.cs +++ b/src/Umbraco.Tests/PublishedContent/StronglyTypedQueryTests.cs @@ -17,13 +17,11 @@ namespace Umbraco.Tests.PublishedContent public override void Initialize() { base.Initialize(); - UmbracoSettings.UseLegacyXmlSchema = false; } public override void TearDown() { base.TearDown(); - UmbracoSettings.ResetSetters(); } protected override bool RequiresDbSetup diff --git a/src/Umbraco.Tests/Routing/LookupByNiceUrlTests.cs b/src/Umbraco.Tests/Routing/LookupByNiceUrlTests.cs index 0cf954c09e..fb4886b4c1 100644 --- a/src/Umbraco.Tests/Routing/LookupByNiceUrlTests.cs +++ b/src/Umbraco.Tests/Routing/LookupByNiceUrlTests.cs @@ -1,5 +1,6 @@ using System.Configuration; using NUnit.Framework; +using Umbraco.Core.Configuration; using Umbraco.Tests.TestHelpers; using Umbraco.Web.Routing; using umbraco.BusinessLogic; @@ -10,6 +11,16 @@ namespace Umbraco.Tests.Routing [TestFixture] public class LookupByNiceUrlTests : BaseRoutingTest { + public override void Initialize() + { + base.Initialize(); + } + + public override void TearDown() + { + base.TearDown(); + } + /// /// We don't need a db for this test, will run faster without one /// @@ -18,7 +29,7 @@ namespace Umbraco.Tests.Routing get { return false; } } - [Ignore] + [TestCase("/", 1046)] [TestCase("/default.aspx", 1046)] //this one is actually rather important since this is the path that comes through when we are running in pre-IIS 7 for the root document '/' ! [TestCase("/Sub1", 1173)] @@ -35,7 +46,7 @@ namespace Umbraco.Tests.Routing var routingContext = GetRoutingContext(urlString); var url = routingContext.UmbracoContext.CleanedUmbracoUrl; //very important to use the cleaned up umbraco url var docreq = new PublishedContentRequest(url, routingContext); - var lookup = new LookupByNiceUrl(); + var lookup = new LookupByNiceUrl(false); SettingsForTests.HideTopLevelNodeFromPath = true; var result = lookup.TrySetDocument(docreq); @@ -51,7 +62,7 @@ namespace Umbraco.Tests.Routing } } - [Ignore] + [TestCase("/", 1046)] [TestCase("/default.aspx", 1046)] //this one is actually rather important since this is the path that comes through when we are running in pre-IIS 7 for the root document '/' ! [TestCase("/home", 1046)] @@ -63,7 +74,7 @@ namespace Umbraco.Tests.Routing var routingContext = GetRoutingContext(urlString); var url = routingContext.UmbracoContext.CleanedUmbracoUrl; //very important to use the cleaned up umbraco url var docreq = new PublishedContentRequest(url, routingContext); - var lookup = new LookupByNiceUrl(); + var lookup = new LookupByNiceUrl(false); SettingsForTests.HideTopLevelNodeFromPath = false; var result = lookup.TrySetDocument(docreq); diff --git a/src/Umbraco.Web/Routing/LookupByNiceUrl.cs b/src/Umbraco.Web/Routing/LookupByNiceUrl.cs index d802555387..ea47c45de8 100644 --- a/src/Umbraco.Web/Routing/LookupByNiceUrl.cs +++ b/src/Umbraco.Web/Routing/LookupByNiceUrl.cs @@ -16,7 +16,23 @@ namespace Umbraco.Web.Routing //[ResolutionWeight(10)] internal class LookupByNiceUrl : IPublishedContentLookup { - /// + private readonly bool _doDomainLookup; + + public LookupByNiceUrl() + { + _doDomainLookup = true; + } + + /// + /// Constructor to specify whether we also want to lookup domains stored in the repository + /// + /// + internal LookupByNiceUrl(bool doDomainLookup) + { + _doDomainLookup = doDomainLookup; + } + + /// /// Tries to find and assign an Umbraco document to a PublishedContentRequest. /// /// The PublishedContentRequest. @@ -82,7 +98,7 @@ namespace Umbraco.Web.Routing docreq.PublishedContent = node; LogHelper.Debug("Query matches, id={0}", () => docreq.DocumentId); - var iscanon = !DomainHelper.ExistsDomainInPath(docreq.Domain, node.Path); + var iscanon = _doDomainLookup && !DomainHelper.ExistsDomainInPath(docreq.Domain, node.Path); if (!iscanon) LogHelper.Debug("Non canonical url");