diff --git a/umbraco/cms/businesslogic/ContentType.cs b/umbraco/cms/businesslogic/ContentType.cs index cb4aeea272..b6aa8d2b83 100644 --- a/umbraco/cms/businesslogic/ContentType.cs +++ b/umbraco/cms/businesslogic/ContentType.cs @@ -449,8 +449,9 @@ namespace umbraco.cms.businesslogic /// public void ClearVirtualTabs() { + // zb-00040 #29889 : clear the right cache! t.contentType is the ctype which _defines_ the tab, not the current one. foreach (TabI t in getVirtualTabs) - Tab.FlushCache(t.Id, t.ContentType); + Tab.FlushCache(t.Id, Id); m_VirtualTabs = null; } @@ -1025,52 +1026,53 @@ namespace umbraco.cms.businesslogic // Also this is public now because we removed the PropertyTypes property (not making sense). public PropertyType[] GetPropertyTypes(int contentTypeId, bool includeInheritedProperties) { - return Cache.GetCacheItem( - generateCacheKey(Id, contentTypeId), propertyTypesCacheSyncLock, TimeSpan.FromMinutes(10), - delegate - { - var tmp = new List(); + // zb-00040 #29889 : fix cache key issues! + // now maintaining a cache of local properties per contentTypeId, then merging when required + // another way would be to maintain a cache of *all* properties, then filter when required + // however it makes it more difficult to figure out what to clear (ie needs to find all children...) - if (includeInheritedProperties) + var tmp = new List(); + var ctypes = new List(); + + if (includeInheritedProperties) + { + // start from contentTypeId and list all ctypes, going up + int c = contentTypeId; + while (c != 0) + { + ctypes.Add(c); + c = umbraco.cms.businesslogic.ContentType.GetContentType(c).MasterContentType; + } + ctypes.Reverse(); // order from the top + } + else + { + // just that one + ctypes.Add(contentTypeId); + } + + foreach (var ctype in ctypes) + { + var ptypes = Cache.GetCacheItem>( + generateCacheKey(Id, ctype), propertyTypesCacheSyncLock, TimeSpan.FromMinutes(10), + delegate { var tmp1 = new List(); - using(IRecordsReader dr = SqlHelper.ExecuteReader(string.Format( - @"select id from cmsPropertyType where tabId = {0} - order by sortOrder", _id))) + using (IRecordsReader dr = SqlHelper.ExecuteReader(string.Format( + @"select id from cmsPropertyType where tabId = {0} and contentTypeId = {1} + order by sortOrder", _id, ctype))) { while (dr.Read()) tmp1.Add(PropertyType.GetPropertyType(dr.GetInt("id"))); } + return tmp1; + }); - var ctypes = new List(); + tmp.AddRange(ptypes); + } - // start from contentTypeId and list all ctypes, going up - int c = contentTypeId; - while (c != 0) - { - ctypes.Add(c); - c = umbraco.cms.businesslogic.ContentType.GetContentType(c).MasterContentType; - } - ctypes.Reverse(); // order from the top - - // then reorder - foreach (var ctype in ctypes) - tmp.AddRange(tmp1.Where(p => p.ContentTypeId == ctype)); - } - else - { - using (IRecordsReader dr = SqlHelper.ExecuteReader(string.Format( - @"select id from cmsPropertyType where tabId = {0} and contentTypeId = {1} - order by sortOrder", _id, contentTypeId))) - { - while (dr.Read()) - tmp.Add(PropertyType.GetPropertyType(dr.GetInt("id"))); - } - } - - return tmp.ToArray(); - }); + return tmp.ToArray(); } // zb-00036 #29889 : yet we may want to be able to get *all* property types diff --git a/umbraco/cms/businesslogic/propertytype/propertytype.cs b/umbraco/cms/businesslogic/propertytype/propertytype.cs index 212c9369c5..cc82c27db0 100644 --- a/umbraco/cms/businesslogic/propertytype/propertytype.cs +++ b/umbraco/cms/businesslogic/propertytype/propertytype.cs @@ -421,8 +421,9 @@ namespace umbraco.cms.businesslogic.propertytype Cache.ClearCacheItem("ContentType_PropertyTypes_Content:" + _contenttypeid); // clear cache in tab + // zb-00040 #29889 : clear the right cache! t.ContentType is the ctype which _defines_ the tab, not the current one. foreach (ContentType.TabI t in new ContentType(ContentTypeId).getVirtualTabs) - ContentType.FlushTabCache(t.Id, t.ContentType); + ContentType.FlushTabCache(t.Id, ContentTypeId); } public static PropertyType GetPropertyType(int id) diff --git a/umbraco/presentation/umbraco/config/lang/en.xml b/umbraco/presentation/umbraco/config/lang/en.xml index 24448b3f56..7e72f482ee 100644 --- a/umbraco/presentation/umbraco/config/lang/en.xml +++ b/umbraco/presentation/umbraco/config/lang/en.xml @@ -1,5 +1,5 @@ - + umbraco http://umbraco.org