2020-12-24 11:46:17 +11:00
|
|
|
using System.Runtime.InteropServices;
|
2020-04-01 15:50:46 +02:00
|
|
|
using Examine;
|
2020-10-27 10:53:01 +00:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2020-12-24 11:46:17 +11:00
|
|
|
using Microsoft.Extensions.Logging;
|
2020-10-05 21:45:51 +02:00
|
|
|
using Microsoft.Extensions.Options;
|
2021-04-26 21:09:06 +02:00
|
|
|
using Serilog;
|
2021-02-09 10:22:42 +01:00
|
|
|
using Umbraco.Cms.Core;
|
2021-04-26 21:09:06 +02:00
|
|
|
using Umbraco.Cms.Core.Cache;
|
2021-02-09 10:22:42 +01:00
|
|
|
using Umbraco.Cms.Core.Configuration;
|
|
|
|
|
using Umbraco.Cms.Core.Configuration.Models;
|
|
|
|
|
using Umbraco.Cms.Core.DependencyInjection;
|
2021-04-26 21:09:06 +02:00
|
|
|
using Umbraco.Cms.Core.Events;
|
|
|
|
|
using Umbraco.Cms.Core.Handlers;
|
2021-02-09 10:22:42 +01:00
|
|
|
using Umbraco.Cms.Core.HealthChecks.NotificationMethods;
|
|
|
|
|
using Umbraco.Cms.Core.Hosting;
|
|
|
|
|
using Umbraco.Cms.Core.Install;
|
2021-04-26 21:09:06 +02:00
|
|
|
using Umbraco.Cms.Core.Logging;
|
2021-02-12 11:38:50 +01:00
|
|
|
using Umbraco.Cms.Core.Logging.Serilog.Enrichers;
|
2021-04-26 21:09:06 +02:00
|
|
|
using Umbraco.Cms.Core.Logging.Viewer;
|
2021-02-09 10:22:42 +01:00
|
|
|
using Umbraco.Cms.Core.Mail;
|
|
|
|
|
using Umbraco.Cms.Core.Manifest;
|
|
|
|
|
using Umbraco.Cms.Core.Media;
|
2021-06-09 16:18:15 +10:00
|
|
|
using Umbraco.Cms.Core.Migrations;
|
2021-02-09 10:22:42 +01:00
|
|
|
using Umbraco.Cms.Core.Models.PublishedContent;
|
2021-06-15 15:05:57 +10:00
|
|
|
using Umbraco.Cms.Core.Notifications;
|
2021-02-15 13:44:18 +01:00
|
|
|
using Umbraco.Cms.Core.Packaging;
|
2021-02-15 10:42:35 +01:00
|
|
|
using Umbraco.Cms.Core.PropertyEditors;
|
2021-02-09 10:22:42 +01:00
|
|
|
using Umbraco.Cms.Core.PropertyEditors.ValueConverters;
|
|
|
|
|
using Umbraco.Cms.Core.PublishedCache;
|
|
|
|
|
using Umbraco.Cms.Core.Routing;
|
|
|
|
|
using Umbraco.Cms.Core.Runtime;
|
2021-02-15 11:41:12 +01:00
|
|
|
using Umbraco.Cms.Core.Scoping;
|
2021-02-09 10:22:42 +01:00
|
|
|
using Umbraco.Cms.Core.Serialization;
|
|
|
|
|
using Umbraco.Cms.Core.Services;
|
|
|
|
|
using Umbraco.Cms.Core.Strings;
|
|
|
|
|
using Umbraco.Cms.Core.Templates;
|
|
|
|
|
using Umbraco.Cms.Core.Trees;
|
|
|
|
|
using Umbraco.Cms.Core.Web;
|
2021-02-12 10:57:50 +01:00
|
|
|
using Umbraco.Cms.Infrastructure.Examine;
|
2021-02-12 11:03:28 +01:00
|
|
|
using Umbraco.Cms.Infrastructure.HealthChecks;
|
|
|
|
|
using Umbraco.Cms.Infrastructure.HostedServices;
|
2021-02-12 11:11:44 +01:00
|
|
|
using Umbraco.Cms.Infrastructure.Install;
|
2021-02-12 12:33:52 +01:00
|
|
|
using Umbraco.Cms.Infrastructure.Media;
|
2021-02-12 12:40:08 +01:00
|
|
|
using Umbraco.Cms.Infrastructure.Migrations;
|
|
|
|
|
using Umbraco.Cms.Infrastructure.Migrations.Install;
|
|
|
|
|
using Umbraco.Cms.Infrastructure.Migrations.PostMigrations;
|
2021-06-15 15:05:57 +10:00
|
|
|
using Umbraco.Cms.Infrastructure.Packaging;
|
2021-04-26 21:09:06 +02:00
|
|
|
using Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.DataTypes;
|
2021-02-12 13:36:50 +01:00
|
|
|
using Umbraco.Cms.Infrastructure.Persistence;
|
2021-06-24 09:43:57 -06:00
|
|
|
using Umbraco.Cms.Infrastructure.Persistence.Mappers;
|
2021-02-15 11:04:19 +01:00
|
|
|
using Umbraco.Cms.Infrastructure.Runtime;
|
2021-02-15 11:45:27 +01:00
|
|
|
using Umbraco.Cms.Infrastructure.Search;
|
2021-02-15 12:42:26 +01:00
|
|
|
using Umbraco.Cms.Infrastructure.Serialization;
|
2021-02-09 13:32:34 +01:00
|
|
|
using Umbraco.Extensions;
|
2021-08-11 12:17:35 +02:00
|
|
|
using System;
|
2019-01-03 21:00:28 +01:00
|
|
|
|
2021-02-12 10:41:07 +01:00
|
|
|
namespace Umbraco.Cms.Infrastructure.DependencyInjection
|
2019-01-03 21:00:28 +01:00
|
|
|
{
|
2020-12-24 09:50:05 +11:00
|
|
|
public static partial class UmbracoBuilderExtensions
|
2019-01-03 21:00:28 +01:00
|
|
|
{
|
2020-12-24 11:46:17 +11:00
|
|
|
/// <summary>
|
|
|
|
|
/// Adds all core Umbraco services required to run which may be replaced later in the pipeline
|
|
|
|
|
/// </summary>
|
2020-12-15 21:47:15 +00:00
|
|
|
public static IUmbracoBuilder AddCoreInitialServices(this IUmbracoBuilder builder)
|
2019-01-03 21:00:28 +01:00
|
|
|
{
|
2020-12-24 16:35:59 +11:00
|
|
|
builder
|
|
|
|
|
.AddMainDom()
|
|
|
|
|
.AddLogging();
|
2020-04-01 15:50:46 +02:00
|
|
|
|
2020-12-24 11:46:17 +11:00
|
|
|
builder.Services.AddUnique<IUmbracoDatabaseFactory, UmbracoDatabaseFactory>();
|
|
|
|
|
builder.Services.AddUnique(factory => factory.GetRequiredService<IUmbracoDatabaseFactory>().CreateDatabase());
|
|
|
|
|
builder.Services.AddUnique(factory => factory.GetRequiredService<IUmbracoDatabaseFactory>().SqlContext);
|
2021-06-24 09:43:57 -06:00
|
|
|
builder.NPocoMappers().Add<NullableDateMapper>();
|
2021-06-30 06:59:47 +02:00
|
|
|
builder.PackageMigrationPlans().Add(() => builder.TypeLoader.GetPackageMigrationPlans());
|
2021-06-24 09:43:57 -06:00
|
|
|
|
2020-12-24 11:46:17 +11:00
|
|
|
builder.Services.AddUnique<IRuntimeState, RuntimeState>();
|
|
|
|
|
builder.Services.AddUnique<IRuntime, CoreRuntime>();
|
2021-06-15 15:05:57 +10:00
|
|
|
builder.Services.AddUnique<PendingPackageMigrations>();
|
|
|
|
|
builder.AddNotificationAsyncHandler<RuntimeUnattendedInstallNotification, UnattendedInstaller>();
|
|
|
|
|
builder.AddNotificationAsyncHandler<RuntimeUnattendedUpgradeNotification, UnattendedUpgrader>();
|
2020-12-15 21:47:15 +00:00
|
|
|
|
2019-01-03 21:00:28 +01:00
|
|
|
// composers
|
2020-11-18 17:40:23 +00:00
|
|
|
builder
|
2020-12-24 11:46:17 +11:00
|
|
|
.AddRepositories()
|
|
|
|
|
.AddServices()
|
|
|
|
|
.AddCoreMappingProfiles()
|
2021-03-17 17:44:52 +11:00
|
|
|
.AddFileSystems()
|
|
|
|
|
.AddWebAssets();
|
2019-01-03 21:00:28 +01:00
|
|
|
|
|
|
|
|
// register persistence mappers - required by database factory so needs to be done here
|
|
|
|
|
// means the only place the collection can be modified is in a runtime - afterwards it
|
|
|
|
|
// has been frozen and it is too late
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Mappers().AddCoreMappers();
|
2019-01-03 21:00:28 +01:00
|
|
|
|
|
|
|
|
// register the scope provider
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<ScopeProvider>(); // implements both IScopeProvider and IScopeAccessor
|
|
|
|
|
builder.Services.AddUnique<IScopeProvider>(f => f.GetRequiredService<ScopeProvider>());
|
|
|
|
|
builder.Services.AddUnique<IScopeAccessor>(f => f.GetRequiredService<ScopeProvider>());
|
2021-03-05 15:27:45 +11:00
|
|
|
builder.Services.AddScoped<IHttpScopeReference, HttpScopeReference>();
|
2019-01-03 21:00:28 +01:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IJsonSerializer, JsonNetSerializer>();
|
|
|
|
|
builder.Services.AddUnique<IConfigurationEditorJsonSerializer, ConfigurationEditorJsonSerializer>();
|
|
|
|
|
builder.Services.AddUnique<IMenuItemCollectionFactory, MenuItemCollectionFactory>();
|
2019-11-07 21:28:56 +11:00
|
|
|
|
2019-01-03 21:00:28 +01:00
|
|
|
// register database builder
|
|
|
|
|
// *not* a singleton, don't want to keep it around
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddTransient<DatabaseBuilder>();
|
2019-01-03 21:00:28 +01:00
|
|
|
|
|
|
|
|
// register manifest parser, will be injected in collection builders where needed
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IManifestParser, ManifestParser>();
|
2019-01-03 21:00:28 +01:00
|
|
|
|
2019-06-27 12:42:14 +02:00
|
|
|
// register the manifest filter collection builder (collection is empty by default)
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.ManifestFilters();
|
2019-06-27 12:42:14 +02:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.MediaUrlGenerators()
|
2020-02-18 13:56:31 +01:00
|
|
|
.Add<FileUploadPropertyEditor>()
|
|
|
|
|
.Add<ImageCropperPropertyEditor>();
|
|
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IPublishedContentTypeFactory, PublishedContentTypeFactory>();
|
2019-01-03 21:00:28 +01:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IShortStringHelper>(factory
|
2020-10-27 10:53:01 +00:00
|
|
|
=> new DefaultShortStringHelper(new DefaultShortStringHelperConfig().WithDefault(factory.GetRequiredService<IOptions<RequestHandlerSettings>>().Value)));
|
2019-01-03 21:00:28 +01:00
|
|
|
|
2021-06-09 16:18:15 +10:00
|
|
|
builder.Services.AddUnique<IMigrationPlanExecutor, MigrationPlanExecutor>();
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IMigrationBuilder>(factory => new MigrationBuilder(factory));
|
2019-01-03 21:00:28 +01:00
|
|
|
|
2021-04-26 21:09:06 +02:00
|
|
|
builder.AddPreValueMigrators();
|
|
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IPublishedSnapshotRebuilder, PublishedSnapshotRebuilder>();
|
2019-11-25 21:20:00 +11:00
|
|
|
|
2020-02-13 11:21:20 +01:00
|
|
|
// register the published snapshot accessor - the "current" published snapshot is in the umbraco context
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IPublishedSnapshotAccessor, UmbracoContextPublishedSnapshotAccessor>();
|
2020-02-13 11:40:56 +01:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IVariationContextAccessor, HybridVariationContextAccessor>();
|
2020-02-18 11:38:51 +01:00
|
|
|
|
2020-03-24 11:53:56 +11:00
|
|
|
// Config manipulator
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IConfigManipulator, JsonConfigManipulator>();
|
2020-11-03 11:20:51 +01:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<RichTextEditorPastedImages>();
|
|
|
|
|
builder.Services.AddUnique<BlockEditorConverter>();
|
2020-04-01 15:50:46 +02:00
|
|
|
|
|
|
|
|
// both TinyMceValueConverter (in Core) and RteMacroRenderingValueConverter (in Web) will be
|
2020-12-24 14:29:26 +11:00
|
|
|
// discovered when CoreBootManager configures the converters. We will remove the basic one defined
|
|
|
|
|
// in core so that the more enhanced version is active.
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.PropertyValueConverters()
|
2020-12-24 14:29:26 +11:00
|
|
|
.Remove<SimpleTinyMceValueConverter>();
|
2020-04-01 15:50:46 +02:00
|
|
|
|
|
|
|
|
// register *all* checks, except those marked [HideFromTypeFinder] of course
|
2020-12-04 13:01:58 +01:00
|
|
|
builder.Services.AddUnique<IMarkdownToHtmlConverter, MarkdownToHtmlConverter>();
|
2020-12-24 16:35:59 +11:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IContentLastChanceFinder, ContentFinderByConfigured404>();
|
2020-04-01 15:50:46 +02:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddScoped<UmbracoTreeSearcher>();
|
2020-04-01 15:50:46 +02:00
|
|
|
|
2020-12-24 11:46:17 +11:00
|
|
|
// replace
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IEmailSender, EmailSender>();
|
2020-04-01 15:50:46 +02:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IExamineManager, ExamineManager>();
|
2020-04-01 15:50:46 +02:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddScoped<ITagQuery, TagQuery>();
|
2020-04-01 15:50:46 +02:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IUmbracoTreeSearcherFields, UmbracoTreeSearcherFields>();
|
2021-08-04 12:48:19 +02:00
|
|
|
builder.Services.AddSingleton<IPublishedContentQueryAccessor, PublishedContentQueryAccessor>();
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddScoped<IPublishedContentQuery>(factory =>
|
2020-04-01 15:50:46 +02:00
|
|
|
{
|
2020-10-27 10:53:01 +00:00
|
|
|
var umbCtx = factory.GetRequiredService<IUmbracoContextAccessor>();
|
2021-08-16 12:36:50 +02:00
|
|
|
var umbracoContext = umbCtx.GetRequiredUmbracoContext();
|
2021-08-11 12:17:35 +02:00
|
|
|
return new PublishedContentQuery(umbracoContext.PublishedSnapshot, factory.GetRequiredService<IVariationContextAccessor>(), factory.GetRequiredService<IExamineManager>());
|
2020-10-30 11:16:17 +00:00
|
|
|
});
|
2020-04-01 15:50:46 +02:00
|
|
|
|
|
|
|
|
// register accessors for cultures
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IDefaultCultureAccessor, DefaultCultureAccessor>();
|
2020-04-01 15:50:46 +02:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddSingleton<IFilePermissionHelper, FilePermissionHelper>();
|
2020-04-01 15:50:46 +02:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IUmbracoComponentRenderer, UmbracoComponentRenderer>();
|
2020-06-04 12:53:08 +02:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<IBackOfficeExamineSearcher, NoopBackOfficeExamineSearcher>();
|
2020-09-22 21:19:41 +02:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<UploadAutoFillProperties>();
|
2020-09-22 21:19:41 +02:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<ICronTabParser, NCronTabParser>();
|
2020-11-19 23:53:04 +11:00
|
|
|
|
2021-08-16 11:08:09 +02:00
|
|
|
// Add default ImageSharp configuration and service implementations
|
2021-08-16 10:35:37 +02:00
|
|
|
builder.Services.AddUnique(SixLabors.ImageSharp.Configuration.Default);
|
2020-12-04 15:04:29 +01:00
|
|
|
builder.Services.AddUnique<IImageDimensionExtractor, ImageDimensionExtractor>();
|
2021-08-16 11:08:09 +02:00
|
|
|
builder.Services.AddUnique<IImageUrlGenerator, ImageSharpImageUrlGenerator>();
|
2020-12-16 22:26:47 +01:00
|
|
|
|
|
|
|
|
builder.Services.AddUnique<PackageDataInstallation>();
|
2020-12-15 21:47:15 +00:00
|
|
|
|
2020-12-24 14:29:26 +11:00
|
|
|
builder.AddInstaller();
|
|
|
|
|
|
2021-01-25 09:26:38 +01:00
|
|
|
// Services required to run background jobs (with out the handler)
|
|
|
|
|
builder.Services.AddUnique<IBackgroundTaskQueue, BackgroundTaskQueue>();
|
|
|
|
|
|
2020-12-15 21:47:15 +00:00
|
|
|
return builder;
|
2019-01-03 21:00:28 +01:00
|
|
|
}
|
2020-12-24 11:46:17 +11:00
|
|
|
|
2020-12-24 16:35:59 +11:00
|
|
|
/// <summary>
|
|
|
|
|
/// Adds logging requirements for Umbraco
|
|
|
|
|
/// </summary>
|
|
|
|
|
private static IUmbracoBuilder AddLogging(this IUmbracoBuilder builder)
|
2020-12-24 11:46:17 +11:00
|
|
|
{
|
2020-12-24 16:35:59 +11:00
|
|
|
builder.Services.AddUnique<ThreadAbortExceptionEnricher>();
|
|
|
|
|
builder.Services.AddUnique<HttpSessionIdEnricher>();
|
|
|
|
|
builder.Services.AddUnique<HttpRequestNumberEnricher>();
|
|
|
|
|
builder.Services.AddUnique<HttpRequestIdEnricher>();
|
|
|
|
|
return builder;
|
|
|
|
|
}
|
2020-12-24 11:46:17 +11:00
|
|
|
|
2020-12-24 16:35:59 +11:00
|
|
|
private static IUmbracoBuilder AddMainDom(this IUmbracoBuilder builder)
|
|
|
|
|
{
|
2020-12-24 11:46:17 +11:00
|
|
|
builder.Services.AddUnique<IMainDomLock>(factory =>
|
|
|
|
|
{
|
2021-03-05 15:36:27 +01:00
|
|
|
var globalSettings = factory.GetRequiredService<IOptions<GlobalSettings>>();
|
|
|
|
|
var connectionStrings = factory.GetRequiredService<IOptions<ConnectionStrings>>();
|
2020-12-24 11:46:17 +11:00
|
|
|
var hostingEnvironment = factory.GetRequiredService<IHostingEnvironment>();
|
|
|
|
|
|
|
|
|
|
var dbCreator = factory.GetRequiredService<IDbProviderFactoryCreator>();
|
2021-01-18 15:40:22 +01:00
|
|
|
var databaseSchemaCreatorFactory = factory.GetRequiredService<DatabaseSchemaCreatorFactory>();
|
2020-12-24 11:46:17 +11:00
|
|
|
var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
|
|
|
|
var loggerFactory = factory.GetRequiredService<ILoggerFactory>();
|
2021-06-24 09:43:57 -06:00
|
|
|
var npocoMappers = factory.GetRequiredService<NPocoMapperCollection>();
|
2020-12-24 11:46:17 +11:00
|
|
|
|
2021-03-05 15:36:27 +01:00
|
|
|
return globalSettings.Value.MainDomLock.Equals("SqlMainDomLock") || isWindows == false
|
2021-06-24 09:43:57 -06:00
|
|
|
? (IMainDomLock)new SqlMainDomLock(
|
|
|
|
|
loggerFactory.CreateLogger<SqlMainDomLock>(),
|
|
|
|
|
loggerFactory,
|
|
|
|
|
globalSettings,
|
|
|
|
|
connectionStrings,
|
|
|
|
|
dbCreator,
|
|
|
|
|
hostingEnvironment,
|
|
|
|
|
databaseSchemaCreatorFactory,
|
|
|
|
|
npocoMappers)
|
2020-12-24 11:46:17 +11:00
|
|
|
: new MainDomSemaphoreLock(loggerFactory.CreateLogger<MainDomSemaphoreLock>(), hostingEnvironment);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return builder;
|
|
|
|
|
}
|
2021-04-26 21:09:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
private static IUmbracoBuilder AddPreValueMigrators(this IUmbracoBuilder builder)
|
|
|
|
|
{
|
|
|
|
|
builder.WithCollectionBuilder<PreValueMigratorCollectionBuilder>()
|
|
|
|
|
.Append<RenamingPreValueMigrator>()
|
|
|
|
|
.Append<RichTextPreValueMigrator>()
|
|
|
|
|
.Append<UmbracoSliderPreValueMigrator>()
|
|
|
|
|
.Append<MediaPickerPreValueMigrator>()
|
|
|
|
|
.Append<ContentPickerPreValueMigrator>()
|
|
|
|
|
.Append<NestedContentPreValueMigrator>()
|
|
|
|
|
.Append<DecimalPreValueMigrator>()
|
|
|
|
|
.Append<ListViewPreValueMigrator>()
|
|
|
|
|
.Append<DropDownFlexiblePreValueMigrator>()
|
|
|
|
|
.Append<ValueListPreValueMigrator>()
|
|
|
|
|
.Append<MarkdownEditorPreValueMigrator>();
|
|
|
|
|
|
|
|
|
|
return builder;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IUmbracoBuilder AddLogViewer(this IUmbracoBuilder builder)
|
|
|
|
|
{
|
|
|
|
|
builder.Services.AddUnique<ILogViewerConfig, LogViewerConfig>();
|
|
|
|
|
builder.SetLogViewer<SerilogJsonLogViewer>();
|
|
|
|
|
builder.Services.AddUnique<ILogViewer>(factory => new SerilogJsonLogViewer(factory.GetRequiredService<ILogger<SerilogJsonLogViewer>>(),
|
|
|
|
|
factory.GetRequiredService<ILogViewerConfig>(),
|
|
|
|
|
factory.GetRequiredService<ILoggingConfiguration>(),
|
|
|
|
|
Log.Logger));
|
|
|
|
|
|
|
|
|
|
return builder;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static IUmbracoBuilder AddCoreNotifications(this IUmbracoBuilder builder)
|
|
|
|
|
{
|
2021-06-15 19:10:30 +02:00
|
|
|
// add handlers for sending user notifications (i.e. emails)
|
2021-04-26 21:09:06 +02:00
|
|
|
builder.Services.AddUnique<UserNotificationsHandler.Notifier>();
|
|
|
|
|
builder
|
|
|
|
|
.AddNotificationHandler<ContentSavedNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentSortedNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentPublishedNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentMovedNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentMovedToRecycleBinNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentCopiedNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentRolledBackNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentSentToPublishNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentUnpublishedNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<AssignedUserGroupPermissionsNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<PublicAccessEntrySavedNotification, UserNotificationsHandler>();
|
|
|
|
|
|
|
|
|
|
// add handlers for building content relations
|
|
|
|
|
builder
|
|
|
|
|
.AddNotificationHandler<ContentCopiedNotification, RelateOnCopyNotificationHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentMovedNotification, RelateOnTrashNotificationHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentMovedToRecycleBinNotification, RelateOnTrashNotificationHandler>()
|
|
|
|
|
.AddNotificationHandler<MediaMovedNotification, RelateOnTrashNotificationHandler>()
|
|
|
|
|
.AddNotificationHandler<MediaMovedToRecycleBinNotification, RelateOnTrashNotificationHandler>();
|
|
|
|
|
|
|
|
|
|
// add notification handlers for property editors
|
|
|
|
|
builder
|
|
|
|
|
.AddNotificationHandler<ContentSavingNotification, BlockEditorPropertyHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentCopyingNotification, BlockEditorPropertyHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentSavingNotification, NestedContentPropertyHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentCopyingNotification, NestedContentPropertyHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentCopiedNotification, FileUploadPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<ContentDeletedNotification, FileUploadPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<MediaDeletedNotification, FileUploadPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<MediaSavingNotification, FileUploadPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<MemberDeletedNotification, FileUploadPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<ContentCopiedNotification, ImageCropperPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<ContentDeletedNotification, ImageCropperPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<MediaDeletedNotification, ImageCropperPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<MediaSavingNotification, ImageCropperPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<MemberDeletedNotification, ImageCropperPropertyEditor>();
|
|
|
|
|
|
|
|
|
|
// add notification handlers for redirect tracking
|
|
|
|
|
builder
|
|
|
|
|
.AddNotificationHandler<ContentPublishingNotification, RedirectTrackingHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentPublishedNotification, RedirectTrackingHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentMovingNotification, RedirectTrackingHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentMovedNotification, RedirectTrackingHandler>();
|
|
|
|
|
|
|
|
|
|
// Add notification handlers for DistributedCache
|
|
|
|
|
builder
|
|
|
|
|
.AddNotificationHandler<DictionaryItemDeletedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<DictionaryItemSavedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<LanguageSavedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<LanguageDeletedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<MemberSavedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<MemberDeletedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<PublicAccessEntrySavedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<PublicAccessEntryDeletedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<UserSavedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<UserDeletedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<UserGroupWithUsersSavedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<UserGroupDeletedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<MemberGroupDeletedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<MemberGroupSavedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<DataTypeDeletedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<DataTypeSavedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<TemplateDeletedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<TemplateSavedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<RelationTypeDeletedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<RelationTypeSavedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<DomainDeletedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<DomainSavedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<MacroSavedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<MacroDeletedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<MediaTreeChangeNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<ContentTypeChangedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<MediaTypeChangedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<MemberTypeChangedNotification, DistributedCacheBinder>()
|
|
|
|
|
.AddNotificationHandler<ContentTreeChangeNotification, DistributedCacheBinder>()
|
|
|
|
|
;
|
|
|
|
|
// add notification handlers for auditing
|
|
|
|
|
builder
|
|
|
|
|
.AddNotificationHandler<MemberSavedNotification, AuditNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<MemberDeletedNotification, AuditNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<AssignedMemberRolesNotification, AuditNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<RemovedMemberRolesNotification, AuditNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ExportedMemberNotification, AuditNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<UserSavedNotification, AuditNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<UserDeletedNotification, AuditNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<UserGroupWithUsersSavedNotification, AuditNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<AssignedUserGroupPermissionsNotification, AuditNotificationsHandler>();
|
|
|
|
|
|
|
|
|
|
return builder;
|
|
|
|
|
}
|
2019-01-03 21:00:28 +01:00
|
|
|
}
|
|
|
|
|
}
|