diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings.cs b/src/Umbraco.Core/Configuration/UmbracoSettings.cs
index c841eb0674..34191ce52d 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings.cs
@@ -1250,42 +1250,7 @@ namespace Umbraco.Core.Configuration
return _macroErrorBehaviour.Value;
}
}
-
- private static IconPickerBehaviour? _iconPickerBehaviour;
-
- ///
- /// 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.
- public static IconPickerBehaviour IconPickerBehaviour
- {
- get
- {
- if (_iconPickerBehaviour == null)
- {
- try
- {
- var behaviour = IconPickerBehaviour.ShowDuplicates;
- var value = GetKey("/settings/content/DocumentTypeIconList");
- if (value != null)
- {
- Enum.TryParse(value, true, out behaviour);
- }
- _iconPickerBehaviour = behaviour;
- }
- catch (Exception ex)
- {
- LogHelper.Error("Could not load /settings/content/DocumentTypeIconList from umbracosettings.config", ex);
- _iconPickerBehaviour = IconPickerBehaviour.ShowDuplicates;
- }
- }
- return _iconPickerBehaviour.Value;
- }
- }
-
+
private static IconPickerBehaviour? _iconPickerBehaviour;
///
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index f8f362f6c1..e48aa79ab6 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -112,7 +112,6 @@
-
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs
index b0c270fd87..3cef15a8b4 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs
@@ -387,47 +387,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
private static string FileNameToIconFileName(FileInfo file)
{
return file.Name.Substring(0, file.Name.LastIndexOf(".", StringComparison.Ordinal)).ToLowerInvariant();
- }
-
- private void AddSpriteListItem(string iconClass, ICollection listOfIcons)
- {
- var li = new ListItem(
- helper.SpaceCamelCasing((iconClass.Substring(1, iconClass.Length - 1)))
- .Replace("Spr Tree", "")
- .Trim(), iconClass);
-
- li.Attributes.Add("class", "spriteBackground sprTree " + iconClass.Trim('.'));
- li.Attributes.Add("style", "padding-left:24px !important; background-repeat:no-repeat; width:auto; height:auto;");
-
- AddListItem(listOfIcons, li);
- }
-
- private void AddFileListItem(string fileName, string listItemValue, ICollection listOfIcons)
- {
- var li = new ListItem(fileName, fileName);
-
- li.Attributes.Add("title", listItemValue);
-
- AddListItem(listOfIcons, li);
- }
-
- private void AddListItem(ICollection listOfIcons, ListItem li)
- {
- if (this.Page.IsPostBack == false && li.Value == _contentType.IconUrl)
- li.Selected = true;
-
- listOfIcons.Add(li);
- }
-
- private static string IconClassToIconFileName(string iconClass)
- {
- return iconClass.Substring(1, iconClass.Length - 1).ToLowerInvariant().Replace("sprTree".ToLowerInvariant(), "");
- }
-
- private static string FileNameToIconFileName(FileInfo file)
- {
- return file.Name.Substring(0, file.Name.LastIndexOf(".", StringComparison.Ordinal)).ToLowerInvariant();
- }
+ }
#endregion
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs
index 4bbc0e7279..4bca0869a9 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs
@@ -100,13 +100,7 @@ namespace umbraco.presentation.templateControls
{
//moved the following from the catch block up as this will allow fallback options alt text etc to work
var itemPage = new page(Umbraco.Web.UmbracoContext.Current.GetXml().GetElementById(tempNodeId.ToString()));
- //get the publishedcontent item
- var publishedContent = PublishedContentStoreResolver.Current.PublishedContentStore.GetDocumentById(
- Umbraco.Web.UmbracoContext.Current,
- tempNodeId.Value);
-
- var itemPage = new page(publishedContent);
- tempElementContent = new item(publishedContent, itemPage.Elements, item.LegacyAttributes).FieldContent;
+ tempElementContent = new item(itemPage.Elements, item.LegacyAttributes).FieldContent;
}
}
else
diff --git a/src/umbraco.cms/businesslogic/ContentType.cs b/src/umbraco.cms/businesslogic/ContentType.cs
index cedd7fd40c..6e2f972d43 100644
--- a/src/umbraco.cms/businesslogic/ContentType.cs
+++ b/src/umbraco.cms/businesslogic/ContentType.cs
@@ -8,6 +8,8 @@ using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence.Caching;
+using umbraco.cms.businesslogic.cache;
+using umbraco.cms.businesslogic.propertytype;
using umbraco.cms.businesslogic.web;
using umbraco.DataLayer;
using DataTypeDefinition = umbraco.cms.businesslogic.datatype.DataTypeDefinition;
@@ -144,38 +146,23 @@ namespace umbraco.cms.businesslogic
{
var key = new System.Tuple(contentTypeAlias, propertyTypeAlias);
- //NOTE: We only have a try/catch here for legacy reasons, I don't see any reason to have it
- // but it was here before so we'll need to keep it for this legacy version.
- // If an error occurs, we return an empty GUID but do not cache this.
- try
- {
- return PropertyTypeCache.GetOrAdd(
- key,
- tuple =>
+
+ return PropertyTypeCache.GetOrAdd(
+ key,
+ tuple =>
+ {
+ // With 4.10 we can't do this via direct SQL as we have content type mixins
+ var controlId = Guid.Empty;
+ var ct = GetByAlias(contentTypeAlias);
+ PropertyType pt = ct.getPropertyType(propertyTypeAlias);
+ if (pt != null)
{
- // With 4.10 we can't do this via direct SQL as we have content type mixins
- var controlId = Guid.Empty;
- ContentType ct = GetByAlias(contentTypeAlias);
- PropertyType pt = ct.getPropertyType(propertyTypeAlias);
- if (pt != null)
- SqlHelper.CreateParameter("@propertyAlias", propertyTypeAlias)
- ))
- {
- }
- {
- controlId = pt.DataTypeDefinition.DataType.Id;
- }
- return controlId;
- });
- catch (Exception ex)
- //add to cache (even if empty!)
- {
- LogHelper.Error("An error occurred in GetDataType", ex);
- return Guid.Empty;
- }
+ controlId = pt.DataTypeDefinition.DataType.Id;
+ }
+ return controlId;
+ });
}
-
///
/// Gets the type of the content.
///
@@ -510,39 +497,41 @@ namespace umbraco.cms.businesslogic
cacheKey,
TimeSpan.FromMinutes(15),
() =>
- {
- //MCH NOTE: For the timing being I have changed this to a dictionary to ensure that property types
- //aren't added multiple times through the MasterContentType structure, because each level loads
- //its own + inherited property types, which is wrong. Once we are able to fully switch to the new api
- //this should no longer be a problem as the composition always contains a correct list of property types.
- var result = new Dictionary();
- SqlHelper.ExecuteReader(
- "select id from cmsPropertyType where contentTypeId = @ctId order by sortOrder",
- SqlHelper.CreateParameter("@ctId", Id)))
{
- while (dr.Read())
+ //MCH NOTE: For the timing being I have changed this to a dictionary to ensure that property types
+ //aren't added multiple times through the MasterContentType structure, because each level loads
+ //its own + inherited property types, which is wrong. Once we are able to fully switch to the new api
+ //this should no longer be a problem as the composition always contains a correct list of property types.
+ var result = new Dictionary();
+ using (IRecordsReader dr =
+ SqlHelper.ExecuteReader(
+ "select id from cmsPropertyType where contentTypeId = @ctId order by sortOrder",
+ SqlHelper.CreateParameter("@ctId", Id)))
{
- var id = dr.GetInt("id");
- var pt = PropertyType.GetPropertyType(id);
- if (pt != null)
- result.Add(pt.Id, pt);
- }
- }
-
- // Get Property Types from the master content type
- if (MasterContentTypes.Count > 0)
- {
- foreach (var mct in MasterContentTypes)
- var pts = ContentType.GetContentType(mct).PropertyTypes;
- foreach (PropertyType pt in pts)
+ while (dr.Read())
{
- if(result.ContainsKey(pt.Id) == false)
+ int id = dr.GetInt("id");
+ PropertyType pt = PropertyType.GetPropertyType(id);
+ if (pt != null)
result.Add(pt.Id, pt);
}
}
- }
- return result.Select(x => x.Value).ToList();
- });
+
+ // Get Property Types from the master content type
+ if (MasterContentTypes.Count > 0)
+ {
+ foreach (var mct in MasterContentTypes)
+ {
+ var pts = GetContentType(mct).PropertyTypes;
+ foreach (var pt in pts)
+ {
+ if (result.ContainsKey(pt.Id) == false)
+ result.Add(pt.Id, pt);
+ }
+ }
+ }
+ return result.Select(x => x.Value).ToList();
+ });
}
}
@@ -1075,7 +1064,8 @@ namespace umbraco.cms.businesslogic
}
// TODO: Load master content types
- SqlHelper.ExecuteReader("Select allowAtRoot, isContainer, Alias,icon,thumbnail,description from cmsContentType where nodeid=" + Id)
+ using (var dr = SqlHelper.ExecuteReader("Select allowAtRoot, isContainer, Alias,icon,thumbnail,description from cmsContentType where nodeid=" + Id)
+ )
{
if (dr.Read())
{
@@ -1191,7 +1181,7 @@ namespace umbraco.cms.businesslogic
temporaryList.Sort((a, b) => a.SortOrder.CompareTo(b.SortOrder));
// now that we aren't going to modify the list, we can set it to the class-scoped variable.
- m_VirtualTabs = temporaryList.DistinctBy(x => x.Id).ToList();
+ _virtualTabs = temporaryList.DistinctBy(x => x.Id).ToList();
}
private static void PopulateMasterContentTypes(PropertyType pt, int docTypeId)
@@ -1347,8 +1337,6 @@ namespace umbraco.cms.businesslogic
// we need to
var contentType = businesslogic.ContentType.GetContentType(contentTypeId);
return pts.Where(x => contentType.MasterContentTypes.Contains(x.ContentTypeId) || x.ContentTypeId == contentTypeId).ToArray();
- GenerateCacheKey(Id, ctype), TimeSpan.FromMinutes(10),
- () =>
}
return pts.Where(x => x.ContentTypeId == contentTypeId).ToArray();