Adds patch fixes for #U4-1653
This commit is contained in:
@@ -21,17 +21,20 @@ namespace Umbraco.Web.Cache
|
||||
Member.BeforeDelete += MemberBeforeDelete;
|
||||
|
||||
MediaService.Saved += MediaServiceSaved;
|
||||
//We need to perform all of the 'before' events here because we need a reference to the
|
||||
//media item's Path before it is moved/deleting/trashed
|
||||
//see: http://issues.umbraco.org/issue/U4-1653
|
||||
MediaService.Deleting += MediaServiceDeleting;
|
||||
MediaService.Moved += MediaServiceMoved;
|
||||
MediaService.Trashed += MediaService_Trashed;
|
||||
MediaService.Moving += MediaServiceMoving;
|
||||
MediaService.Trashing += MediaServiceTrashing;
|
||||
}
|
||||
|
||||
static void MediaService_Trashed(IMediaService sender, Core.Events.MoveEventArgs<Core.Models.IMedia> e)
|
||||
static void MediaServiceTrashing(IMediaService sender, Core.Events.MoveEventArgs<Core.Models.IMedia> e)
|
||||
{
|
||||
ApplicationContext.Current.ApplicationCache.ClearLibraryCacheForMedia(e.Entity.Id);
|
||||
}
|
||||
|
||||
static void MediaServiceMoved(IMediaService sender, Core.Events.MoveEventArgs<Core.Models.IMedia> e)
|
||||
static void MediaServiceMoving(IMediaService sender, Core.Events.MoveEventArgs<Core.Models.IMedia> e)
|
||||
{
|
||||
ApplicationContext.Current.ApplicationCache.ClearLibraryCacheForMedia(e.Entity.Id);
|
||||
}
|
||||
@@ -44,15 +47,6 @@ namespace Umbraco.Web.Cache
|
||||
}
|
||||
}
|
||||
|
||||
//NOTE: this should not need to be done, the SavedCollection event shouldn't even exist!! :(
|
||||
static void MediaServiceSavedCollection(IMediaService sender, Core.Events.SaveEventArgs<System.Collections.Generic.IEnumerable<Core.Models.IMedia>> e)
|
||||
{
|
||||
foreach (var item in e.SavedEntities.SelectMany(x => x))
|
||||
{
|
||||
ApplicationContext.Current.ApplicationCache.ClearLibraryCacheForMedia(item.Id);
|
||||
}
|
||||
}
|
||||
|
||||
static void MediaServiceSaved(IMediaService sender, Core.Events.SaveEventArgs<Core.Models.IMedia> e)
|
||||
{
|
||||
foreach (var item in e.SavedEntities)
|
||||
|
||||
Reference in New Issue
Block a user