diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs index dd49c3ad85..083bda6982 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs @@ -132,17 +132,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings } } - [ConfigurationProperty("UseLegacyXmlSchema")] - internal InnerTextConfigurationElement UseLegacyXmlSchema - { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["UseLegacyXmlSchema"], - //set the default - false); - } - } [ConfigurationProperty("ForceSafeAliases")] internal InnerTextConfigurationElement ForceSafeAliases @@ -336,11 +325,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings get { return PropertyContextHelpOption; } } - bool IContentSection.UseLegacyXmlSchema - { - get { return UseLegacyXmlSchema; } - } - bool IContentSection.ForceSafeAliases { get { return ForceSafeAliases; } diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/IContentSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/IContentSection.cs index c3b8be413e..d28dede2e2 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/IContentSection.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/IContentSection.cs @@ -38,8 +38,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings string PropertyContextHelpOption { get; } - bool UseLegacyXmlSchema { get; } - bool ForceSafeAliases { get; } string PreviewBadge { get; } diff --git a/src/Umbraco.Core/Services/ContentTypeService.cs b/src/Umbraco.Core/Services/ContentTypeService.cs index 9c88089cd2..488cf6371d 100644 --- a/src/Umbraco.Core/Services/ContentTypeService.cs +++ b/src/Umbraco.Core/Services/ContentTypeService.cs @@ -695,35 +695,27 @@ namespace Umbraco.Core.Services public string GetContentTypesDtd() { var dtd = new StringBuilder(); - if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) + try { - dtd.AppendLine(" "); - } - else - { - try - { - var strictSchemaBuilder = new StringBuilder(); + var strictSchemaBuilder = new StringBuilder(); - var contentTypes = GetAllContentTypes(); - foreach (ContentType contentType in contentTypes) + var contentTypes = GetAllContentTypes(); + foreach (ContentType contentType in contentTypes) + { + string safeAlias = contentType.Alias.ToUmbracoAlias(); + if (safeAlias != null) { - string safeAlias = contentType.Alias.ToUmbracoAlias(); - if (safeAlias != null) - { - strictSchemaBuilder.AppendLine(String.Format("", safeAlias)); - strictSchemaBuilder.AppendLine(String.Format("", safeAlias)); - } + strictSchemaBuilder.AppendLine(String.Format("", safeAlias)); + strictSchemaBuilder.AppendLine(String.Format("", safeAlias)); } - - // Only commit the strong schema to the container if we didn't generate an error building it - dtd.Append(strictSchemaBuilder); - } - catch (Exception exception) - { - LogHelper.Error("Error while trying to build DTD for Xml schema; is Umbraco installed correctly and the connection string configured?", exception); } + // Only commit the strong schema to the container if we didn't generate an error building it + dtd.Append(strictSchemaBuilder); + } + catch (Exception exception) + { + LogHelper.Error("Error while trying to build DTD for Xml schema; is Umbraco installed correctly and the connection string configured?", exception); } return dtd.ToString(); } diff --git a/src/Umbraco.Core/Services/EntityXmlSerializer.cs b/src/Umbraco.Core/Services/EntityXmlSerializer.cs index 845277b8af..915480b0be 100644 --- a/src/Umbraco.Core/Services/EntityXmlSerializer.cs +++ b/src/Umbraco.Core/Services/EntityXmlSerializer.cs @@ -44,7 +44,7 @@ namespace Umbraco.Core.Services if (content == null) throw new ArgumentNullException("content"); if (urlSegmentProviders == null) throw new ArgumentNullException("urlSegmentProviders"); //nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias); - var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : content.ContentType.Alias.ToSafeAliasWithForcingCheck(); + var nodeName = content.ContentType.Alias.ToSafeAliasWithForcingCheck(); var xml = Serialize(dataTypeService, content, content.GetUrlSegment(urlSegmentProviders), nodeName); xml.Add(new XAttribute("nodeType", content.ContentType.Id)); @@ -88,7 +88,7 @@ namespace Umbraco.Core.Services if (media == null) throw new ArgumentNullException("media"); if (urlSegmentProviders == null) throw new ArgumentNullException("urlSegmentProviders"); //nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias); - var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : media.ContentType.Alias.ToSafeAliasWithForcingCheck(); + var nodeName = media.ContentType.Alias.ToSafeAliasWithForcingCheck(); var xml = Serialize(dataTypeService, media, media.GetUrlSegment(urlSegmentProviders), nodeName); xml.Add(new XAttribute("nodeType", media.ContentType.Id)); @@ -117,7 +117,7 @@ namespace Umbraco.Core.Services public XElement Serialize(IDataTypeService dataTypeService, IMember member) { //nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias); - var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : member.ContentType.Alias.ToSafeAliasWithForcingCheck(); + var nodeName = member.ContentType.Alias.ToSafeAliasWithForcingCheck(); var xml = Serialize(dataTypeService, member, "", nodeName); xml.Add(new XAttribute("nodeType", member.ContentType.Id)); @@ -133,16 +133,10 @@ namespace Umbraco.Core.Services public XElement Serialize(IDataTypeService dataTypeService, Property property) { var propertyType = property.PropertyType; - var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias(); + var nodeName = property.Alias.ToSafeAlias(); var xElement = new XElement(nodeName); - //Add the property alias to the legacy schema - if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) - { - var a = new XAttribute("alias", property.Alias.ToSafeAlias()); - xElement.Add(a); - } //Get the property editor for thsi property and let it convert it to the xml structure var propertyEditor = PropertyEditorResolver.Current.GetByAlias(property.PropertyType.PropertyEditorAlias); diff --git a/src/Umbraco.Core/Services/PackagingService.cs b/src/Umbraco.Core/Services/PackagingService.cs index 1e7b9558e8..1baf2a4b57 100644 --- a/src/Umbraco.Core/Services/PackagingService.cs +++ b/src/Umbraco.Core/Services/PackagingService.cs @@ -84,7 +84,7 @@ namespace Umbraco.Core.Services /// containing the xml representation of the Content object public XElement Export(IContent content, bool deep = false, bool raiseEvents = true) { - var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : content.ContentType.Alias.ToSafeAliasWithForcingCheck(); + var nodeName = content.ContentType.Alias.ToSafeAliasWithForcingCheck(); if (raiseEvents) { @@ -1279,7 +1279,7 @@ namespace Umbraco.Core.Services /// containing the xml representation of the Media object public XElement Export(IMedia media, bool deep = false, bool raiseEvents = true) { - var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : media.ContentType.Alias.ToSafeAliasWithForcingCheck(); + var nodeName = media.ContentType.Alias.ToSafeAliasWithForcingCheck(); if (raiseEvents) { diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementTests.cs index a0461dee00..af184edd2d 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementTests.cs +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementTests.cs @@ -102,11 +102,7 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings Assert.IsTrue(SettingsSection.Content.EnsureUniqueNaming == true); } - [Test] - public void UseLegacyXmlSchema() - { - Assert.IsTrue(SettingsSection.Content.UseLegacyXmlSchema == false); - } + [Test] public void ForceSafeAliases() { diff --git a/src/Umbraco.Tests/LibraryTests.cs b/src/Umbraco.Tests/LibraryTests.cs index dca6215d90..680fc43407 100644 --- a/src/Umbraco.Tests/LibraryTests.cs +++ b/src/Umbraco.Tests/LibraryTests.cs @@ -151,7 +151,7 @@ namespace Umbraco.Tests if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); var umbracoXML = cache.GetXml(UmbracoContext.Current, UmbracoContext.Current.InPreviewMode); - string xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "./data [@alias='{0}']" : "./{0}"; + string xpath = "./{0}"; if (umbracoXML.GetElementById(nodeId.ToString()) != null) if ( ",id,parentID,level,writerID,template,sortOrder,createDate,updateDate,nodeName,writerName,path," diff --git a/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs b/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs index 03e13acdd5..aceffdb8d4 100644 --- a/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs +++ b/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs @@ -80,8 +80,7 @@ namespace Umbraco.Tests.PublishedCache StateHelper.HttpContext = _httpContextFactory.HttpContext; var settings = SettingsForTests.GenerateMockSettings(); - var contentMock = Mock.Get(settings.Content); - contentMock.Setup(x => x.UseLegacyXmlSchema).Returns(false); + SettingsForTests.ConfigureSettings(settings); _xml = new XmlDocument(); _xml.LoadXml(GetXml()); @@ -99,15 +98,6 @@ namespace Umbraco.Tests.PublishedCache _cache = _umbracoContext.ContentCache; } - private void SetupForLegacy() - { - var settings = SettingsForTests.GenerateMockSettings(); - var contentMock = Mock.Get(settings.Content); - contentMock.Setup(x => x.UseLegacyXmlSchema).Returns(true); - SettingsForTests.ConfigureSettings(settings); - _xml = new XmlDocument(); - _xml.LoadXml(GetLegacyXml()); - } protected override void FreezeResolution() { @@ -115,12 +105,6 @@ namespace Umbraco.Tests.PublishedCache base.FreezeResolution(); } - [Test] - public void Has_Content_LegacySchema() - { - SetupForLegacy(); - Has_Content(); - } [Test] public void Has_Content() @@ -128,12 +112,6 @@ namespace Umbraco.Tests.PublishedCache Assert.IsTrue(_cache.HasContent()); } - [Test] - public void Get_Root_Docs_LegacySchema() - { - SetupForLegacy(); - Get_Root_Docs(); - } [Test] public void Get_Root_Docs() @@ -144,17 +122,6 @@ namespace Umbraco.Tests.PublishedCache Assert.AreEqual(1172, result.ElementAt(1).Id); } - [TestCase("/", 1046)] - [TestCase("/home", 1046)] - [TestCase("/Home", 1046)] //test different cases - [TestCase("/home/sub1", 1173)] - [TestCase("/Home/sub1", 1173)] - [TestCase("/home/Sub1", 1173)] //test different cases - public void Get_Node_By_Route_LegacySchema(string route, int nodeId) - { - SetupForLegacy(); - Get_Node_By_Route(route, nodeId); - } [TestCase("/", 1046)] [TestCase("/home", 1046)] @@ -170,14 +137,7 @@ namespace Umbraco.Tests.PublishedCache Assert.AreEqual(nodeId, result.Id); } - [TestCase("/", 1046)] - [TestCase("/sub1", 1173)] - [TestCase("/Sub1", 1173)] - public void Get_Node_By_Route_Hiding_Top_Level_Nodes_LegacySchema(string route, int nodeId) - { - SetupForLegacy(); - Get_Node_By_Route_Hiding_Top_Level_Nodes(route, nodeId); - } + [TestCase("/", 1046)] [TestCase("/sub1", 1173)] diff --git a/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs index 425da6ac2e..1363c0852f 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs @@ -414,55 +414,12 @@ namespace Umbraco.Tests.PublishedContent new[] { mSubChild1.Id, mChild1.Id, mRoot.Id })); } - [Test] - public void Convert_From_Legacy_Xml() - { - var config = SettingsForTests.GenerateMockSettings(); - - var contentMock = Mock.Get(config.Content); - contentMock.Setup(x => x.UseLegacyXmlSchema).Returns(true); - - SettingsForTests.ConfigureSettings(config); - - var nodeId = 2112; - - var xml = XElement.Parse(@" - - 115 - 268 - 10726 - jpg - - - 115 - 268 - 10726 - jpg - - "); - var node = xml.DescendantsAndSelf("node").Single(x => (int) x.Attribute("id") == nodeId); - - var publishedMedia = new PublishedMediaCache(ApplicationContext); - - var nav = node.CreateNavigator(); - - var converted = publishedMedia.ConvertFromXPathNodeIterator(nav.Select("/node"), nodeId); - - Assert.AreEqual(nodeId, converted.Id); - Assert.AreEqual(3, converted.Level); - Assert.AreEqual(1, converted.SortOrder); - Assert.AreEqual("Sam's Umbraco Image", converted.Name); - Assert.AreEqual("-1,1111,2222,2112", converted.Path); - } [Test] public void Convert_From_Standard_Xml() { var config = SettingsForTests.GenerateMockSettings(); - var contentMock = Mock.Get(config.Content); - contentMock.Setup(x => x.UseLegacyXmlSchema).Returns(true); - SettingsForTests.ConfigureSettings(config); var nodeId = 2112; diff --git a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs index d9a418d9b4..1c99da0701 100644 --- a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs +++ b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs @@ -56,7 +56,6 @@ namespace Umbraco.Tests.TestHelpers settings.Setup(x => x.WebRouting).Returns(routing.Object); //Now configure some defaults - the defaults in the config section classes do NOT pertain to the mocked data!! - settings.Setup(x => x.Content.UseLegacyXmlSchema).Returns(false); settings.Setup(x => x.Content.ForceSafeAliases).Returns(true); settings.Setup(x => x.Content.ImageAutoFillProperties).Returns(ContentImagingElement.GetDefaultImageAutoFillProperties()); settings.Setup(x => x.Content.ImageFileTypes).Returns(ContentImagingElement.GetDefaultImageFileTypes()); diff --git a/src/Umbraco.Tests/XmlHelperTests.cs b/src/Umbraco.Tests/XmlHelperTests.cs index 217e079a5f..e3fcac826d 100644 --- a/src/Umbraco.Tests/XmlHelperTests.cs +++ b/src/Umbraco.Tests/XmlHelperTests.cs @@ -147,7 +147,7 @@ namespace Umbraco.Tests XmlNode n = parentNode.CloneNode(true); // remove all children from original node - string xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "./node" : "./* [@id]"; + string xpath = "./* [@id]"; foreach (XmlNode child in parentNode.SelectNodes(xpath)) parentNode.RemoveChild(child); diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 80bd964851..1ece2c4a82 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -842,7 +842,6 @@ - diff --git a/src/Umbraco.Web.UI/umbraco/helpRedirect.aspx b/src/Umbraco.Web.UI/umbraco/helpRedirect.aspx deleted file mode 100644 index 819f906d42..0000000000 --- a/src/Umbraco.Web.UI/umbraco/helpRedirect.aspx +++ /dev/null @@ -1,12 +0,0 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="helpRedirect.aspx.cs" Inherits="umbraco.presentation.umbraco.helpRedirect" %> - - - - - - - - - Redirecting to help ... - - diff --git a/src/Umbraco.Web/Media/ImageUrlProviders/ImageUrlProvider.cs b/src/Umbraco.Web/Media/ImageUrlProviders/ImageUrlProvider.cs index 9777e39fe6..4ce9770600 100644 --- a/src/Umbraco.Web/Media/ImageUrlProviders/ImageUrlProvider.cs +++ b/src/Umbraco.Web/Media/ImageUrlProviders/ImageUrlProvider.cs @@ -78,9 +78,7 @@ namespace Umbraco.Web.Media.ImageUrlProviders private static string GetProperty(XPathNodeIterator nodeIterator, string fileProp) { - var xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema - ? string.Format(".//data[@alias = '{0}']", fileProp) - : string.Format(".//{0}", fileProp); + var xpath = string.Format(".//{0}", fileProp); var file = string.Empty; var selectSingleNode = nodeIterator.Current.SelectSingleNode(xpath); diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs index 0596f693ab..cfaf4fee7e 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs @@ -235,7 +235,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache // that switch schemas fail - so cache and refresh when needed, // ie never when running the actual site - var version = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? 0 : 1; + var version = 1; if (_xPathStringsValue == null || _xPathStringsValue.Version != version) _xPathStringsValue = new XPathStringsDefinition(version); return _xPathStringsValue; diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs index f47c280d6d..123a53b2b3 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs @@ -270,10 +270,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache if (xpath == null) throw new ArgumentNullException("xpath"); var values = new Dictionary {{"nodeName", xpath.GetAttribute("nodeName", "")}}; - if (!UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) - { - values["nodeTypeAlias"] = xpath.Name; - } + values["nodeTypeAlias"] = xpath.Name; var result = xpath.SelectChildren(XPathNodeType.Element); //add the attributes e.g. id, parentId etc diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs index 5450d4063f..428f6bdead 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs @@ -374,15 +374,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache if (_xmlNode.Attributes.GetNamedItem("writerID") != null) _writerId = int.Parse(_xmlNode.Attributes.GetNamedItem("writerID").Value); - if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) - { - if (_xmlNode.Attributes.GetNamedItem("nodeTypeAlias") != null) - _docTypeAlias = _xmlNode.Attributes.GetNamedItem("nodeTypeAlias").Value; - } - else - { - _docTypeAlias = _xmlNode.Name; - } + _docTypeAlias = _xmlNode.Name; if (_xmlNode.Attributes.GetNamedItem("nodeType") != null) _docTypeId = int.Parse(_xmlNode.Attributes.GetNamedItem("nodeType").Value); @@ -401,7 +393,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache } // load data - var dataXPath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "data" : "* [not(@isDoc)]"; + var dataXPath = "* [not(@isDoc)]"; var nodes = _xmlNode.SelectNodes(dataXPath); _contentType = PublishedContentType.Get(PublishedItemType.Content, _docTypeAlias); @@ -410,9 +402,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache if (nodes != null) foreach (XmlNode n in nodes) { - var alias = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema - ? n.Attributes.GetNamedItem("alias").Value - : n.Name; + var alias = n.Name; propertyNodes[alias.ToLowerInvariant()] = n; } @@ -433,7 +423,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache if (_xmlNode == null) return; // load children - var childXPath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : "* [@isDoc]"; + var childXPath = "* [@isDoc]"; var nav = _xmlNode.CreateNavigator(); var expr = nav.Compile(childXPath); expr.AddSort("@sortOrder", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number); diff --git a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs index dcd96df526..f4c73e4b5d 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs @@ -131,7 +131,7 @@ namespace Umbraco.Web.Routing // that switch schemas fail - so cache and refresh when needed, // ie never when running the actual site - var version = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? 0 : 1; + var version = 1; if (_xPathStringsValue == null || _xPathStringsValue.Version != version) _xPathStringsValue = new XPathStringsDefinition(version); return _xPathStringsValue; diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 26dd883ca1..b584123131 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -922,9 +922,6 @@ ASPXCodeBehind - - ASPXCodeBehind - ASPXCodeBehind diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs index d313241051..8228f3da5e 100644 --- a/src/Umbraco.Web/umbraco.presentation/content.cs +++ b/src/Umbraco.Web/umbraco.presentation/content.cs @@ -319,7 +319,7 @@ namespace umbraco { // Remove all attributes and data nodes from the published node PublishedNode.Attributes.RemoveAll(); - string xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "./data" : "./* [not(@id)]"; + string xpath = "./* [not(@id)]"; foreach (XmlNode n in PublishedNode.SelectNodes(xpath)) PublishedNode.RemoveChild(n); @@ -370,11 +370,11 @@ namespace umbraco throw new ArgumentException("Values of parentId and docNode/@parentID are different."); // find the document in the cache - XmlNode currentNode = xmlContentCopy.GetElementById(id.ToString()); + XmlNode currentNode = xmlContentCopy.GetElementById(id.ToString(CultureInfo.InvariantCulture)); // if the document is not there already then it's a new document // we must make sure that its document type exists in the schema - if (currentNode == null && UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema == false) + if (currentNode == null) { // ValidateSchema looks for the doctype in the schema and if not found // creates a new XML document with a schema containing the doctype. If @@ -396,9 +396,7 @@ namespace umbraco return xmlContentCopy; // define xpath for getting the children nodes (not properties) of a node - var childNodesXPath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema - ? "./node" - : "./* [@id]"; + var childNodesXPath = "./* [@id]"; // insert/move the node under the parent if (currentNode == null) @@ -485,9 +483,7 @@ namespace umbraco /// The parent node identifier. public void SortNodes(int parentId) { - var childNodesXPath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema - ? "./node" - : "./* [@id]"; + var childNodesXPath = "./* [@id]"; lock (XmlContentInternalSyncLock) { @@ -1173,37 +1169,13 @@ order by umbracoNode.level, umbracoNode.sortOrder"; if (hierarchy.TryGetValue(parentId, out children)) { - XmlNode childContainer = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema || - String.IsNullOrEmpty(UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME) - ? parentNode - : parentNode.SelectSingleNode( - UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME); - - if (!UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema && - !String.IsNullOrEmpty(UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME)) - { - if (childContainer == null) - { - childContainer = xmlHelper.addTextNode(parentNode.OwnerDocument, - UmbracoSettings. - TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME, ""); - parentNode.AppendChild(childContainer); - } - } + XmlNode childContainer = parentNode; foreach (int childId in children) { XmlNode childNode = nodeIndex[childId]; - if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema || - String.IsNullOrEmpty(UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME)) - { - parentNode.AppendChild(childNode); - } - else - { - childContainer.AppendChild(childNode); - } + parentNode.AppendChild(childNode); // Recursively build the content tree under the current child GenerateXmlDocument(hierarchy, nodeIndex, childId, childNode); @@ -1293,7 +1265,7 @@ order by umbracoNode.level, umbracoNode.sortOrder"; else { // Save copy of content - if (UmbracoSettings.CloneXmlCacheOnPublish) + if (UmbracoConfig.For.UmbracoSettings().Content.CloneXmlContent) { XmlDocument xmlContentCopy = CloneXmlDoc(_xmlContent); PersistXmlToFile(xmlContentCopy); diff --git a/src/Umbraco.Web/umbraco.presentation/helper.cs b/src/Umbraco.Web/umbraco.presentation/helper.cs index 96e33b5ef7..205b6a064b 100644 --- a/src/Umbraco.Web/umbraco.presentation/helper.cs +++ b/src/Umbraco.Web/umbraco.presentation/helper.cs @@ -154,7 +154,7 @@ namespace umbraco XmlNode element = umbracoXML.GetElementById(splitpath[splitpath.Length - i - 1].ToString()); if (element == null) continue; - string xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "./data [@alias = '{0}']" : "{0}"; + string xpath = "{0}"; XmlNode currentNode = element.SelectSingleNode(string.Format(xpath, keyName)); if (currentNode != null && currentNode.FirstChild != null && diff --git a/src/Umbraco.Web/umbraco.presentation/item.cs b/src/Umbraco.Web/umbraco.presentation/item.cs index 92fb4c9a2a..74a793ea7d 100644 --- a/src/Umbraco.Web/umbraco.presentation/item.cs +++ b/src/Umbraco.Web/umbraco.presentation/item.cs @@ -142,7 +142,7 @@ namespace umbraco if (element == null) continue; - var xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "./data [@alias = '{0}']" : "./{0}"; + var xpath = "./{0}"; var currentNode = element.SelectSingleNode(string.Format(xpath, _fieldName)); //continue if all is null diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs index 4784f0bb9d..0cdb7d84c0 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs @@ -2,6 +2,7 @@ using System.Text; using Umbraco.Core; using umbraco.businesslogic; +using Umbraco.Core.Configuration; using umbraco.interfaces; using umbraco.cms.presentation.Trees; using umbraco.BusinessLogic.Actions; @@ -45,7 +46,7 @@ namespace umbraco protected override string FileSearchPattern { - get { return UmbracoSettings.ScriptFileTypes; } + get { return string.Join(",", UmbracoConfig.For.UmbracoSettings().Content.ScriptFileTypes); } } protected override void OnRenderFolderNode(ref XmlTreeNode xNode) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/xslt.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/xslt.ascx.cs index 16db1a160f..283ff440b0 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/xslt.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/xslt.ascx.cs @@ -40,14 +40,7 @@ namespace umbraco.presentation.create private static string GetXsltTemplatePath() { - if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) - { - return "/xslt/templates"; - } - else - { - return "/xslt/templates/schema2"; - } + return "/xslt/templates/schema2"; } protected void sbmt_Click(object sender, System.EventArgs e) @@ -58,8 +51,8 @@ namespace umbraco.presentation.create if (createMacro.Checked) createMacroVal = 1; - var xsltName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? xsltTemplate.SelectedValue : - Path.Combine("schema2", xsltTemplate.SelectedValue); + var xsltName = Path.Combine("schema2", xsltTemplate.SelectedValue); + var returnUrl = LegacyDialogHandler.Create( new HttpContextWrapper(Context), diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs index 696aa8534a..f7b3a1bda9 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs @@ -49,14 +49,14 @@ namespace umbraco.presentation.developer.packages { iframeGen.Text = string.Format( - "", + "", url, repoGuid, category, Request.ServerVariables["SERVER_NAME"], Request.ServerVariables["SERVER_PORT"], IOHelper.ResolveUrl(SystemDirectories.Umbraco), IOHelper.ResolveUrl(SystemDirectories.Umbraco).Trim('/'), repoGuid, UmbracoVersion.Current.Major, UmbracoVersion.Current.Minor, UmbracoVersion.Current.Build, - UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema.ToString(), Environment.Version, + Environment.Version, Umbraco.Core.SystemUtilities.GetCurrentTrustLevel()); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/LoadNitros.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/LoadNitros.ascx.cs index 78bde7b98c..c9d52f8579 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/LoadNitros.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/LoadNitros.ascx.cs @@ -177,10 +177,7 @@ namespace umbraco.presentation.developer.packages { try { - if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) - rep_nitros.DataSource = repo.Webservice.NitrosCategorizedByVersion(cms.businesslogic.packager.repositories.Version.Version4); - else - rep_nitros.DataSource = repo.Webservice.NitrosCategorizedByVersion(cms.businesslogic.packager.repositories.Version.Version41); + rep_nitros.DataSource = repo.Webservice.NitrosCategorizedByVersion(cms.businesslogic.packager.repositories.Version.Version41); rep_nitros.DataBind(); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltInsertValueOf.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltInsertValueOf.aspx.cs index a7f4c158d8..d505b8a279 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltInsertValueOf.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltInsertValueOf.aspx.cs @@ -37,10 +37,8 @@ namespace umbraco.developer { if (!existingGenProps.Contains("," + pt.Alias + ",")) { - if(UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) - preValuesSource.Add(string.Format("data [@alias = '{0}']", pt.Alias)); - else - preValuesSource.Add(pt.Alias); + preValuesSource.Add(pt.Alias); + existingGenProps += pt.Alias + ","; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/helpRedirect.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/helpRedirect.aspx.cs deleted file mode 100644 index b09ef1565f..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/helpRedirect.aspx.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; - -namespace umbraco.presentation.umbraco -{ - - - public partial class helpRedirect : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) - { - Help help = new Help(UmbracoSettings.HelpPages); - - HelpPage requestedHelpPage = new HelpPage - { - Application = Request.QueryString["Application"], - ApplicationUrl = Request.QueryString["ApplicationUrl"], - Language = Request.QueryString["Language"], - UserType = Request.QueryString["UserType"] - }; - - Response.Redirect(help.ResolveHelpUrl(requestedHelpPage)); - } - } -} \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs index f2adaac615..d3d3a9dfff 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs @@ -187,7 +187,7 @@ namespace umbraco.presentation.translation foreach (XmlNode taskXml in tasks) { - string xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : "* [@isDoc]"; + string xpath = "* [@isDoc]"; XmlNode taskNode = taskXml.SelectSingleNode(xpath); // validate file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs index 97b351c16c..9adbf6c178 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs @@ -69,8 +69,7 @@ namespace umbraco.presentation.translation while (ide.MoveNext()) { var x = (XmlElement)ide.Value; - var parentXpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "//node [@id = '" + x.SelectSingleNode("//node").Attributes.GetNamedItem("parentID").Value + "']" : - "//* [@isDoc and @id = '" + x.SelectSingleNode("//* [@isDoc]").Attributes.GetNamedItem("parentID").Value + "']"; + var parentXpath = "//* [@isDoc and @id = '" + x.SelectSingleNode("//* [@isDoc]").Attributes.GetNamedItem("parentID").Value + "']"; var parent = _xd.SelectSingleNode(parentXpath); if (parent == null) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs index 7d179b54c5..4982d6af5b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs @@ -9,6 +9,7 @@ using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Xml; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Web; using Umbraco.Web.Security; @@ -146,7 +147,7 @@ namespace umbraco.cms.presentation.user contentPicker.TreeAlias = "content"; if (u.StartNodeId > 0) - contentPicker.Value = u.StartNodeId.ToString(); + contentPicker.Value = u.StartNodeId.ToString(CultureInfo.InvariantCulture); else contentPicker.Value = "-1"; @@ -155,7 +156,7 @@ namespace umbraco.cms.presentation.user // Add password changer var passwordChanger = (passwordChanger) LoadControl(SystemDirectories.Umbraco + "/controls/passwordChanger.ascx"); - passwordChanger.MembershipProviderName = UmbracoSettings.DefaultBackofficeProvider; + passwordChanger.MembershipProviderName = UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider; //Add a custom validation message for the password changer var passwordValidation = new CustomValidator diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs index 6ea35970f1..665d522efb 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs @@ -84,7 +84,7 @@ namespace umbraco.presentation.webservices try { // Check if there's any documents yet - string xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "/root/node" : "/root/*"; + string xpath = "/root/*"; if (content.Instance.XmlContent.SelectNodes(xpath).Count > 0) { var macroXML = new XmlDocument(); diff --git a/src/umbraco.businesslogic/UmbracoSettings.cs b/src/umbraco.businesslogic/UmbracoSettings.cs deleted file mode 100644 index 968c56801d..0000000000 --- a/src/umbraco.businesslogic/UmbracoSettings.cs +++ /dev/null @@ -1,657 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using System.Web; -using System.Web.Caching; -using System.Xml; -using Umbraco.Core; -using System.Collections.Generic; -using Umbraco.Core.Configuration; -using Umbraco.Core.Logging; - -namespace umbraco -{ - /// - /// The UmbracoSettings Class contains general settings information for the entire Umbraco instance based on information from the /config/umbracoSettings.config file - /// - [Obsolete("Use UmbracoConfig.For.UmbracoSettings() instead, it offers all settings in strongly typed formats. This class will be removed in future versions.")] - public class UmbracoSettings - { - [Obsolete("This hasn't been used since 4.1!")] - public const string TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME = ""; // "children"; - - /// - /// Gets the umbraco settings document. - /// - /// The _umbraco settings. - public static XmlDocument _umbracoSettings - { - get - { - var us = (XmlDocument)HttpRuntime.Cache["umbracoSettingsFile"] ?? EnsureSettingsDocument(); - return us; - } - } - - /// - /// Gets a value indicating whether the media library will create new directories in the /media directory. - /// - /// - /// true if new directories are allowed otherwise, false. - /// - public static bool UploadAllowDirectories - { - get { return UmbracoConfig.For.UmbracoSettings().Content.UploadAllowDirectories; } - } - - /// - /// Gets a value indicating whether logging is enabled in umbracoSettings.config (/settings/logging/enableLogging). - /// - /// true if logging is enabled; otherwise, false. - public static bool EnableLogging - { - get { return UmbracoConfig.For.UmbracoSettings().Logging.EnableLogging; } - } - - /// - /// Gets a value indicating whether logging happens async. - /// - /// true if async logging is enabled; otherwise, false. - public static bool EnableAsyncLogging - { - get { return UmbracoConfig.For.UmbracoSettings().Logging.EnableAsyncLogging; } - } - - /// - /// Gets the assembly of an external logger that can be used to store log items in 3rd party systems - /// - public static string ExternalLoggerAssembly - { - get { return UmbracoConfig.For.UmbracoSettings().Logging.ExternalLoggerAssembly; } - } - /// - /// Gets the type of an external logger that can be used to store log items in 3rd party systems - /// - public static string ExternalLoggerType - { - get { return UmbracoConfig.For.UmbracoSettings().Logging.ExternalLoggerType; } - } - - /// - /// Long Audit Trail to external log too - /// - public static bool ExternalLoggerLogAuditTrail - { - get { return UmbracoConfig.For.UmbracoSettings().Logging.ExternalLoggerEnableAuditTrail; } - } - - /// - /// Keep user alive as long as they have their browser open? Default is true - /// - public static bool KeepUserLoggedIn - { - get { return UmbracoConfig.For.UmbracoSettings().Security.KeepUserLoggedIn; } - } - - /// - /// Show disabled users in the tree in the Users section in the backoffice - /// - public static bool HideDisabledUsersInBackoffice - { - get { return UmbracoConfig.For.UmbracoSettings().Security.HideDisabledUsersInBackoffice; } - } - - /// - /// Gets a value indicating whether the logs will be auto cleaned - /// - /// true if logs are to be automatically cleaned; otherwise, false - public static bool AutoCleanLogs - { - get { return UmbracoConfig.For.UmbracoSettings().Logging.AutoCleanLogs; } - } - - /// - /// Gets the value indicating the log cleaning frequency (in miliseconds) - /// - public static int CleaningMiliseconds - { - get { return UmbracoConfig.For.UmbracoSettings().Logging.CleaningMiliseconds; } - } - - public static int MaxLogAge - { - get { return UmbracoConfig.For.UmbracoSettings().Logging.MaxLogAge; } - } - - /// - /// Gets the disabled log types. - /// - /// The disabled log types. - public static XmlNode DisabledLogTypes - { - get { return GetKeyAsNode("/settings/logging/disabledLogTypes"); } - } - - /// - /// Gets the package server url. - /// - /// The package server url. - public static string PackageServer - { - get { return "packages.umbraco.org"; } - } - - /// - /// Gets a value indicating whether umbraco will use domain prefixes. - /// - /// true if umbraco will use domain prefixes; otherwise, false. - public static bool UseDomainPrefixes - { - get { return UmbracoConfig.For.UmbracoSettings().RequestHandler.UseDomainPrefixes; } - } - - /// - /// This will add a trailing slash (/) to urls when in directory url mode - /// NOTICE: This will always return false if Directory Urls in not active - /// - public static bool AddTrailingSlash - { - get { return UmbracoConfig.For.UmbracoSettings().RequestHandler.AddTrailingSlash; } - } - - /// - /// Gets a value indicating whether umbraco will use ASP.NET MasterPages for rendering instead of its propriatary templating system. - /// - /// true if umbraco will use ASP.NET MasterPages; otherwise, false. - public static bool UseAspNetMasterPages - { - get { return UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages; } - } - - - /// - /// Gets a value indicating whether umbraco will attempt to load any skins to override default template files - /// - /// true if umbraco will override templates with skins if present and configured false. - public static bool EnableTemplateFolders - { - get { return UmbracoConfig.For.UmbracoSettings().Templates.EnableTemplateFolders; } - } - - - - /// - /// Gets a value indicating whether umbraco will clone XML cache on publish. - /// - /// - /// true if umbraco will clone XML cache on publish; otherwise, false. - /// - public static bool CloneXmlCacheOnPublish - { - get { return UmbracoConfig.For.UmbracoSettings().Content.CloneXmlContent; } - } - - /// - /// Gets the property context help option, this can either be 'text', 'icon' or 'none' - /// - /// The property context help option. - public static string PropertyContextHelpOption - { - get { return UmbracoConfig.For.UmbracoSettings().Content.PropertyContextHelpOption; } - } - - public static string DefaultBackofficeProvider - { - get { return UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider; } - } - - /// - /// Whether to force safe aliases (no spaces, no special characters) at businesslogic level on contenttypes and propertytypes - /// - public static bool ForceSafeAliases - { - get { return UmbracoConfig.For.UmbracoSettings().Content.ForceSafeAliases; } - } - - /// - /// File types that will not be allowed to be uploaded via the content/media upload control - /// - public static IEnumerable DisallowedUploadFiles - { - get { return UmbracoConfig.For.UmbracoSettings().Content.DisallowedUploadFiles; } - } - - /// - /// Gets the allowed image file types. - /// - /// The allowed image file types. - public static string ImageFileTypes - { - get { return string.Join(",", UmbracoConfig.For.UmbracoSettings().Content.ImageFileTypes.Select(x => x.ToLowerInvariant())); } - } - - /// - /// Gets the allowed script file types. - /// - /// The allowed script file types. - public static string ScriptFileTypes - { - get { return string.Join(",", UmbracoConfig.For.UmbracoSettings().Content.ScriptFileTypes); } - } - - /// - /// Gets the duration in seconds to cache queries to umbraco library member and media methods - /// Default is 1800 seconds (30 minutes) - /// - public static int UmbracoLibraryCacheDuration - { - get { return UmbracoConfig.For.UmbracoSettings().Content.UmbracoLibraryCacheDuration; } - } - - /// - /// Gets the path to the scripts folder used by the script editor. - /// - /// The script folder path. - public static string ScriptFolderPath - { - get { return UmbracoConfig.For.UmbracoSettings().Content.ScriptFolderPath; } - } - - /// - /// Enabled or disable the script/code editor - /// - public static bool ScriptDisableEditor - { - get { return UmbracoConfig.For.UmbracoSettings().Content.ScriptEditorDisable; } - } - - /// - /// Gets a value indicating whether umbraco will ensure unique node naming. - /// This will ensure that nodes cannot have the same url, but will add extra characters to a url. - /// ex: existingnodename.aspx would become existingnodename(1).aspx if a node with the same name is found - /// - /// true if umbraco ensures unique node naming; otherwise, false. - public static bool EnsureUniqueNaming - { - get { return UmbracoConfig.For.UmbracoSettings().Content.EnsureUniqueNaming; } - } - - /// - /// Gets the notification email sender. - /// - /// The notification email sender. - public static string NotificationEmailSender - { - get { return UmbracoConfig.For.UmbracoSettings().Content.NotificationEmailAddress; } - } - - /// - /// Gets a value indicating whether notification-emails are HTML. - /// - /// - /// true if html notification-emails are disabled; otherwise, false. - /// - public static bool NotificationDisableHtmlEmail - { - get { return UmbracoConfig.For.UmbracoSettings().Content.DisableHtmlEmail; } - } - - /// - /// Gets the allowed attributes on images. - /// - /// The allowed attributes on images. - public static string ImageAllowedAttributes - { - get { return string.Join(",", UmbracoConfig.For.UmbracoSettings().Content.ImageTagAllowedAttributes); } - } - - public static XmlNode ImageAutoFillImageProperties - { - get { return GetKeyAsNode("/settings/content/imaging/autoFillImageProperties"); } - } - - /// - /// Gets the scheduled tasks as XML - /// - /// The scheduled tasks. - public static XmlNode ScheduledTasks - { - get { return GetKeyAsNode("/settings/scheduledTasks"); } - } - - /// - /// Gets a list of characters that will be replaced when generating urls - /// - /// The URL replacement characters. - public static XmlNode UrlReplaceCharacters - { - get { return GetKeyAsNode("/settings/requestHandler/urlReplacing"); } - } - - /// - /// Whether to replace double dashes from url (ie my--story----from--dash.aspx caused by multiple url replacement chars - /// - public static bool RemoveDoubleDashesFromUrlReplacing - { - get { return UmbracoConfig.For.UmbracoSettings().RequestHandler.RemoveDoubleDashes; } - } - - /// - /// Gets a value indicating whether umbraco will use distributed calls. - /// This enables umbraco to share cache and content across multiple servers. - /// Used for load-balancing high-traffic sites. - /// - /// true if umbraco uses distributed calls; otherwise, false. - public static bool UseDistributedCalls - { - get { return UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled; } - } - - - /// - /// Gets the ID of the user with access rights to perform the distributed calls. - /// - /// The distributed call user. - public static int DistributedCallUser - { - get { return UmbracoConfig.For.UmbracoSettings().DistributedCall.UserId; } - } - - /// - /// Gets the html injected into a (x)html page if Umbraco is running in preview mode - /// - public static string PreviewBadge - { - get { return UmbracoConfig.For.UmbracoSettings().Content.PreviewBadge; } - } - - /// - /// Gets IP or hostnames of the distribution servers. - /// These servers will receive a call everytime content is created/deleted/removed - /// and update their content cache accordingly, ensuring a consistent cache on all servers - /// - /// The distribution servers. - public static XmlNode DistributionServers - { - get - { - try - { - return GetKeyAsNode("/settings/distributedCall/servers"); - } - catch - { - return null; - } - } - } - - /// - /// Gets HelpPage configurations. - /// A help page configuration specify language, user type, application, application url and - /// the target help page url. - /// - public static XmlNode HelpPages - { - get - { - try - { - return GetKeyAsNode("/settings/help"); - } - catch - { - return null; - } - } - } - - /// - /// Gets all repositories registered, and returns them as XmlNodes, containing name, alias and webservice url. - /// These repositories are used by the build-in package installer and uninstaller to install new packages and check for updates. - /// All repositories should have a unique alias. - /// All packages installed from a repository gets the repository alias included in the install information - /// - /// The repository servers. - public static XmlNode Repositories - { - get - { - try - { - return GetKeyAsNode("/settings/repositories"); - } - catch - { - return null; - } - } - } - - - - /// - /// Tells us whether the Xml Content cache is disabled or not - /// Default is enabled - /// - public static bool isXmlContentCacheDisabled - { - get { return UmbracoConfig.For.UmbracoSettings().Content.XmlCacheEnabled == false; } - } - - /// - /// Check if there's changes to the umbraco.config xml file cache on disk on each request - /// Makes it possible to updates environments by syncing the umbraco.config file across instances - /// Relates to http://umbraco.codeplex.com/workitem/30722 - /// - public static bool XmlContentCheckForDiskChanges - { - get { return UmbracoConfig.For.UmbracoSettings().Content.XmlContentCheckForDiskChanges; } - } - - /// - /// If this is enabled, all Umbraco objects will generate data in the preview table (cmsPreviewXml). - /// If disabled, only documents will generate data. - /// This feature is useful if anyone would like to see how data looked at a given time - /// - public static bool EnableGlobalPreviewStorage - { - get { return UmbracoConfig.For.UmbracoSettings().Content.GlobalPreviewStorageEnabled; } - } - - /// - /// Whether to use the new 4.1 schema or the old legacy schema - /// - /// - /// true if yes, use the old node/data model; otherwise, false. - /// - public static bool UseLegacyXmlSchema - { - get { return UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema; } - } - - public static IEnumerable AppCodeFileExtensionsList - { - get { return UmbracoConfig.For.UmbracoSettings().Developer.AppCodeFileExtensions.Select(x => x.Extension); } - } - - [Obsolete("Use AppCodeFileExtensionsList instead")] - public static XmlNode AppCodeFileExtensions - { - get - { - XmlNode value = GetKeyAsNode("/settings/developer/appCodeFileExtensions"); - if (value != null) - { - return value; - } - - // default is .cs and .vb - value = _umbracoSettings.CreateElement("appCodeFileExtensions"); - value.AppendChild(XmlHelper.AddTextNode(_umbracoSettings, "ext", "cs")); - value.AppendChild(XmlHelper.AddTextNode(_umbracoSettings, "ext", "vb")); - return value; - } - } - - /// - /// Tells us whether the Xml to always update disk cache, when changes are made to content - /// Default is enabled - /// - public static bool continouslyUpdateXmlDiskCache - { - get { return UmbracoConfig.For.UmbracoSettings().Content.ContinouslyUpdateXmlDiskCache; } - } - - /// - /// Tells us whether to use a splash page while umbraco is initializing content. - /// If not, requests are queued while umbraco loads content. For very large sites (+10k nodes) it might be usefull to - /// have a splash page - /// Default is disabled - /// - public static bool EnableSplashWhileLoading - { - get { return UmbracoConfig.For.UmbracoSettings().Content.EnableSplashWhileLoading; } - } - - public static bool ResolveUrlsFromTextString - { - get { return UmbracoConfig.For.UmbracoSettings().Content.ResolveUrlsFromTextString; } - } - - /// - /// This configuration setting defines how to handle macro errors: - /// - Inline - Show error within macro as text (default and current Umbraco 'normal' behavior) - /// - Silent - Suppress error and hide macro - /// - Throw - Throw an exception and invoke the global error handler (if one is defined, if not you'll get a YSOD) - /// - /// MacroErrorBehaviour enum defining how to handle macro errors. - public static MacroErrorBehaviour MacroErrorBehaviour - { - get { return UmbracoConfig.For.UmbracoSettings().Content.MacroErrorBehaviour; } - } - - /// - /// This configuration setting defines how to show icons in the document type editor. - /// - ShowDuplicates - Show duplicates in files and sprites. (default and current Umbraco 'normal' behaviour) - /// - HideSpriteDuplicates - Show files on disk and hide duplicates from the sprite - /// - HideFileDuplicates - Show files in the sprite and hide duplicates on disk - /// - /// MacroErrorBehaviour enum defining how to show icons in the document type editor. - [Obsolete("This is no longer used and will be removed from the core in future versions")] - public static IconPickerBehaviour IconPickerBehaviour - { - get { return IconPickerBehaviour.ShowDuplicates; } - } - - /// - /// Gets the default document type property used when adding new properties through the back-office - /// - /// Configured text for the default document type property - /// If undefined, 'Textstring' is the default - public static string DefaultDocumentTypeProperty - { - get { return UmbracoConfig.For.UmbracoSettings().Content.DefaultDocumentTypeProperty; } - } - - private static string _path; - - /// - /// Gets the settings file path - /// - internal static string SettingsFilePath - { - get { return _path ?? (_path = GlobalSettings.FullpathToRoot + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar); } - } - - internal const string Filename = "umbracoSettings.config"; - - internal static XmlDocument EnsureSettingsDocument() - { - var settingsFile = HttpRuntime.Cache["umbracoSettingsFile"]; - - // Check for language file in cache - if (settingsFile == null) - { - var temp = new XmlDocument(); - var settingsReader = new XmlTextReader(SettingsFilePath + Filename); - try - { - temp.Load(settingsReader); - HttpRuntime.Cache.Insert("umbracoSettingsFile", temp, - new CacheDependency(SettingsFilePath + Filename)); - } - catch (XmlException e) - { - throw new XmlException("Your umbracoSettings.config file fails to pass as valid XML. Refer to the InnerException for more information", e); - } - catch (Exception e) - { - LogHelper.Error("Error reading umbracoSettings file: " + e.ToString(), e); - } - settingsReader.Close(); - return temp; - } - else - return (XmlDocument)settingsFile; - } - - internal static void Save() - { - _umbracoSettings.Save(SettingsFilePath + Filename); - } - - - /// - /// Selects a xml node in the umbraco settings config file. - /// - /// The xpath query to the specific node. - /// If found, it returns the specific configuration xml node. - internal static XmlNode GetKeyAsNode(string key) - { - if (key == null) - throw new ArgumentException("Key cannot be null"); - EnsureSettingsDocument(); - if (_umbracoSettings == null || _umbracoSettings.DocumentElement == null) - return null; - return _umbracoSettings.DocumentElement.SelectSingleNode(key); - } - - /// - /// Gets the value of configuration xml node with the specified key. - /// - /// The key. - /// - internal static string GetKey(string key) - { - EnsureSettingsDocument(); - - string attrName = null; - var pos = key.IndexOf('@'); - if (pos > 0) - { - attrName = key.Substring(pos + 1); - key = key.Substring(0, pos - 1); - } - - var node = _umbracoSettings.DocumentElement.SelectSingleNode(key); - if (node == null) - return string.Empty; - - if (pos < 0) - { - if (node.FirstChild == null || node.FirstChild.Value == null) - return string.Empty; - return node.FirstChild.Value; - } - else - { - var attr = node.Attributes[attrName]; - if (attr == null) - return string.Empty; - return attr.Value; - } - } - - } -} \ No newline at end of file diff --git a/src/umbraco.businesslogic/umbraco.businesslogic.csproj b/src/umbraco.businesslogic/umbraco.businesslogic.csproj index 37bb106271..043385fe7d 100644 --- a/src/umbraco.businesslogic/umbraco.businesslogic.csproj +++ b/src/umbraco.businesslogic/umbraco.businesslogic.csproj @@ -217,9 +217,6 @@ Code - - Code - Code diff --git a/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs b/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs index 3ffa0e9054..6c3b672f14 100644 --- a/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs +++ b/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs @@ -207,10 +207,7 @@ namespace umbraco.cms.businesslogic.packager.repositories if (key == string.Empty) { - if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) - fileByteArray = this.Webservice.fetchPackage(packageGuid); - else - fileByteArray = this.Webservice.fetchPackageByVersion(packageGuid, Version.Version41); + fileByteArray = this.Webservice.fetchPackageByVersion(packageGuid, Version.Version41); } else { diff --git a/src/umbraco.cms/businesslogic/web/DocumentType.cs b/src/umbraco.cms/businesslogic/web/DocumentType.cs index 62c674122b..51e757f138 100644 --- a/src/umbraco.cms/businesslogic/web/DocumentType.cs +++ b/src/umbraco.cms/businesslogic/web/DocumentType.cs @@ -91,38 +91,30 @@ namespace umbraco.cms.businesslogic.web public static string GenerateXmlDocumentType() { StringBuilder dtd = new StringBuilder(); - if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) + // TEMPORARY: Added Try-Catch to this call since trying to generate a DTD against a corrupt db + // or a broken connection string is not handled yet + // (Alex N 20100212) + try { - dtd.AppendLine(" "); - } - else - { - // TEMPORARY: Added Try-Catch to this call since trying to generate a DTD against a corrupt db - // or a broken connection string is not handled yet - // (Alex N 20100212) - try - { - StringBuilder strictSchemaBuilder = new StringBuilder(); + StringBuilder strictSchemaBuilder = new StringBuilder(); - List dts = GetAllAsList(); - foreach (DocumentType dt in dts) + List dts = GetAllAsList(); + foreach (DocumentType dt in dts) + { + string safeAlias = helpers.Casing.SafeAlias(dt.Alias); + if (safeAlias != null) { - string safeAlias = helpers.Casing.SafeAlias(dt.Alias); - if (safeAlias != null) - { - strictSchemaBuilder.AppendLine(String.Format("", safeAlias)); - strictSchemaBuilder.AppendLine(String.Format("", safeAlias)); - } + strictSchemaBuilder.AppendLine(String.Format("", safeAlias)); + strictSchemaBuilder.AppendLine(String.Format("", safeAlias)); } - - // Only commit the strong schema to the container if we didn't generate an error building it - dtd.Append(strictSchemaBuilder); - } - catch (Exception exception) - { - LogHelper.Error("Exception while trying to build DTD for Xml schema; is Umbraco installed correctly and the connection string configured?", exception); } + // Only commit the strong schema to the container if we didn't generate an error building it + dtd.Append(strictSchemaBuilder); + } + catch (Exception exception) + { + LogHelper.Error("Exception while trying to build DTD for Xml schema; is Umbraco installed correctly and the connection string configured?", exception); } return dtd.ToString(); diff --git a/src/umbraco.cms/businesslogic/workflow/Notification.cs b/src/umbraco.cms/businesslogic/workflow/Notification.cs index f738a98806..098dfe49a7 100644 --- a/src/umbraco.cms/businesslogic/workflow/Notification.cs +++ b/src/umbraco.cms/businesslogic/workflow/Notification.cs @@ -4,6 +4,7 @@ using System.Globalization; using System.Runtime.CompilerServices; using System.Web; using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using umbraco.BusinessLogic; using umbraco.cms.businesslogic.web; @@ -79,7 +80,7 @@ namespace umbraco.cms.businesslogic.workflow pUser, documentObject.Content, action.Letter.ToString(CultureInfo.InvariantCulture), ui.Text(action.Alias), new HttpContextWrapper(HttpContext.Current), (user, strings) => ui.Text("notifications", "mailSubject", strings, mailingUser), - (user, strings) => UmbracoSettings.NotificationDisableHtmlEmail + (user, strings) => UmbracoConfig.For.UmbracoSettings().Content.DisableHtmlEmail ? ui.Text("notifications", "mailBody", strings, mailingUser) : ui.Text("notifications", "mailBodyHtml", strings, mailingUser)); }