* Init commit for examine 2.0 work, most old umb examine tests working, probably a lot that doesn't * Gets Umbraco Examine tests passing and makes some sense out of them, fixes some underlying issues. * Large refactor, remove TaskHelper, rename Notifications to be consistent, Gets all examine/lucene indexes building and startup ordered in the correct way, removes old files, creates new IUmbracoIndexingHandler for abstracting out all index operations for umbraco data, abstracts out IIndexRebuilder, Fixes Stack overflow with LiveModelsProvider and loading assemblies, ports some changes from v8 for startup handling with cold boots, refactors out LastSyncedFileManager * fix up issues with rebuilding and management dashboard. * removes old files, removes NetworkHelper, fixes LastSyncedFileManager implementation to ensure the machine name is used, fix up logging with cold boot state. * Makes MainDom safer to use and makes PublishedSnapshotService lazily register with MainDom * lazily acquire application id (fix unit tests) * Fixes resource casing and missing test file * Ensures caches when requiring internal services for PublishedSnapshotService, UseNuCache is a separate call, shouldn't be buried in AddWebComponents, was also causing issues in integration tests since nucache was being used for the Id2Key service. * For UmbracoTestServerTestBase enable nucache services * Fixing tests * Fix another test * Fixes tests, use TestHostingEnvironment, make Tests.Common use net5, remove old Lucene.Net.Contrib ref. * Fixes up some review notes * Fixes issue with doubly registering PublishedSnapshotService meanig there could be 2x instances of it * Checks for parseexception when executing the query * Use application root instead of duplicating functionality. * Added Examine project to netcore only solution file * Fixed casing issue with LazyLoad, that is not lowercase. * uses cancellationToken instead of bool flag, fixes always reading lastId from the LastSyncedFileManager, fixes RecurringHostedServiceBase so that there isn't an overlapping thread for the same task type * Fix tests * remove legacy test project from solution file * Fix test Co-authored-by: Bjarke Berg <mail@bergmania.dk>
61 lines
2.8 KiB
C#
61 lines
2.8 KiB
C#
using Umbraco.Cms.Core.PublishedCache;
|
|
using Umbraco.Cms.Infrastructure.PublishedCache.Persistence;
|
|
|
|
namespace Umbraco.Cms.Infrastructure.PublishedCache
|
|
{
|
|
/// <summary>
|
|
/// Generates a status report for <see cref="PublishedSnapshotService"/>
|
|
/// </summary>
|
|
internal class PublishedSnapshotStatus : IPublishedSnapshotStatus
|
|
{
|
|
private readonly PublishedSnapshotService _service;
|
|
private readonly INuCacheContentService _publishedContentService;
|
|
|
|
public PublishedSnapshotStatus(IPublishedSnapshotService service, INuCacheContentService publishedContentService)
|
|
{
|
|
_service = service as PublishedSnapshotService;
|
|
_publishedContentService = publishedContentService;
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public virtual string StatusUrl => "views/dashboard/settings/publishedsnapshotcache.html";
|
|
|
|
/// <inheritdoc/>
|
|
public string GetStatus()
|
|
{
|
|
if (_service == null)
|
|
{
|
|
return $"The current {typeof(IPublishedSnapshotService)} is not the default type. A status cannot be determined.";
|
|
}
|
|
|
|
// TODO: This should be private
|
|
_service.EnsureCaches();
|
|
|
|
var dbCacheIsOk = _publishedContentService.VerifyContentDbCache()
|
|
&& _publishedContentService.VerifyMediaDbCache()
|
|
&& _publishedContentService.VerifyMemberDbCache()
|
|
? "ok"
|
|
: "NOT ok (rebuild?)";
|
|
|
|
ContentStore contentStore = _service.GetContentStore();
|
|
ContentStore mediaStore = _service.GetMediaStore();
|
|
|
|
var contentStoreGen = contentStore.GenCount;
|
|
var mediaStoreGen = mediaStore.GenCount;
|
|
var contentStoreSnap = contentStore.SnapCount;
|
|
var mediaStoreSnap = mediaStore.SnapCount;
|
|
var contentStoreCount = contentStore.Count;
|
|
var mediaStoreCount = mediaStore.Count;
|
|
|
|
string contentStoreCountPlural = contentStoreCount > 1 ? "s" : string.Empty;
|
|
string contentStoreGenPlural = contentStoreGen > 1 ? "s" : string.Empty;
|
|
string contentStoreSnapPlural = contentStoreSnap > 1 ? "s" : string.Empty;
|
|
string mediaStoreCountPlural = mediaStoreCount > 1 ? "s" : string.Empty;
|
|
string mediaStoreGenPlural = mediaStoreGen > 1 ? "s" : string.Empty;
|
|
string mediaStoreSnapPlural = mediaStoreSnap > 1 ? "s" : string.Empty;
|
|
|
|
return $" Database cache is {dbCacheIsOk}. ContentStore contains {contentStoreCount} item{contentStoreCountPlural} and has {contentStoreGen} generation{contentStoreGenPlural} and {contentStoreSnap} snapshot{contentStoreSnapPlural}. MediaStore contains {mediaStoreCount} item{mediaStoreCountPlural} and has {mediaStoreGen} generation{mediaStoreGenPlural} and {mediaStoreSnap} snapshot{mediaStoreSnapPlural}.";
|
|
}
|
|
}
|
|
}
|