From 0b1c479428bc100cb823447d9f100f4aa0c87e7a Mon Sep 17 00:00:00 2001 From: "AnthonyCogworks@Anthony-PC" Date: Thu, 25 Oct 2012 13:35:47 -0100 Subject: [PATCH] Case: http://issues.umbraco.org/issue/U4-715 Removed 2nd call to cleanPropertiesOnDeletion(_contenttypeid); in PropertyType.delete() Replaced multiple calls to db to get all documentTypes. --- .../businesslogic/propertytype/propertytype.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/umbraco.cms/businesslogic/propertytype/propertytype.cs b/src/umbraco.cms/businesslogic/propertytype/propertytype.cs index cc82c27db0..d4b2179670 100644 --- a/src/umbraco.cms/businesslogic/propertytype/propertytype.cs +++ b/src/umbraco.cms/businesslogic/propertytype/propertytype.cs @@ -338,11 +338,13 @@ namespace umbraco.cms.businesslogic.propertytype FlushCache(); // clean all properties on inherited document types (if this propertytype is removed from a master) - cleanPropertiesOnDeletion(_contenttypeid); + //cleanPropertiesOnDeletion(_contenttypeid); // DocumentType.GetAllAsList().FindAll(dt => dt.MasterContentType == _contenttypeid).ForEach(dt => cleanPropertiesOnDeletion(dt.Id)); // Delete all properties of propertytype - cleanPropertiesOnDeletion(_contenttypeid); + cleanPropertiesOnDeletion(_contenttypeid, DocumentType.GetAllAsList()); + + ContentType.FlushFromCache(_contenttypeid); // Delete PropertyType .. SqlHelper.ExecuteNonQuery("Delete from cmsPropertyType where id = " + Id); @@ -365,11 +367,11 @@ namespace umbraco.cms.businesslogic.propertytype } } - private void cleanPropertiesOnDeletion(int contentTypeId) + private void cleanPropertiesOnDeletion(int contentTypeId, List documentTypes ) { // first delete from all master document types - DocumentType.GetAllAsList().FindAll(dt => dt.MasterContentType == contentTypeId).ForEach( - dt => cleanPropertiesOnDeletion(dt.Id)); + documentTypes.FindAll(dt => dt.MasterContentType == contentTypeId).ForEach( + dt => cleanPropertiesOnDeletion(dt.Id, documentTypes)); // then remove from the current doc type Content[] objs = Content.getContentOfContentType(new ContentType(contentTypeId)); @@ -380,10 +382,10 @@ namespace umbraco.cms.businesslogic.propertytype { prop.delete(); } - } + } // invalidate content type cache - ContentType.FlushFromCache(contentTypeId); + //ContentType.FlushFromCache(contentTypeId); } public IDataType GetEditControl(object value, bool isPostBack)