Ensures entire nucache linked list is not rebuild on schema changes when disabled
This commit is contained in:
@@ -9,6 +9,11 @@
|
||||
/// Tells the factory that it should build a new generation of models
|
||||
/// </summary>
|
||||
void Reset();
|
||||
|
||||
/// <summary>
|
||||
/// If the live model factory
|
||||
/// </summary>
|
||||
bool Enabled { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -17,6 +17,20 @@ namespace Umbraco.Core
|
||||
/// <returns></returns>
|
||||
public static bool IsLiveFactory(this IPublishedModelFactory factory) => factory is ILivePublishedModelFactory;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the current <see cref="IPublishedModelFactory"/> is an implementation of <see cref="ILivePublishedModelFactory2"/> and is enabled
|
||||
/// </summary>
|
||||
/// <param name="factory"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsLiveFactoryEnabled(this IPublishedModelFactory factory)
|
||||
{
|
||||
if (factory is ILivePublishedModelFactory2 liveFactory2)
|
||||
return liveFactory2.Enabled;
|
||||
|
||||
// if it's not ILivePublishedModelFactory2 we can't determine if it's enabled or not so return true
|
||||
return factory is ILivePublishedModelFactory;
|
||||
}
|
||||
|
||||
[Obsolete("This method is no longer used or necessary and will be removed from future")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public static void WithSafeLiveFactory(this IPublishedModelFactory factory, Action action)
|
||||
@@ -61,7 +75,6 @@ namespace Umbraco.Core
|
||||
if (resetMethod != null)
|
||||
resetMethod.Invoke(liveFactory, null);
|
||||
}
|
||||
|
||||
action();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,6 +134,9 @@ namespace Umbraco.ModelsBuilder.Embedded
|
||||
return ctor();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Enabled => _config.Enable;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Reset()
|
||||
{
|
||||
|
||||
@@ -859,9 +859,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
Notify<IContentType>(_contentStore, payloads, RefreshContentTypesLocked);
|
||||
Notify<IMediaType>(_mediaStore, payloads, RefreshMediaTypesLocked);
|
||||
|
||||
OnNotified(new NotifiedEventArgs<ContentTypeCacheRefresher.JsonPayload>(payloads));
|
||||
|
||||
if (_publishedModelFactory.IsLiveFactory())
|
||||
if (_publishedModelFactory.IsLiveFactoryEnabled())
|
||||
{
|
||||
//In the case of Pure Live - we actually need to refresh all of the content and the media
|
||||
//see https://github.com/umbraco/Umbraco-CMS/issues/5671
|
||||
|
||||
@@ -49,8 +49,5 @@ namespace Umbraco.Web.PublishedCache
|
||||
|
||||
public virtual void Dispose()
|
||||
{ }
|
||||
|
||||
protected void OnNotified(NotifiedEventArgs<ContentTypeCacheRefresher.JsonPayload> args) => Notified?.Invoke(this, args);
|
||||
public event EventHandler<NotifiedEventArgs<ContentTypeCacheRefresher.JsonPayload>> Notified;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user