Fixes: U4-4746 Examine does not index updated paths/levels for moved/trashed media, U4-4744 Examine events do not listen for recycle bin emptying

This commit is contained in:
Shannon
2014-04-23 20:19:36 +10:00
parent 949447c25f
commit 021cac9ca5
9 changed files with 458 additions and 147 deletions

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Events;
using Umbraco.Core.Models;
using umbraco;
using umbraco.cms.businesslogic.web;
@@ -264,6 +265,17 @@ namespace Umbraco.Web.Cache
dc.Remove(new Guid(DistributedCache.UnpublishedPageCacheRefresherId), x => x.Id, content);
}
/// <summary>
/// invokes the unpublished page cache refresher to mark all ids for permanent removal
/// </summary>
/// <param name="dc"></param>
/// <param name="contentIds"></param>
public static void RemoveUnpublishedCachePermanently(this DistributedCache dc, params int[] contentIds)
{
dc.RefreshByJson(new Guid(DistributedCache.UnpublishedPageCacheRefresherId),
UnpublishedPageCacheRefresher.SerializeToJsonPayloadForPermanentDeletion(contentIds));
}
#endregion
#region Member cache
@@ -338,7 +350,7 @@ namespace Umbraco.Web.Cache
#region Media Cache
/// <summary>
/// Refreshes the cache amongst servers for a media item
/// Refreshes the cache amongst servers for media items
/// </summary>
/// <param name="dc"></param>
/// <param name="media"></param>
@@ -348,6 +360,18 @@ namespace Umbraco.Web.Cache
MediaCacheRefresher.SerializeToJsonPayload(MediaCacheRefresher.OperationType.Saved, media));
}
/// <summary>
/// Refreshes the cache amongst servers for a media item after it's been moved
/// </summary>
/// <param name="dc"></param>
/// <param name="media"></param>
public static void RefreshMediaCacheAfterMoving(this DistributedCache dc, params MoveEventInfo<IMedia>[] media)
{
dc.RefreshByJson(new Guid(DistributedCache.MediaCacheRefresherId),
MediaCacheRefresher.SerializeToJsonPayloadForMoving(
MediaCacheRefresher.OperationType.Saved, media));
}
/// <summary>
/// Removes the cache amongst servers for a media item
/// </summary>
@@ -365,18 +389,27 @@ namespace Umbraco.Web.Cache
}
/// <summary>
/// Removes the cache amongst servers for media items
/// Removes the cache among servers for media items when they are recycled
/// </summary>
/// <param name="dc"></param>
/// <param name="isPermanentlyDeleted"></param>
/// <param name="media"></param>
public static void RemoveMediaCache(this DistributedCache dc, bool isPermanentlyDeleted, params IMedia[] media)
public static void RemoveMediaCacheAfterRecycling(this DistributedCache dc, params MoveEventInfo<IMedia>[] media)
{
dc.RefreshByJson(new Guid(DistributedCache.MediaCacheRefresherId),
MediaCacheRefresher.SerializeToJsonPayload(
isPermanentlyDeleted ? MediaCacheRefresher.OperationType.Deleted : MediaCacheRefresher.OperationType.Trashed,
media));
}
MediaCacheRefresher.SerializeToJsonPayloadForMoving(
MediaCacheRefresher.OperationType.Trashed, media));
}
/// <summary>
/// Removes the cache among servers for media items when they are permanently deleted
/// </summary>
/// <param name="dc"></param>
/// <param name="mediaIds"></param>
public static void RemoveMediaCachePermanently(this DistributedCache dc, params int[] mediaIds)
{
dc.RefreshByJson(new Guid(DistributedCache.MediaCacheRefresherId),
MediaCacheRefresher.SerializeToJsonPayloadForPermanentDeletion(mediaIds));
}
#endregion