Merge remote-tracking branch 'origin/v12/dev' into release/13.0
# Conflicts: # src/Umbraco.Web.UI.Client/package-lock.json # src/Umbraco.Web.UI.Client/package.json # version.json
This commit is contained in:
@@ -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