Makes PublishedSnapshotStatus status code more human readable, fixes ModelBinding ns

This commit is contained in:
Shannon
2020-12-23 10:45:52 +11:00
parent c88ba7afa5
commit 0c645a99bd
4 changed files with 23 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
using Umbraco.Infrastructure.PublishedCache.Persistence;
using Umbraco.Infrastructure.PublishedCache.Persistence;
namespace Umbraco.Web.PublishedCache.NuCache
{
@@ -26,26 +26,28 @@ namespace Umbraco.Web.PublishedCache.NuCache
var dbCacheIsOk = _publishedContentService.VerifyContentDbCache()
&& _publishedContentService.VerifyMediaDbCache()
&& _publishedContentService.VerifyMemberDbCache();
&& _publishedContentService.VerifyMemberDbCache()
? "ok"
: "NOT ok (rebuild?)";
ContentStore contentStore = _service.GetContentStore();
ContentStore mediaStore = _service.GetMediaStore();
var cg = contentStore.GenCount;
var mg = mediaStore.GenCount;
var cs = contentStore.SnapCount;
var ms = mediaStore.SnapCount;
var ce = contentStore.Count;
var me = mediaStore.Count;
var contentStoreGen = contentStore.GenCount;
var mediaStoreGen = mediaStore.GenCount;
var contentStoreSnap = contentStore.SnapCount;
var mediaStoreSnap = mediaStore.SnapCount;
var contentStoreCount = contentStore.Count;
var mediaStoreCount = mediaStore.Count;
return
" Database cache is " + (dbCacheIsOk ? "ok" : "NOT ok (rebuild?)") + "." +
" ContentStore contains " + ce + " item" + (ce > 1 ? "s" : "") +
" and has " + cg + " generation" + (cg > 1 ? "s" : "") +
" and " + cs + " snapshot" + (cs > 1 ? "s" : "") + "." +
" MediaStore contains " + me + " item" + (ce > 1 ? "s" : "") +
" and has " + mg + " generation" + (mg > 1 ? "s" : "") +
" and " + ms + " snapshot" + (ms > 1 ? "s" : "") + ".";
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}.";
}
}
}

View File

@@ -1,10 +1,10 @@
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Umbraco.Web.Common.ModelBinding;
using System.Linq;
using Umbraco.Web.Common.Attributes;
using Umbraco.Web.Actions;
using Umbraco.Web.Common.Filters;
using Umbraco.Web.Common.ModelBinders;
namespace Umbraco.Web.Common.ApplicationModels
{

View File

@@ -1,14 +1,14 @@
using Microsoft.AspNetCore.Mvc;
using System.Buffers;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.ObjectPool;
using System.Buffers;
using Umbraco.Web.Common.Formatters;
namespace Umbraco.Web.Common.ModelBinding
namespace Umbraco.Web.Common.ModelBinders
{
/// <summary>
/// A custom body model binder that only uses a <see cref="NewtonsoftJsonInputFormatter"/> to bind body action parameters

View File

@@ -16,7 +16,6 @@ using Umbraco.Web.Common.Install;
using Umbraco.Web.Common.Lifetime;
using Umbraco.Web.Common.Macros;
using Umbraco.Web.Common.Middleware;
using Umbraco.Web.Common.ModelBinding;
using Umbraco.Web.Common.Profiler;
using Umbraco.Web.Common.Routing;
using Umbraco.Web.Common.Security;
@@ -25,6 +24,7 @@ using Umbraco.Web.Composing.CompositionExtensions;
using Umbraco.Web.Macros;
using Umbraco.Web.Security;
using Umbraco.Web.Templates;
using Umbraco.Web.Common.ModelBinders;
namespace Umbraco.Web.Common.Runtime
{