Merge pull request #10203 from umbraco/v9/task/internals-visible-to-packages

Made a couple of internal classes public that Deploy has a dependency on.
This commit is contained in:
Andy Butland
2021-04-29 22:18:04 +02:00
committed by GitHub
3 changed files with 44 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using NPoco;
using Umbraco.Cms.Infrastructure.Persistence.DatabaseAnnotations;
@@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos
[TableName(TableName)]
[PrimaryKey("pk")]
[ExplicitColumns]
internal class DictionaryDto
public class DictionaryDto // public as required to be accessible from Deploy for the RepairDictionaryIdsWorkItem.
{
public const string TableName = Cms.Core.Constants.DatabaseSchema.Tables.DictionaryEntry;
[Column("pk")]

View File

@@ -1,4 +1,4 @@
using System;
using System;
using NPoco;
using Umbraco.Cms.Infrastructure.Persistence.DatabaseAnnotations;
@@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos
[TableName(Cms.Core.Constants.DatabaseSchema.Tables.DictionaryValue)]
[PrimaryKey("pk")]
[ExplicitColumns]
internal class LanguageTextDto
public class LanguageTextDto
{
[Column("pk")]
[PrimaryKeyColumn]

View File

@@ -1,4 +1,4 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Infrastructure.Examine;
@@ -6,43 +6,51 @@ using Umbraco.Cms.Infrastructure.Search;
namespace Umbraco.Cms.Infrastructure
{
internal static class Suspendable
public static class Suspendable
{
public static class PageCacheRefresher
{
private static bool _tried, _suspended;
private static bool s_tried, s_suspended;
public static bool CanRefreshDocumentCacheFromDatabase
{
get
{
// trying a full refresh
if (_suspended == false) return true;
_tried = true; // remember we tried
if (s_suspended == false)
{
return true;
}
s_tried = true; // remember we tried
return false;
}
}
// trying a partial update
// ok if not suspended, or if we haven't done a full already
public static bool CanUpdateDocumentCache => _suspended == false || _tried == false;
public static bool CanUpdateDocumentCache => s_suspended == false || s_tried == false;
public static void SuspendDocumentCache()
{
StaticApplicationLogging.Logger.LogInformation("Suspend document cache.");
_suspended = true;
s_suspended = true;
}
public static void ResumeDocumentCache(CacheRefresherCollection cacheRefresherCollection)
{
_suspended = false;
s_suspended = false;
StaticApplicationLogging.Logger.LogInformation("Resume document cache (reload:{Tried}).", _tried);
StaticApplicationLogging.Logger.LogInformation("Resume document cache (reload:{Tried}).", s_tried);
if (_tried == false) return;
_tried = false;
if (s_tried == false)
{
return;
}
var pageRefresher = cacheRefresherCollection[ContentCacheRefresher.UniqueId];
s_tried = false;
ICacheRefresher pageRefresher = cacheRefresherCollection[ContentCacheRefresher.UniqueId];
pageRefresher.RefreshAll();
}
}
@@ -51,14 +59,18 @@ namespace Umbraco.Cms.Infrastructure
// AHH... but Deploy probably uses this?
public static class ExamineEvents
{
private static bool _tried, _suspended;
private static bool s_tried, s_suspended;
public static bool CanIndex
{
get
{
if (_suspended == false) return true;
_tried = true; // remember we tried
if (s_suspended == false)
{
return true;
}
s_tried = true; // remember we tried
return false;
}
}
@@ -66,17 +78,21 @@ namespace Umbraco.Cms.Infrastructure
public static void SuspendIndexers(ILogger logger)
{
logger.LogInformation("Suspend indexers.");
_suspended = true;
s_suspended = true;
}
public static void ResumeIndexers(IndexRebuilder indexRebuilder, ILogger logger, BackgroundIndexRebuilder backgroundIndexRebuilder)
{
_suspended = false;
s_suspended = false;
StaticApplicationLogging.Logger.LogInformation("Resume indexers (rebuild:{Tried}).", _tried);
StaticApplicationLogging.Logger.LogInformation("Resume indexers (rebuild:{Tried}).", s_tried);
if (_tried == false) return;
_tried = false;
if (s_tried == false)
{
return;
}
s_tried = false;
backgroundIndexRebuilder.RebuildIndexes(false);
}
@@ -84,20 +100,20 @@ namespace Umbraco.Cms.Infrastructure
public static class ScheduledPublishing
{
private static bool _suspended;
private static bool s_suspended;
public static bool CanRun => _suspended == false;
public static bool CanRun => s_suspended == false;
public static void Suspend()
{
StaticApplicationLogging.Logger.LogInformation("Suspend scheduled publishing.");
_suspended = true;
s_suspended = true;
}
public static void Resume()
{
StaticApplicationLogging.Logger.LogInformation("Resume scheduled publishing.");
_suspended = false;
s_suspended = false;
}
}
}