U4-7076 - fix xml cache corruption when publishing with children
This commit is contained in:
@@ -1836,14 +1836,18 @@ namespace Umbraco.Core.Services
|
||||
|
||||
//Publish and then update the database with new status
|
||||
var publishedOutcome = internalStrategy.PublishWithChildrenInternal(list, userId, includeUnpublished).ToArray();
|
||||
var published = publishedOutcome
|
||||
.Where(x => x.Success || x.Result.StatusType == PublishStatusType.SuccessAlreadyPublished)
|
||||
// ensure proper order (for events) - cannot publish a child before its parent!
|
||||
.OrderBy(x => x.Result.ContentItem.Level)
|
||||
.ThenBy(x => x.Result.ContentItem.SortOrder);
|
||||
|
||||
var uow = UowProvider.GetUnitOfWork();
|
||||
using (var repository = RepositoryFactory.CreateContentRepository(uow))
|
||||
{
|
||||
//NOTE The Publish with subpages-dialog was used more as a republish-type-thing, so we'll have to include PublishStatusType.SuccessAlreadyPublished
|
||||
//in the updated-list, so the Published event is triggered with the expected set of pages and the xml is updated.
|
||||
foreach (var item in publishedOutcome.Where(
|
||||
x => x.Success || x.Result.StatusType == PublishStatusType.SuccessAlreadyPublished))
|
||||
foreach (var item in published)
|
||||
{
|
||||
item.Result.ContentItem.WriterId = userId;
|
||||
repository.AddOrUpdate(item.Result.ContentItem);
|
||||
|
||||
Reference in New Issue
Block a user