ensures the domain cache is totally refreshed when changing langs
This commit is contained in:
@@ -235,6 +235,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
ContentTypeService.ScopedRefreshedEntity += OnContentTypeRefreshedEntity;
|
||||
MediaTypeService.ScopedRefreshedEntity += OnMediaTypeRefreshedEntity;
|
||||
MemberTypeService.ScopedRefreshedEntity += OnMemberTypeRefreshedEntity;
|
||||
|
||||
LocalizationService.SavedLanguage += OnLanguageSaved;
|
||||
}
|
||||
|
||||
private void TearDownRepositoryEvents()
|
||||
@@ -252,6 +254,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
ContentTypeService.ScopedRefreshedEntity -= OnContentTypeRefreshedEntity;
|
||||
MediaTypeService.ScopedRefreshedEntity -= OnMediaTypeRefreshedEntity;
|
||||
MemberTypeService.ScopedRefreshedEntity -= OnMemberTypeRefreshedEntity;
|
||||
|
||||
LocalizationService.SavedLanguage -= OnLanguageSaved;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
@@ -1260,6 +1264,20 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
RebuildMemberDbCache(contentTypeIds: memberTypeIds);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If a <see cref="ILanguage"/> is ever saved with a different culture, we need to rebuild all of the content nucache table
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnLanguageSaved(ILocalizationService sender, Core.Events.SaveEventArgs<ILanguage> e)
|
||||
{
|
||||
var cultureChanged = e.SavedEntities.Any(x => x.WasPropertyDirty(nameof(ILanguage.IsoCode)));
|
||||
if(cultureChanged)
|
||||
{
|
||||
RebuildContentDbCache();
|
||||
}
|
||||
}
|
||||
|
||||
private ContentNuDto GetDto(IContentBase content, bool published)
|
||||
{
|
||||
// should inject these in ctor
|
||||
|
||||
Reference in New Issue
Block a user