Merge remote-tracking branch 'origin/v13/dev' into v14/dev
# Conflicts: # Directory.Build.props # src/Umbraco.Core/CompatibilitySuppressions.xml # src/Umbraco.Infrastructure/CompatibilitySuppressions.xml # src/Umbraco.Web.BackOffice/CompatibilitySuppressions.xml # src/Umbraco.Web.Common/CompatibilitySuppressions.xml # tests/Umbraco.Tests.Common/CompatibilitySuppressions.xml # tests/Umbraco.Tests.Integration/CompatibilitySuppressions.xml
This commit is contained in:
@@ -25,6 +25,7 @@ internal class Property : PublishedPropertyBase
|
||||
// the invariant-neutral source and inter values
|
||||
private readonly object? _sourceValue;
|
||||
private readonly ContentVariation _variations;
|
||||
private bool _sourceValueIsInvariant;
|
||||
|
||||
// the variant and non-variant object values
|
||||
private CacheValues? _cacheValues;
|
||||
@@ -89,6 +90,7 @@ internal class Property : PublishedPropertyBase
|
||||
// this variable is used for contextualizing the variation level when calculating property values.
|
||||
// it must be set to the union of variance (the combination of content type and property type variance).
|
||||
_variations = propertyType.Variations | content.ContentType.Variations;
|
||||
_sourceValueIsInvariant = propertyType.Variations is ContentVariation.Nothing;
|
||||
}
|
||||
|
||||
// clone for previewing as draft a published content that is published and has no draft
|
||||
@@ -104,6 +106,7 @@ internal class Property : PublishedPropertyBase
|
||||
_isMember = origin._isMember;
|
||||
_publishedSnapshotAccessor = origin._publishedSnapshotAccessor;
|
||||
_variations = origin._variations;
|
||||
_sourceValueIsInvariant = origin._sourceValueIsInvariant;
|
||||
}
|
||||
|
||||
// used to cache the CacheValues of this property
|
||||
@@ -152,7 +155,7 @@ internal class Property : PublishedPropertyBase
|
||||
{
|
||||
_content.VariationContextAccessor.ContextualizeVariation(_variations, _content.Id, ref culture, ref segment);
|
||||
|
||||
if (culture == string.Empty && segment == string.Empty)
|
||||
if (_sourceValueIsInvariant || (culture == string.Empty && segment == string.Empty))
|
||||
{
|
||||
return _sourceValue;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,8 @@ internal class PublishedSnapshotService : IPublishedSnapshotService
|
||||
private long _mediaGen;
|
||||
private ContentStore _mediaStore = null!;
|
||||
|
||||
private string LocalFilePath => Path.Combine(_hostingEnvironment.LocalTempPath, "NuCache");
|
||||
|
||||
public PublishedSnapshotService(
|
||||
PublishedSnapshotServiceOptions options,
|
||||
ISyncBootStateAccessor syncBootStateAccessor,
|
||||
@@ -475,6 +477,22 @@ internal class PublishedSnapshotService : IPublishedSnapshotService
|
||||
return GetUid(_mediaStore, id);
|
||||
}
|
||||
|
||||
|
||||
public void ResetLocalDb()
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"Resetting NuCache local db");
|
||||
var path = LocalFilePath;
|
||||
if (Directory.Exists(path) is false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MainDomRelease();
|
||||
Directory.Delete(path, true);
|
||||
MainDomRegister();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lazily populates the stores only when they are first requested
|
||||
/// </summary>
|
||||
@@ -603,7 +621,7 @@ internal class PublishedSnapshotService : IPublishedSnapshotService
|
||||
/// </remarks>
|
||||
private void MainDomRegister()
|
||||
{
|
||||
var path = GetLocalFilesPath();
|
||||
var path = GetAndEnsureLocalFilesPathExists();
|
||||
var localContentDbPath = Path.Combine(path, "NuCache.Content.db");
|
||||
var localMediaDbPath = Path.Combine(path, "NuCache.Media.db");
|
||||
|
||||
@@ -652,9 +670,9 @@ internal class PublishedSnapshotService : IPublishedSnapshotService
|
||||
}
|
||||
}
|
||||
|
||||
private string GetLocalFilesPath()
|
||||
private string GetAndEnsureLocalFilesPathExists()
|
||||
{
|
||||
var path = Path.Combine(_hostingEnvironment.LocalTempPath, "NuCache");
|
||||
var path = LocalFilePath;
|
||||
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user