From acf10eeef0d5b6be4ac83f70ee933ef5fd8e24fd Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 16 Feb 2017 08:11:35 +0100 Subject: [PATCH] U4-9532 logic in ContentRepository.ClearPublished is inefficient - cherry picked from 7.6.0 --- .../Persistence/Repositories/ContentRepository.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs index ff466ea84e..8488bdb65a 100644 --- a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs @@ -784,13 +784,8 @@ order by umbracoNode.{2}, umbracoNode.parentID, umbracoNode.sortOrder", public void ClearPublished(IContent content) { - // race cond! - var documentDtos = Database.Fetch("WHERE nodeId=@id AND published=@published", new { id = content.Id, published = true }); - foreach (var documentDto in documentDtos) - { - documentDto.Published = false; - Database.Update(documentDto); - } + var sql = "UPDATE cmsDocument SET published=0 WHERE nodeId=@id AND published=1"; + Database.Execute(sql, new {id = content.Id}); } ///