AB4227 - Moved Packaging, Compose, Dictionary, Manifest and Sync
This commit is contained in:
@@ -9,6 +9,8 @@ namespace Umbraco.Core.Hosting
|
||||
string LocalTempPath { get; }
|
||||
string ApplicationVirtualPath { get; }
|
||||
|
||||
int CurrentDomainId { get; }
|
||||
|
||||
bool IsDebugMode { get; }
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether Umbraco is hosted.
|
||||
|
||||
@@ -76,5 +76,7 @@ namespace Umbraco.Core
|
||||
/// Gets the exception that caused the boot to fail.
|
||||
/// </summary>
|
||||
BootFailedException BootFailedException { get; }
|
||||
|
||||
IMainDom MainDom { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,8 +110,9 @@ namespace Umbraco.Core.Runtime
|
||||
factory.GetInstance<ISqlContext>(),
|
||||
factory.GetInstance<IProfilingLogger>(),
|
||||
true, new DatabaseServerMessengerOptions(),
|
||||
factory.GetInstance<IHostingEnvironment>()
|
||||
));
|
||||
factory.GetInstance<IHostingEnvironment>(),
|
||||
factory.GetInstance<CacheRefresherCollection>()
|
||||
));
|
||||
|
||||
composition.CacheRefreshers()
|
||||
.Add(() => composition.TypeLoader.GetCacheRefreshers());
|
||||
|
||||
@@ -128,12 +128,6 @@
|
||||
-->
|
||||
<Compile Include="Compose\AuditEventsComponent.cs" />
|
||||
<Compile Include="Compose\AuditEventsComposer.cs" />
|
||||
<Compile Include="Compose\ManifestWatcherComponent.cs" />
|
||||
<Compile Include="Compose\ManifestWatcherComposer.cs" />
|
||||
<Compile Include="Compose\RelateOnCopyComponent.cs" />
|
||||
<Compile Include="Compose\RelateOnCopyComposer.cs" />
|
||||
<Compile Include="Compose\RelateOnTrashComponent.cs" />
|
||||
<Compile Include="Compose\RelateOnTrashComposer.cs" />
|
||||
<Compile Include="Composing\RegisterFactory.cs" />
|
||||
<Compile Include="CompositionExtensions.cs" />
|
||||
<Compile Include="Composing\CompositionExtensions\Configuration.cs" />
|
||||
@@ -144,28 +138,22 @@
|
||||
<Compile Include="CompositionExtensions_Essentials.cs" />
|
||||
<Compile Include="CompositionExtensions_FileSystems.cs" />
|
||||
<Compile Include="Deploy\IGridCellValueConnector.cs" />
|
||||
<Compile Include="Dictionary\UmbracoCultureDictionary.cs" />
|
||||
<Compile Include="Dictionary\UmbracoCultureDictionaryFactory.cs" />
|
||||
<Compile Include="Events\MigrationEventArgs.cs" />
|
||||
<Compile Include="Composing\Current.cs" />
|
||||
<Compile Include="Composing\LightInject\LightInjectContainer.cs" />
|
||||
<Compile Include="Composing\LightInject\MixedLightInjectScopeManagerProvider.cs" />
|
||||
<Compile Include="Logging\Viewer\LogTimePeriod.cs" />
|
||||
<Compile Include="Manifest\ManifestParser.cs" />
|
||||
<Compile Include="Manifest\ValueValidatorConverter.cs" />
|
||||
<Compile Include="Models\Identity\BackOfficeIdentityUser.cs" />
|
||||
<Compile Include="Models\Identity\IdentityMapDefinition.cs" />
|
||||
<Compile Include="Models\Identity\IdentityUser.cs" />
|
||||
<Compile Include="Models\Identity\UserLoginInfoWrapper.cs" />
|
||||
<Compile Include="Models\UserExtensions.cs" />
|
||||
<Compile Include="Packaging\PackageDataInstallation.cs" />
|
||||
<Compile Include="Packaging\PackageInstallation.cs" />
|
||||
<Compile Include="Persistence\SqlCeBulkSqlInsertProvider.cs" />
|
||||
<Compile Include="Persistence\SqlSyntax\SqlCeSyntaxProvider.cs" />
|
||||
<Compile Include="PublishedContentExtensions.cs" />
|
||||
<Compile Include="Security\AuthenticationExtensions.cs" />
|
||||
<Compile Include="Security\PasswordSecurity.cs" />
|
||||
<Compile Include="Security\UmbracoBackOfficeIdentity.cs" />
|
||||
<Compile Include="StringExtensions.cs" />
|
||||
<Compile Include="Sync\RefreshInstructionEnvelope.cs" />
|
||||
<Compile Include="TypeLoaderExtensions.cs" />
|
||||
<Compile Include="Logging\Viewer\CountingFilter.cs" />
|
||||
<Compile Include="Logging\Viewer\ErrorCounterFilter.cs" />
|
||||
@@ -187,7 +175,6 @@
|
||||
<Compile Include="Logging\Serilog\Enrichers\Log4NetLevelMapperEnricher.cs" />
|
||||
<Compile Include="Logging\Viewer\MessageTemplateFilter.cs" />
|
||||
<Compile Include="Logging\Viewer\SavedLogSearch.cs" />
|
||||
<Compile Include="Manifest\DashboardAccessRuleConverter.cs" />
|
||||
<Compile Include="RuntimeOptions.cs" />
|
||||
<Compile Include="Runtime\CoreRuntime.cs" />
|
||||
<Compile Include="Runtime\CoreInitialComponent.cs" />
|
||||
@@ -198,12 +185,10 @@
|
||||
<Compile Include="Logging\OwinLogger.cs" />
|
||||
<Compile Include="Logging\OwinLoggerFactory.cs" />
|
||||
<Compile Include="MainDom.cs" />
|
||||
<Compile Include="Manifest\DataEditorConverter.cs" />
|
||||
<Compile Include="ContentExtensions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RuntimeState.cs" />
|
||||
<Compile Include="Runtime\CoreInitialComposer.cs" />
|
||||
<Compile Include="Security\AuthenticationExtensions.cs" />
|
||||
<Compile Include="Security\BackOfficeUserStore.cs" />
|
||||
<Compile Include="Security\BackOfficeUserValidator.cs" />
|
||||
<Compile Include="Security\ContentPermissionsHelper.cs" />
|
||||
@@ -212,13 +197,9 @@
|
||||
<Compile Include="Security\IUserSessionStore.cs" />
|
||||
<Compile Include="Security\MachineKeyGenerator.cs" />
|
||||
<Compile Include="Security\ConfiguredPasswordValidator.cs" />
|
||||
<Compile Include="Security\UmbracoBackOfficeIdentity.cs" />
|
||||
<Compile Include="Security\UmbracoEmailMessage.cs" />
|
||||
<Compile Include="Security\UserAwarePasswordHasher.cs" />
|
||||
<Compile Include="ServiceContextExtensions.cs" />
|
||||
<Compile Include="Sync\DatabaseServerMessenger.cs" />
|
||||
<Compile Include="Sync\RefreshInstruction.cs" />
|
||||
<Compile Include="Sync\ServerMessengerBase.cs" />
|
||||
<Compile Include="TypeExtensions.cs" />
|
||||
<Compile Include="UriExtensions.cs" />
|
||||
<Compile Include="..\SolutionInfo.cs">
|
||||
@@ -242,7 +223,7 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Services\Implement" />
|
||||
<Folder Include="Sync" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -8,6 +8,15 @@ namespace Umbraco.Core.Compose
|
||||
// TODO: This should just exist in the content service/repo!
|
||||
public sealed class RelateOnCopyComponent : IComponent
|
||||
{
|
||||
private readonly IRelationService _relationService;
|
||||
private readonly IAuditService _auditService;
|
||||
|
||||
public RelateOnCopyComponent(IRelationService relationService, IAuditService auditService)
|
||||
{
|
||||
_relationService = relationService;
|
||||
_auditService = auditService;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
ContentService.Copied += ContentServiceCopied;
|
||||
@@ -16,13 +25,12 @@ namespace Umbraco.Core.Compose
|
||||
public void Terminate()
|
||||
{ }
|
||||
|
||||
private static void ContentServiceCopied(IContentService sender, Events.CopyEventArgs<IContent> e)
|
||||
private void ContentServiceCopied(IContentService sender, Events.CopyEventArgs<IContent> e)
|
||||
{
|
||||
if (e.RelateToOriginal == false) return;
|
||||
|
||||
var relationService = Current.Services.RelationService;
|
||||
|
||||
var relationType = relationService.GetRelationTypeByAlias(Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias);
|
||||
var relationType = _relationService.GetRelationTypeByAlias(Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias);
|
||||
|
||||
if (relationType == null)
|
||||
{
|
||||
@@ -32,13 +40,13 @@ namespace Umbraco.Core.Compose
|
||||
Constants.ObjectTypes.Document,
|
||||
Constants.ObjectTypes.Document);
|
||||
|
||||
relationService.Save(relationType);
|
||||
_relationService.Save(relationType);
|
||||
}
|
||||
|
||||
var relation = new Relation(e.Original.Id, e.Copy.Id, relationType);
|
||||
relationService.Save(relation);
|
||||
_relationService.Save(relation);
|
||||
|
||||
Current.Services.AuditService.Add(
|
||||
_auditService.Add(
|
||||
AuditType.Copy,
|
||||
e.Copy.WriterId,
|
||||
e.Copy.Id, ObjectTypes.GetName(UmbracoObjectTypes.Document),
|
||||
@@ -12,20 +12,22 @@ namespace Umbraco.Core.Compose
|
||||
private readonly IRelationService _relationService;
|
||||
private readonly IEntityService _entityService;
|
||||
private readonly ILocalizedTextService _textService;
|
||||
private readonly IAuditService _auditService;
|
||||
|
||||
public RelateOnTrashComponent(IRelationService relationService, IEntityService entityService, ILocalizedTextService textService)
|
||||
public RelateOnTrashComponent(IRelationService relationService, IEntityService entityService, ILocalizedTextService textService, IAuditService auditService)
|
||||
{
|
||||
_relationService = relationService;
|
||||
_entityService = entityService;
|
||||
_textService = textService;
|
||||
_auditService = auditService;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
ContentService.Moved += (sender, args) => ContentService_Moved(sender, args, _relationService);
|
||||
ContentService.Trashed += (sender, args) => ContentService_Trashed(sender, args, _relationService, _entityService, _textService);
|
||||
ContentService.Trashed += (sender, args) => ContentService_Trashed(sender, args, _relationService, _entityService, _textService, _auditService);
|
||||
MediaService.Moved += (sender, args) => MediaService_Moved(sender, args, _relationService);
|
||||
MediaService.Trashed += (sender, args) => MediaService_Trashed(sender, args, _relationService, _entityService, _textService);
|
||||
MediaService.Trashed += (sender, args) => MediaService_Trashed(sender, args, _relationService, _entityService, _textService, _auditService);
|
||||
}
|
||||
|
||||
public void Terminate()
|
||||
@@ -59,7 +61,7 @@ namespace Umbraco.Core.Compose
|
||||
}
|
||||
}
|
||||
|
||||
private static void ContentService_Trashed(IContentService sender, MoveEventArgs<IContent> e, IRelationService relationService, IEntityService entityService, ILocalizedTextService textService)
|
||||
private static void ContentService_Trashed(IContentService sender, MoveEventArgs<IContent> e, IRelationService relationService, IEntityService entityService, ILocalizedTextService textService, IAuditService auditService)
|
||||
{
|
||||
const string relationTypeAlias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias;
|
||||
var relationType = relationService.GetRelationTypeByAlias(relationTypeAlias);
|
||||
@@ -90,7 +92,7 @@ namespace Umbraco.Core.Compose
|
||||
var relation = new Relation(originalParentId, item.Entity.Id, relationType);
|
||||
relationService.Save(relation);
|
||||
|
||||
Current.Services.AuditService.Add(AuditType.Delete,
|
||||
auditService.Add(AuditType.Delete,
|
||||
item.Entity.WriterId,
|
||||
item.Entity.Id,
|
||||
ObjectTypes.GetName(UmbracoObjectTypes.Document),
|
||||
@@ -101,7 +103,7 @@ namespace Umbraco.Core.Compose
|
||||
}
|
||||
}
|
||||
|
||||
private static void MediaService_Trashed(IMediaService sender, MoveEventArgs<IMedia> e, IRelationService relationService, IEntityService entityService, ILocalizedTextService textService)
|
||||
private static void MediaService_Trashed(IMediaService sender, MoveEventArgs<IMedia> e, IRelationService relationService, IEntityService entityService, ILocalizedTextService textService, IAuditService auditService)
|
||||
{
|
||||
const string relationTypeAlias = Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias;
|
||||
var relationType = relationService.GetRelationTypeByAlias(relationTypeAlias);
|
||||
@@ -126,7 +128,7 @@ namespace Umbraco.Core.Compose
|
||||
// Add a relation for the item being deleted, so that we can know the original parent for if we need to restore later
|
||||
var relation = new Relation(originalParentId, item.Entity.Id, relationType);
|
||||
relationService.Save(relation);
|
||||
Current.Services.AuditService.Add(AuditType.Delete,
|
||||
auditService.Add(AuditType.Delete,
|
||||
item.Entity.CreatorId,
|
||||
item.Entity.Id,
|
||||
ObjectTypes.GetName(UmbracoObjectTypes.Media),
|
||||
@@ -19,7 +19,7 @@ using Umbraco.Core.Strings;
|
||||
|
||||
namespace Umbraco.Core.Packaging
|
||||
{
|
||||
internal class PackageDataInstallation
|
||||
public class PackageDataInstallation
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IFileService _fileService;
|
||||
@@ -678,7 +678,7 @@ namespace Umbraco.Core.Packaging
|
||||
foreach (var templateElement in allowedTemplatesElement.Elements("Template"))
|
||||
{
|
||||
var alias = templateElement.Value;
|
||||
var template = _fileService.GetTemplate(alias.ToSafeAlias());
|
||||
var template = _fileService.GetTemplate(alias.ToSafeAlias(_shortStringHelper));
|
||||
if (template != null)
|
||||
{
|
||||
if (allowedTemplates.Any(x => x.Id == template.Id)) continue;
|
||||
@@ -695,7 +695,7 @@ namespace Umbraco.Core.Packaging
|
||||
|
||||
if (string.IsNullOrEmpty((string)defaultTemplateElement) == false)
|
||||
{
|
||||
var defaultTemplate = _fileService.GetTemplate(defaultTemplateElement.Value.ToSafeAlias());
|
||||
var defaultTemplate = _fileService.GetTemplate(defaultTemplateElement.Value.ToSafeAlias(_shortStringHelper));
|
||||
if (defaultTemplate != null)
|
||||
{
|
||||
contentType.SetDefaultTemplate(defaultTemplate);
|
||||
@@ -1231,7 +1231,7 @@ namespace Umbraco.Core.Packaging
|
||||
var name = prop.Element("Name")?.Value;
|
||||
if (sp == null)
|
||||
{
|
||||
sp = new StylesheetProperty(name, "#" + name.ToSafeAlias(), "");
|
||||
sp = new StylesheetProperty(name, "#" + name.ToSafeAlias(_shortStringHelper), "");
|
||||
s.AddProperty(sp);
|
||||
}
|
||||
else
|
||||
@@ -11,7 +11,7 @@ using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Core.Packaging
|
||||
{
|
||||
internal class PackageInstallation : IPackageInstallation
|
||||
public class PackageInstallation : IPackageInstallation
|
||||
{
|
||||
private readonly PackageExtraction _packageExtraction;
|
||||
private readonly PackageDataInstallation _packageDataInstallation;
|
||||
@@ -95,7 +95,7 @@ namespace Umbraco.Core.Packaging
|
||||
installationSummary.Actions = CompiledPackageXmlParser.GetPackageActions(XElement.Parse(compiledPackage.Actions), compiledPackage.Name);
|
||||
installationSummary.MetaData = compiledPackage;
|
||||
installationSummary.FilesInstalled = packageDefinition.Files;
|
||||
|
||||
|
||||
//make sure the definition is up to date with everything
|
||||
foreach (var x in installationSummary.DataTypesInstalled) packageDefinition.DataTypes.Add(x.Id.ToInvariantString());
|
||||
foreach (var x in installationSummary.LanguagesInstalled) packageDefinition.Languages.Add(x.Id.ToInvariantString());
|
||||
@@ -117,7 +117,7 @@ namespace Umbraco.Core.Packaging
|
||||
{
|
||||
foreach (var n in actions)
|
||||
{
|
||||
//if there is an undo section then save it to the definition so we can run it at uninstallation
|
||||
//if there is an undo section then save it to the definition so we can run it at uninstallation
|
||||
var undo = n.Undo;
|
||||
if (undo)
|
||||
packageDefinition.Actions += n.XmlData.ToString();
|
||||
@@ -189,7 +189,7 @@ namespace Umbraco.Core.Packaging
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ namespace Umbraco.Core.Sync
|
||||
private readonly object _locko = new object();
|
||||
private readonly IProfilingLogger _profilingLogger;
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
private readonly CacheRefresherCollection _cacheRefreshers;
|
||||
private readonly ISqlContext _sqlContext;
|
||||
private readonly Lazy<string> _distCacheFilePath;
|
||||
private int _lastId = -1;
|
||||
@@ -46,7 +47,7 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
public DatabaseServerMessenger(
|
||||
IRuntimeState runtime, IScopeProvider scopeProvider, ISqlContext sqlContext, IProfilingLogger proflog,
|
||||
bool distributedEnabled, DatabaseServerMessengerOptions options, IHostingEnvironment hostingEnvironment)
|
||||
bool distributedEnabled, DatabaseServerMessengerOptions options, IHostingEnvironment hostingEnvironment, CacheRefresherCollection cacheRefreshers)
|
||||
: base(distributedEnabled)
|
||||
{
|
||||
ScopeProvider = scopeProvider ?? throw new ArgumentNullException(nameof(scopeProvider));
|
||||
@@ -54,6 +55,7 @@ namespace Umbraco.Core.Sync
|
||||
_runtime = runtime;
|
||||
_profilingLogger = proflog ?? throw new ArgumentNullException(nameof(proflog));
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
_cacheRefreshers = cacheRefreshers;
|
||||
Logger = proflog;
|
||||
Options = options ?? throw new ArgumentNullException(nameof(options));
|
||||
_lastPruned = _lastSync = DateTime.UtcNow;
|
||||
@@ -123,10 +125,12 @@ namespace Umbraco.Core.Sync
|
||||
// the service will *not* be able to properly handle our notifications anymore
|
||||
const int weight = 10;
|
||||
|
||||
if (!(_runtime is RuntimeState runtime))
|
||||
throw new NotSupportedException($"Unsupported IRuntimeState implementation {_runtime.GetType().FullName}, expecting {typeof(RuntimeState).FullName}.");
|
||||
|
||||
var registered = runtime.MainDom.Register(
|
||||
//TODO Why do we have interface if we expect to be exact type!!!?
|
||||
// if (!(_runtime is RuntimeState runtime))
|
||||
// throw new NotSupportedException($"Unsupported IRuntimeState implementation {_runtime.GetType().FullName}, expecting {typeof(RuntimeState).FullName}.");
|
||||
|
||||
var registered = _runtime.MainDom.Register(
|
||||
() =>
|
||||
{
|
||||
lock (_locko)
|
||||
@@ -226,7 +230,7 @@ namespace Umbraco.Core.Sync
|
||||
/// <summary>
|
||||
/// Synchronize the server (throttled).
|
||||
/// </summary>
|
||||
protected internal void Sync()
|
||||
public void Sync()
|
||||
{
|
||||
lock (_locko)
|
||||
{
|
||||
@@ -262,7 +266,7 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
_lastPruned = _lastSync;
|
||||
|
||||
switch (Current.RuntimeState.ServerRole)
|
||||
switch (_runtime.ServerRole)
|
||||
{
|
||||
case ServerRole.Single:
|
||||
case ServerRole.Master:
|
||||
@@ -524,8 +528,8 @@ namespace Umbraco.Core.Sync
|
||||
/// <para>Practically, all we really need is the guid, the other infos are here for information
|
||||
/// and debugging purposes.</para>
|
||||
/// </remarks>
|
||||
protected static readonly string LocalIdentity = NetworkHelper.MachineName // eg DOMAIN\SERVER
|
||||
+ "/" + Current.HostingEnvironment.ApplicationId // eg /LM/S3SVC/11/ROOT
|
||||
protected string LocalIdentity => NetworkHelper.MachineName // eg DOMAIN\SERVER
|
||||
+ "/" + _hostingEnvironment.ApplicationId // eg /LM/S3SVC/11/ROOT
|
||||
+ " [P" + Process.GetCurrentProcess().Id // eg 1234
|
||||
+ "/D" + AppDomain.CurrentDomain.Id // eg 22
|
||||
+ "] " + Guid.NewGuid().ToString("N").ToUpper(); // make it truly unique
|
||||
@@ -550,15 +554,15 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
#region Notify refreshers
|
||||
|
||||
private static ICacheRefresher GetRefresher(Guid id)
|
||||
private ICacheRefresher GetRefresher(Guid id)
|
||||
{
|
||||
var refresher = Current.CacheRefreshers[id];
|
||||
var refresher = _cacheRefreshers[id];
|
||||
if (refresher == null)
|
||||
throw new InvalidOperationException("Cache refresher with ID \"" + id + "\" does not exist.");
|
||||
return refresher;
|
||||
}
|
||||
|
||||
private static IJsonCacheRefresher GetJsonRefresher(Guid id)
|
||||
private IJsonCacheRefresher GetJsonRefresher(Guid id)
|
||||
{
|
||||
return GetJsonRefresher(GetRefresher(id));
|
||||
}
|
||||
@@ -647,38 +651,38 @@ namespace Umbraco.Core.Sync
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void RefreshAll(Guid uniqueIdentifier)
|
||||
private void RefreshAll(Guid uniqueIdentifier)
|
||||
{
|
||||
var refresher = GetRefresher(uniqueIdentifier);
|
||||
refresher.RefreshAll();
|
||||
}
|
||||
|
||||
private static void RefreshByGuid(Guid uniqueIdentifier, Guid id)
|
||||
private void RefreshByGuid(Guid uniqueIdentifier, Guid id)
|
||||
{
|
||||
var refresher = GetRefresher(uniqueIdentifier);
|
||||
refresher.Refresh(id);
|
||||
}
|
||||
|
||||
private static void RefreshById(Guid uniqueIdentifier, int id)
|
||||
private void RefreshById(Guid uniqueIdentifier, int id)
|
||||
{
|
||||
var refresher = GetRefresher(uniqueIdentifier);
|
||||
refresher.Refresh(id);
|
||||
}
|
||||
|
||||
private static void RefreshByIds(Guid uniqueIdentifier, string jsonIds)
|
||||
private void RefreshByIds(Guid uniqueIdentifier, string jsonIds)
|
||||
{
|
||||
var refresher = GetRefresher(uniqueIdentifier);
|
||||
foreach (var id in JsonConvert.DeserializeObject<int[]>(jsonIds))
|
||||
refresher.Refresh(id);
|
||||
}
|
||||
|
||||
private static void RefreshByJson(Guid uniqueIdentifier, string jsonPayload)
|
||||
private void RefreshByJson(Guid uniqueIdentifier, string jsonPayload)
|
||||
{
|
||||
var refresher = GetJsonRefresher(uniqueIdentifier);
|
||||
refresher.Refresh(jsonPayload);
|
||||
}
|
||||
|
||||
private static void RemoveById(Guid uniqueIdentifier, int id)
|
||||
private void RemoveById(Guid uniqueIdentifier, int id)
|
||||
{
|
||||
var refresher = GetRefresher(uniqueIdentifier);
|
||||
refresher.Remove(id);
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Composing;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Logging;
|
||||
@@ -66,7 +67,7 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
public void PerformRefresh(ICacheRefresher refresher, string jsonPayload)
|
||||
{
|
||||
|
||||
|
||||
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
|
||||
if (jsonPayload == null) throw new ArgumentNullException(nameof(jsonPayload));
|
||||
|
||||
@@ -75,7 +76,7 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
public void PerformRefresh<T>(ICacheRefresher refresher, Func<T, int> getNumericId, params T[] instances)
|
||||
{
|
||||
|
||||
|
||||
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
|
||||
if (getNumericId == null) throw new ArgumentNullException(nameof(getNumericId));
|
||||
if (instances == null || instances.Length == 0) return;
|
||||
@@ -86,7 +87,7 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
public void PerformRefresh<T>(ICacheRefresher refresher, Func<T, Guid> getGuidId, params T[] instances)
|
||||
{
|
||||
|
||||
|
||||
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
|
||||
if (getGuidId == null) throw new ArgumentNullException(nameof(getGuidId));
|
||||
if (instances == null || instances.Length == 0) return;
|
||||
@@ -97,7 +98,7 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
public void PerformRemove<T>(ICacheRefresher refresher, Func<T, int> getNumericId, params T[] instances)
|
||||
{
|
||||
|
||||
|
||||
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
|
||||
if (getNumericId == null) throw new ArgumentNullException(nameof(getNumericId));
|
||||
if (instances == null || instances.Length == 0) return;
|
||||
@@ -108,7 +109,7 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
public void PerformRemove(ICacheRefresher refresher, params int[] numericIds)
|
||||
{
|
||||
|
||||
|
||||
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
|
||||
if (numericIds == null || numericIds.Length == 0) return;
|
||||
|
||||
@@ -117,7 +118,7 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
public void PerformRefresh(ICacheRefresher refresher, params int[] numericIds)
|
||||
{
|
||||
|
||||
|
||||
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
|
||||
if (numericIds == null || numericIds.Length == 0) return;
|
||||
|
||||
@@ -126,7 +127,7 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
public void PerformRefresh(ICacheRefresher refresher, params Guid[] guidIds)
|
||||
{
|
||||
|
||||
|
||||
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
|
||||
if (guidIds == null || guidIds.Length == 0) return;
|
||||
|
||||
@@ -135,7 +136,7 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
public void PerformRefreshAll(ICacheRefresher refresher)
|
||||
{
|
||||
|
||||
|
||||
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
|
||||
|
||||
Deliver(refresher, MessageType.RefreshAll);
|
||||
@@ -288,7 +289,7 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
protected virtual void Deliver<TPayload>(ICacheRefresher refresher, TPayload[] payload)
|
||||
{
|
||||
|
||||
|
||||
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
|
||||
|
||||
// deliver local
|
||||
@@ -305,7 +306,7 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
protected virtual void Deliver(ICacheRefresher refresher, MessageType messageType, IEnumerable<object> ids = null, string json = null)
|
||||
{
|
||||
|
||||
|
||||
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
|
||||
|
||||
var idsA = ids?.ToArray();
|
||||
@@ -323,7 +324,7 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
protected virtual void Deliver<T>(ICacheRefresher refresher, MessageType messageType, Func<T, object> getId, IEnumerable<T> instances)
|
||||
{
|
||||
|
||||
|
||||
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
|
||||
|
||||
var instancesA = instances.ToArray();
|
||||
@@ -31,7 +31,7 @@ namespace Umbraco.Web
|
||||
|
||||
public BatchedDatabaseServerMessenger(
|
||||
IRuntimeState runtime, IUmbracoDatabaseFactory databaseFactory, IScopeProvider scopeProvider, ISqlContext sqlContext, IProfilingLogger proflog, DatabaseServerMessengerOptions options, IHostingEnvironment hostingEnvironment)
|
||||
: base(runtime, scopeProvider, sqlContext, proflog, true, options, hostingEnvironment )
|
||||
: base(runtime, scopeProvider, sqlContext, proflog, true, options, hostingEnvironment, Current.CacheRefreshers)
|
||||
{
|
||||
_databaseFactory = databaseFactory;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,11 @@ namespace Umbraco.Web.Hosting
|
||||
ApplicationId = HostingEnvironment.ApplicationID;
|
||||
ApplicationPhysicalPath = HostingEnvironment.ApplicationPhysicalPath;
|
||||
ApplicationVirtualPath = HostingEnvironment.ApplicationVirtualPath;
|
||||
CurrentDomainId = AppDomain.CurrentDomain.Id;
|
||||
}
|
||||
|
||||
public int CurrentDomainId { get; }
|
||||
|
||||
public string SiteName { get; }
|
||||
public string ApplicationId { get; }
|
||||
public string ApplicationPhysicalPath { get; }
|
||||
|
||||
Reference in New Issue
Block a user