Amended injection of further settings to use IOptionsSnapshot.
This commit is contained in:
@@ -41,7 +41,6 @@ namespace Umbraco.Configuration
|
||||
//configs.Add<IModelsBuilderConfig>(() => new ModelsBuilderConfig(_configuration));
|
||||
//configs.Add<IHostingSettings>(() => new HostingSettings(_configuration));
|
||||
//configs.Add<IGlobalSettings>(() => new GlobalSettings(_configuration));
|
||||
configs.Add<IConnectionStrings>(() => new ConnectionStrings(_configuration));
|
||||
//configs.Add<IImagingSettings>(() => new ImagingSettings(_configuration));
|
||||
|
||||
return configs;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
|
||||
namespace Umbraco.Core.Configuration
|
||||
{
|
||||
public static class ContentSettingsExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Determines if file extension is allowed for upload based on (optional) white list and black list
|
||||
/// held in settings.
|
||||
/// Allow upload if extension is whitelisted OR if there is no whitelist and extension is NOT blacklisted.
|
||||
/// </summary>
|
||||
public static bool IsFileAllowedForUpload(this IContentSettings contentSettings, string extension)
|
||||
{
|
||||
return contentSettings.AllowedUploadFiles.Any(x => x.InvariantEquals(extension)) ||
|
||||
(contentSettings.AllowedUploadFiles.Any() == false &&
|
||||
contentSettings.DisallowedUploadFiles.Any(x => x.InvariantEquals(extension)) == false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
using Umbraco.Core.Models.Identity;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
@@ -39,7 +40,7 @@ namespace Umbraco.Core.BackOffice
|
||||
/// <param name="email">This is allowed to be null (but would need to be filled in if trying to persist this instance)</param>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns></returns>
|
||||
public static BackOfficeIdentityUser CreateNew(IGlobalSettings globalSettings, string username, string email, string culture)
|
||||
public static BackOfficeIdentityUser CreateNew(GlobalSettings globalSettings, string username, string email, string culture)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(username)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(username));
|
||||
if (string.IsNullOrWhiteSpace(culture)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(culture));
|
||||
@@ -57,7 +58,7 @@ namespace Umbraco.Core.BackOffice
|
||||
return user;
|
||||
}
|
||||
|
||||
private BackOfficeIdentityUser(IGlobalSettings globalSettings, IReadOnlyUserGroup[] groups)
|
||||
private BackOfficeIdentityUser(GlobalSettings globalSettings, IReadOnlyUserGroup[] groups)
|
||||
{
|
||||
_startMediaIds = Array.Empty<int>();
|
||||
_startContentIds = Array.Empty<int>();
|
||||
@@ -78,7 +79,7 @@ namespace Umbraco.Core.BackOffice
|
||||
/// <param name="globalSettings"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="groups"></param>
|
||||
public BackOfficeIdentityUser(IGlobalSettings globalSettings, int userId, IEnumerable<IReadOnlyUserGroup> groups)
|
||||
public BackOfficeIdentityUser(GlobalSettings globalSettings, int userId, IEnumerable<IReadOnlyUserGroup> groups)
|
||||
: this(globalSettings, groups.ToArray())
|
||||
{
|
||||
// use the property setters - they do more than just setting a field
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Mapping;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
@@ -11,13 +13,13 @@ namespace Umbraco.Core.BackOffice
|
||||
{
|
||||
private readonly ILocalizedTextService _textService;
|
||||
private readonly IEntityService _entityService;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
public IdentityMapDefinition(ILocalizedTextService textService, IEntityService entityService, IGlobalSettings globalSettings)
|
||||
public IdentityMapDefinition(ILocalizedTextService textService, IEntityService entityService, IOptionsSnapshot<GlobalSettings> globalSettings)
|
||||
{
|
||||
_textService = textService;
|
||||
_entityService = entityService;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
}
|
||||
|
||||
public void DefineMaps(UmbracoMapper mapper)
|
||||
|
||||
@@ -21,7 +21,6 @@ namespace Umbraco.Core.Composing
|
||||
private readonly Dictionary<string, Action<IRegister>> _uniques = new Dictionary<string, Action<IRegister>>();
|
||||
private readonly IRegister _register;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Composition"/> class.
|
||||
/// </summary>
|
||||
@@ -29,16 +28,14 @@ namespace Umbraco.Core.Composing
|
||||
/// <param name="typeLoader">A type loader.</param>
|
||||
/// <param name="logger">A logger.</param>
|
||||
/// <param name="runtimeState">The runtime state.</param>
|
||||
/// <param name="configs">Optional configs.</param>
|
||||
/// <param name="ioHelper">An IOHelper</param>
|
||||
/// <param name="appCaches"></param>
|
||||
public Composition(IRegister register, TypeLoader typeLoader, IProfilingLogger logger, IRuntimeState runtimeState, Configs configs, IIOHelper ioHelper, AppCaches appCaches)
|
||||
public Composition(IRegister register, TypeLoader typeLoader, IProfilingLogger logger, IRuntimeState runtimeState, IIOHelper ioHelper, AppCaches appCaches)
|
||||
{
|
||||
_register = register ?? throw new ArgumentNullException(nameof(register));
|
||||
TypeLoader = typeLoader ?? throw new ArgumentNullException(nameof(typeLoader));
|
||||
Logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
RuntimeState = runtimeState ?? throw new ArgumentNullException(nameof(runtimeState));
|
||||
Configs = configs ?? throw new ArgumentNullException(nameof(configs));
|
||||
IOHelper = ioHelper ?? throw new ArgumentNullException(nameof(ioHelper));
|
||||
AppCaches = appCaches ?? throw new ArgumentNullException(nameof(appCaches));
|
||||
}
|
||||
@@ -63,11 +60,6 @@ namespace Umbraco.Core.Composing
|
||||
/// </summary>
|
||||
public IRuntimeState RuntimeState { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configurations.
|
||||
/// </summary>
|
||||
public Configs Configs { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRegister
|
||||
@@ -136,7 +128,8 @@ namespace Umbraco.Core.Composing
|
||||
|
||||
IFactory factory = null;
|
||||
|
||||
Configs.RegisterWith(_register);
|
||||
// TODO: what to do about this?
|
||||
//Configs.RegisterWith(_register);
|
||||
|
||||
// ReSharper disable once AccessToModifiedClosure -- on purpose
|
||||
_register.Register(_ => factory, Lifetime.Singleton);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
|
||||
namespace Umbraco.Core.Composing
|
||||
@@ -11,10 +11,10 @@ namespace Umbraco.Core.Composing
|
||||
/// </summary>
|
||||
public class TypeFinderConfig : ITypeFinderConfig
|
||||
{
|
||||
private readonly ITypeFinderSettings _settings;
|
||||
private readonly TypeFinderSettings _settings;
|
||||
private IEnumerable<string> _assembliesAcceptingLoadExceptions;
|
||||
|
||||
public TypeFinderConfig(ITypeFinderSettings settings)
|
||||
public TypeFinderConfig(TypeFinderSettings settings)
|
||||
{
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
|
||||
public static class ConfigConnectionStringExtensions
|
||||
{
|
||||
public static bool IsConnectionStringConfigured(this ConfigConnectionString databaseSettings)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Hosting;
|
||||
|
||||
namespace Umbraco.Core.Configuration
|
||||
@@ -14,7 +15,7 @@ namespace Umbraco.Core.Configuration
|
||||
/// <param name="globalSettings"></param>
|
||||
/// <param name="hostingEnvironment"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetBackOfficePath(this IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
public static string GetBackOfficePath(this GlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
if (_backOfficePath != null) return _backOfficePath;
|
||||
_backOfficePath = hostingEnvironment.ToAbsolute(globalSettings.UmbracoPath);
|
||||
@@ -32,7 +33,7 @@ namespace Umbraco.Core.Configuration
|
||||
/// We also make sure that the virtual directory (SystemDirectories.Root) is stripped off first, otherwise we'd end up with something
|
||||
/// like "MyVirtualDirectory-Umbraco" instead of just "Umbraco".
|
||||
/// </remarks>
|
||||
public static string GetUmbracoMvcArea(this IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
public static string GetUmbracoMvcArea(this GlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
if (_mvcArea != null) return _mvcArea;
|
||||
|
||||
@@ -41,7 +42,7 @@ namespace Umbraco.Core.Configuration
|
||||
return _mvcArea;
|
||||
}
|
||||
|
||||
internal static string GetUmbracoMvcAreaNoCache(this IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
internal static string GetUmbracoMvcAreaNoCache(this GlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
var path = string.IsNullOrEmpty(globalSettings.UmbracoPath)
|
||||
? string.Empty
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Text.Json.Serialization;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
public class ConnectionStrings : IConnectionStrings
|
||||
public class ConnectionStrings
|
||||
{
|
||||
private readonly IConfiguration _configuration;
|
||||
[JsonPropertyName(Constants.System.UmbracoConnectionName)]
|
||||
public string UmbracoConnectionString { get; set; }
|
||||
|
||||
public ConnectionStrings(IConfiguration configuration)
|
||||
private Dictionary<string, string> AsDictionary() => new Dictionary<string, string>
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
{ Constants.System.UmbracoConnectionName, UmbracoConnectionString }
|
||||
};
|
||||
|
||||
public ConfigConnectionString this[string key]
|
||||
{
|
||||
get
|
||||
{
|
||||
var connectionString = _configuration.GetConnectionString(key);
|
||||
var connectionString = this.AsDictionary()[key];
|
||||
var provider = ParseProvider(connectionString);
|
||||
return new ConfigConnectionString(connectionString, provider, key);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace Umbraco.Core.Configuration
|
||||
@@ -8,9 +9,8 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
private static string _modelsDirectoryAbsolute = null;
|
||||
|
||||
public static string ModelsDirectoryAbsolute(this IModelsBuilderConfig modelsBuilderConfig, IIOHelper ioHelper)
|
||||
public static string ModelsDirectoryAbsolute(this ModelsBuilderConfig modelsBuilderConfig, IIOHelper ioHelper)
|
||||
{
|
||||
|
||||
if (_modelsDirectoryAbsolute is null)
|
||||
{
|
||||
var modelsDirectory = modelsBuilderConfig.ModelsDirectory;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Reflection;
|
||||
using Semver;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
|
||||
namespace Umbraco.Core.Configuration
|
||||
{
|
||||
@@ -10,9 +10,9 @@ namespace Umbraco.Core.Configuration
|
||||
/// </summary>
|
||||
public class UmbracoVersion : IUmbracoVersion
|
||||
{
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
public UmbracoVersion(IGlobalSettings globalSettings)
|
||||
public UmbracoVersion(GlobalSettings globalSettings)
|
||||
: this()
|
||||
{
|
||||
_globalSettings = globalSettings;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Umbraco.Core.IO
|
||||
{
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
|
||||
public IOHelper(IHostingEnvironment hostingEnvironment, IGlobalSettings globalSettings)
|
||||
public IOHelper(IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
_hostingEnvironment = hostingEnvironment ?? throw new ArgumentNullException(nameof(hostingEnvironment));
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
@@ -14,7 +15,7 @@ namespace Umbraco.Core.Models
|
||||
[DataContract(IsReference = true)]
|
||||
public class Language : EntityBase, ILanguage
|
||||
{
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
private string _isoCode;
|
||||
private string _cultureName;
|
||||
@@ -22,7 +23,7 @@ namespace Umbraco.Core.Models
|
||||
private bool _mandatory;
|
||||
private int? _fallbackLanguageId;
|
||||
|
||||
public Language(IGlobalSettings globalSettings, string isoCode)
|
||||
public Language(GlobalSettings globalSettings, string isoCode)
|
||||
{
|
||||
IsoCode = isoCode;
|
||||
_globalSettings = globalSettings;
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
|
||||
namespace Umbraco.Core.Models.Membership
|
||||
@@ -18,7 +19,7 @@ namespace Umbraco.Core.Models.Membership
|
||||
/// <summary>
|
||||
/// Constructor for creating a new/empty user
|
||||
/// </summary>
|
||||
public User(IGlobalSettings globalSettings)
|
||||
public User(GlobalSettings globalSettings)
|
||||
{
|
||||
SessionTimeout = 60;
|
||||
_userGroups = new HashSet<IReadOnlyUserGroup>();
|
||||
@@ -38,7 +39,7 @@ namespace Umbraco.Core.Models.Membership
|
||||
/// <param name="email"></param>
|
||||
/// <param name="username"></param>
|
||||
/// <param name="rawPasswordValue"></param>
|
||||
public User(IGlobalSettings globalSettings, string name, string email, string username, string rawPasswordValue)
|
||||
public User(GlobalSettings globalSettings, string name, string email, string username, string rawPasswordValue)
|
||||
: this(globalSettings)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(name));
|
||||
@@ -69,7 +70,7 @@ namespace Umbraco.Core.Models.Membership
|
||||
/// <param name="userGroups"></param>
|
||||
/// <param name="startContentIds"></param>
|
||||
/// <param name="startMediaIds"></param>
|
||||
public User(IGlobalSettings globalSettings, int id, string name, string email, string username,
|
||||
public User(GlobalSettings globalSettings, int id, string name, string email, string username,
|
||||
string rawPasswordValue, string passwordConfig,
|
||||
IEnumerable<IReadOnlyUserGroup> userGroups, int[] startContentIds, int[] startMediaIds)
|
||||
: this(globalSettings)
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
@@ -48,14 +49,14 @@ namespace Umbraco.Core.Models
|
||||
/// <param name="textService"></param>
|
||||
/// <param name="globalSettings"></param>
|
||||
/// <returns></returns>
|
||||
public static CultureInfo GetUserCulture(this IUser user, ILocalizedTextService textService, IGlobalSettings globalSettings)
|
||||
public static CultureInfo GetUserCulture(this IUser user, ILocalizedTextService textService, GlobalSettings globalSettings)
|
||||
{
|
||||
if (user == null) throw new ArgumentNullException(nameof(user));
|
||||
if (textService == null) throw new ArgumentNullException(nameof(textService));
|
||||
return GetUserCulture(user.Language, textService, globalSettings);
|
||||
}
|
||||
|
||||
public static CultureInfo GetUserCulture(string userLanguage, ILocalizedTextService textService, IGlobalSettings globalSettings)
|
||||
public static CultureInfo GetUserCulture(string userLanguage, ILocalizedTextService textService, GlobalSettings globalSettings)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -5,7 +5,9 @@ using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
@@ -61,7 +63,7 @@ namespace Umbraco.Core.Packaging
|
||||
IHostingEnvironment hostingEnvironment,
|
||||
IEntityXmlSerializer serializer, ILogger logger,
|
||||
IUmbracoVersion umbracoVersion,
|
||||
IGlobalSettings globalSettings,
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings,
|
||||
string packageRepositoryFileName,
|
||||
string tempFolderPath = null, string packagesFolderPath = null, string mediaFolderPath = null)
|
||||
{
|
||||
@@ -79,7 +81,7 @@ namespace Umbraco.Core.Packaging
|
||||
|
||||
_tempFolderPath = tempFolderPath ?? Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "PackageFiles";
|
||||
_packagesFolderPath = packagesFolderPath ?? Constants.SystemDirectories.Packages;
|
||||
_mediaFolderPath = mediaFolderPath ?? globalSettings.UmbracoMediaPath + "/created-packages";
|
||||
_mediaFolderPath = mediaFolderPath ?? globalSettings.Value.UmbracoMediaPath + "/created-packages";
|
||||
|
||||
_parser = new PackageDefinitionXmlParser(logger, umbracoVersion);
|
||||
_umbracoVersion = umbracoVersion;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Composing;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Services;
|
||||
@@ -149,7 +150,7 @@ namespace Umbraco.Core
|
||||
}
|
||||
|
||||
public static bool IsAllowedTemplate(this IPublishedContent content, IContentTypeService contentTypeService,
|
||||
IWebRoutingSettings webRoutingSettings, int templateId)
|
||||
WebRoutingSettings webRoutingSettings, int templateId)
|
||||
{
|
||||
return content.IsAllowedTemplate(contentTypeService,
|
||||
webRoutingSettings.DisableAlternativeTemplates,
|
||||
|
||||
@@ -4,6 +4,8 @@ using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using System.Globalization;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Web.Routing
|
||||
{
|
||||
@@ -17,11 +19,11 @@ namespace Umbraco.Web.Routing
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IRequestAccessor _requestAccessor;
|
||||
private readonly IWebRoutingSettings _webRoutingSettings;
|
||||
private readonly WebRoutingSettings _webRoutingSettings;
|
||||
|
||||
public ContentFinderByIdPath(IWebRoutingSettings webRoutingSettings, ILogger logger, IRequestAccessor requestAccessor)
|
||||
public ContentFinderByIdPath(IOptionsSnapshot<WebRoutingSettings> webRoutingSettings, ILogger logger, IRequestAccessor requestAccessor)
|
||||
{
|
||||
_webRoutingSettings = webRoutingSettings ?? throw new System.ArgumentNullException(nameof(webRoutingSettings));
|
||||
_webRoutingSettings = webRoutingSettings.Value ?? throw new System.ArgumentNullException(nameof(webRoutingSettings));
|
||||
_logger = logger ?? throw new System.ArgumentNullException(nameof(logger));
|
||||
_requestAccessor = requestAccessor;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Web.Routing
|
||||
{
|
||||
@@ -19,14 +21,14 @@ namespace Umbraco.Web.Routing
|
||||
private readonly IFileService _fileService;
|
||||
|
||||
private readonly IContentTypeService _contentTypeService;
|
||||
private readonly IWebRoutingSettings _webRoutingSettings;
|
||||
private readonly WebRoutingSettings _webRoutingSettings;
|
||||
|
||||
public ContentFinderByUrlAndTemplate(ILogger logger, IFileService fileService, IContentTypeService contentTypeService, IWebRoutingSettings webRoutingSettings)
|
||||
public ContentFinderByUrlAndTemplate(ILogger logger, IFileService fileService, IContentTypeService contentTypeService, IOptionsSnapshot<WebRoutingSettings> webRoutingSettings)
|
||||
: base(logger)
|
||||
{
|
||||
_fileService = fileService;
|
||||
_contentTypeService = contentTypeService;
|
||||
_webRoutingSettings = webRoutingSettings;
|
||||
_webRoutingSettings = webRoutingSettings.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,6 +5,8 @@ using System.Threading;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Web.Routing
|
||||
{
|
||||
@@ -16,7 +18,7 @@ namespace Umbraco.Web.Routing
|
||||
public class PublishedRequest : IPublishedRequest
|
||||
{
|
||||
private readonly IPublishedRouter _publishedRouter;
|
||||
private readonly IWebRoutingSettings _webRoutingSettings;
|
||||
private readonly WebRoutingSettings _webRoutingSettings;
|
||||
|
||||
private bool _readonly; // after prepared
|
||||
private bool _readonlyUri; // after preparing
|
||||
@@ -33,11 +35,11 @@ namespace Umbraco.Web.Routing
|
||||
/// <param name="publishedRouter">The published router.</param>
|
||||
/// <param name="umbracoContext">The Umbraco context.</param>
|
||||
/// <param name="uri">The request <c>Uri</c>.</param>
|
||||
public PublishedRequest(IPublishedRouter publishedRouter, IUmbracoContext umbracoContext, IWebRoutingSettings webRoutingSettings, Uri uri = null)
|
||||
public PublishedRequest(IPublishedRouter publishedRouter, IUmbracoContext umbracoContext, IOptionsSnapshot<WebRoutingSettings> webRoutingSettings, Uri uri = null)
|
||||
{
|
||||
UmbracoContext = umbracoContext ?? throw new ArgumentNullException(nameof(umbracoContext));
|
||||
_publishedRouter = publishedRouter ?? throw new ArgumentNullException(nameof(publishedRouter));
|
||||
_webRoutingSettings = webRoutingSettings;
|
||||
_webRoutingSettings = webRoutingSettings.Value;
|
||||
Uri = uri ?? umbracoContext.CleanedUmbracoUrl;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Security;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Web.Routing
|
||||
{
|
||||
@@ -18,7 +20,7 @@ namespace Umbraco.Web.Routing
|
||||
/// </summary>
|
||||
public class PublishedRouter : IPublishedRouter
|
||||
{
|
||||
private readonly IWebRoutingSettings _webRoutingSettings;
|
||||
private readonly WebRoutingSettings _webRoutingSettings;
|
||||
private readonly ContentFinderCollection _contentFinders;
|
||||
private readonly IContentLastChanceFinder _contentLastChanceFinder;
|
||||
private readonly IProfilingLogger _profilingLogger;
|
||||
@@ -36,7 +38,7 @@ namespace Umbraco.Web.Routing
|
||||
/// Initializes a new instance of the <see cref="PublishedRouter"/> class.
|
||||
/// </summary>
|
||||
public PublishedRouter(
|
||||
IWebRoutingSettings webRoutingSettings,
|
||||
IOptionsSnapshot<WebRoutingSettings> webRoutingSettings,
|
||||
ContentFinderCollection contentFinders,
|
||||
IContentLastChanceFinder contentLastChanceFinder,
|
||||
IVariationContextAccessor variationContextAccessor,
|
||||
@@ -49,7 +51,7 @@ namespace Umbraco.Web.Routing
|
||||
IContentTypeService contentTypeService,
|
||||
IPublicAccessService publicAccessService)
|
||||
{
|
||||
_webRoutingSettings = webRoutingSettings ?? throw new ArgumentNullException(nameof(webRoutingSettings));
|
||||
_webRoutingSettings = webRoutingSettings.Value ?? throw new ArgumentNullException(nameof(webRoutingSettings));
|
||||
_contentFinders = contentFinders ?? throw new ArgumentNullException(nameof(contentFinders));
|
||||
_contentLastChanceFinder = contentLastChanceFinder ?? throw new ArgumentNullException(nameof(contentLastChanceFinder));
|
||||
_profilingLogger = proflog ?? throw new ArgumentNullException(nameof(proflog));
|
||||
|
||||
@@ -4,6 +4,8 @@ using System.Linq;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Web.Routing
|
||||
{
|
||||
@@ -24,7 +26,7 @@ namespace Umbraco.Web.Routing
|
||||
/// <param name="mediaUrlProviders">The list of media url providers.</param>
|
||||
/// <param name="variationContextAccessor">The current variation accessor.</param>
|
||||
/// <param name="propertyEditorCollection"></param>
|
||||
public UrlProvider(IUmbracoContextAccessor umbracoContextAccessor, IWebRoutingSettings routingSettings, UrlProviderCollection urlProviders, MediaUrlProviderCollection mediaUrlProviders, IVariationContextAccessor variationContextAccessor)
|
||||
public UrlProvider(IUmbracoContextAccessor umbracoContextAccessor, IOptionsSnapshot<WebRoutingSettings> routingSettings, UrlProviderCollection urlProviders, MediaUrlProviderCollection mediaUrlProviders, IVariationContextAccessor variationContextAccessor)
|
||||
{
|
||||
if (routingSettings == null) throw new ArgumentNullException(nameof(routingSettings));
|
||||
|
||||
@@ -35,7 +37,7 @@ namespace Umbraco.Web.Routing
|
||||
var provider = UrlMode.Auto;
|
||||
Mode = provider;
|
||||
|
||||
if (Enum<UrlMode>.TryParse(routingSettings.UrlProviderMode, out provider))
|
||||
if (Enum<UrlMode>.TryParse(routingSettings.Value.UrlProviderMode, out provider))
|
||||
{
|
||||
Mode = provider;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
|
||||
<_Parameter1>Umbraco.Tests</_Parameter1>
|
||||
</AssemblyAttribute>
|
||||
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
|
||||
<_Parameter1>Umbraco.Tests.Common</_Parameter1>
|
||||
</AssemblyAttribute>
|
||||
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
|
||||
<_Parameter1>Umbraco.Tests.UnitTests</_Parameter1>
|
||||
</AssemblyAttribute>
|
||||
|
||||
@@ -3,8 +3,8 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using Umbraco.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
@@ -38,7 +38,7 @@ namespace Umbraco.Core
|
||||
/// But if we've got this far we'll just have to assume it's front-end anyways.
|
||||
///
|
||||
/// </remarks>
|
||||
public static bool IsBackOfficeRequest(this Uri url, IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
public static bool IsBackOfficeRequest(this Uri url, GlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
var applicationPath = hostingEnvironment.ApplicationVirtualPath;
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace Umbraco.Core
|
||||
/// <param name="globalSettings"></param>
|
||||
/// <param name="hostingEnvironment"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool IsDefaultBackOfficeRequest(this Uri url, IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
internal static bool IsDefaultBackOfficeRequest(this Uri url, GlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
var backOfficePath = globalSettings.GetBackOfficePath(hostingEnvironment);
|
||||
if (url.AbsolutePath.InvariantEquals(backOfficePath.TrimEnd("/"))
|
||||
|
||||
@@ -4,11 +4,11 @@ using System.IO;
|
||||
using Examine;
|
||||
using Examine.LuceneEngine.Directories;
|
||||
using Lucene.Net.Store;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace Umbraco.Examine
|
||||
{
|
||||
@@ -20,13 +20,13 @@ namespace Umbraco.Examine
|
||||
{
|
||||
private readonly ITypeFinder _typeFinder;
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
private readonly IIndexCreatorSettings _settings;
|
||||
private readonly IndexCreatorSettings _settings;
|
||||
|
||||
protected LuceneIndexCreator(ITypeFinder typeFinder, IHostingEnvironment hostingEnvironment, IIndexCreatorSettings settings)
|
||||
protected LuceneIndexCreator(ITypeFinder typeFinder, IHostingEnvironment hostingEnvironment, IOptionsSnapshot<IndexCreatorSettings> settings)
|
||||
{
|
||||
_typeFinder = typeFinder;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
_settings = settings;
|
||||
_settings = settings.Value;
|
||||
}
|
||||
|
||||
public abstract IEnumerable<IIndex> Create();
|
||||
|
||||
@@ -9,6 +9,8 @@ using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Examine
|
||||
{
|
||||
@@ -28,7 +30,7 @@ namespace Umbraco.Examine
|
||||
IUmbracoIndexConfig umbracoIndexConfig,
|
||||
IHostingEnvironment hostingEnvironment,
|
||||
IRuntimeState runtimeState,
|
||||
IIndexCreatorSettings settings) : base(typeFinder, hostingEnvironment, settings)
|
||||
IOptionsSnapshot<IndexCreatorSettings> settings) : base(typeFinder, hostingEnvironment, settings)
|
||||
{
|
||||
ProfilingLogger = profilingLogger ?? throw new System.ArgumentNullException(nameof(profilingLogger));
|
||||
LanguageService = languageService ?? throw new System.ArgumentNullException(nameof(languageService));
|
||||
|
||||
@@ -5,7 +5,9 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Mapping;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Identity;
|
||||
@@ -32,11 +34,16 @@ namespace Umbraco.Core.BackOffice
|
||||
private readonly IUserService _userService;
|
||||
private readonly IEntityService _entityService;
|
||||
private readonly IExternalLoginService _externalLoginService;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly UmbracoMapper _mapper;
|
||||
private bool _disposed = false;
|
||||
|
||||
public BackOfficeUserStore(IUserService userService, IEntityService entityService, IExternalLoginService externalLoginService, IGlobalSettings globalSettings, UmbracoMapper mapper)
|
||||
public BackOfficeUserStore(IUserService userService, IEntityService entityService, IExternalLoginService externalLoginService, IOptionsSnapshot<GlobalSettings> globalSettings, UmbracoMapper mapper)
|
||||
: this(userService, entityService, externalLoginService, globalSettings.Value, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
public BackOfficeUserStore(IUserService userService, IEntityService entityService, IExternalLoginService externalLoginService, GlobalSettings globalSettings, UmbracoMapper mapper)
|
||||
{
|
||||
_userService = userService;
|
||||
_entityService = entityService;
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
@@ -153,7 +155,7 @@ namespace Umbraco.Web.Compose
|
||||
private readonly INotificationService _notificationService;
|
||||
private readonly IUserService _userService;
|
||||
private readonly ILocalizedTextService _textService;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
/// <summary>
|
||||
@@ -166,14 +168,21 @@ namespace Umbraco.Web.Compose
|
||||
/// <param name="globalSettings"></param>
|
||||
/// <param name="contentConfig"></param>
|
||||
/// <param name="logger"></param>
|
||||
public Notifier(IUmbracoContextAccessor umbracoContextAccessor, IRequestAccessor requestAccessor, INotificationService notificationService, IUserService userService, ILocalizedTextService textService, IGlobalSettings globalSettings, ILogger logger)
|
||||
public Notifier(
|
||||
IUmbracoContextAccessor umbracoContextAccessor,
|
||||
IRequestAccessor requestAccessor,
|
||||
INotificationService notificationService,
|
||||
IUserService userService,
|
||||
ILocalizedTextService textService,
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings,
|
||||
ILogger logger)
|
||||
{
|
||||
_umbracoContextAccessor = umbracoContextAccessor;
|
||||
_requestAccessor = requestAccessor;
|
||||
_notificationService = notificationService;
|
||||
_userService = userService;
|
||||
_textService = textService;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Umbraco.Core.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.IO.MediaPathSchemes;
|
||||
@@ -97,7 +99,7 @@ namespace Umbraco.Core.Composing.CompositionExtensions
|
||||
var ioHelper = factory.GetInstance<IIOHelper>();
|
||||
var hostingEnvironment = factory.GetInstance<IHostingEnvironment>();
|
||||
var logger = factory.GetInstance<ILogger>();
|
||||
var globalSettings = factory.GetInstance<IGlobalSettings>();
|
||||
var globalSettings = factory.GetInstance<IOptionsSnapshot<GlobalSettings>>().Value;
|
||||
|
||||
var rootPath = hostingEnvironment.MapPathWebRoot(globalSettings.UmbracoMediaPath);
|
||||
var rootUrl = hostingEnvironment.ToAbsolute(globalSettings.UmbracoMediaPath);
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
@@ -94,13 +96,13 @@ namespace Umbraco.Core.Composing.CompositionExtensions
|
||||
factory.GetInstance<IEntityXmlSerializer>(),
|
||||
factory.GetInstance<ILogger>(),
|
||||
factory.GetInstance<IUmbracoVersion>(),
|
||||
factory.GetInstance<IGlobalSettings>(),
|
||||
factory.GetInstance<IOptionsSnapshot<GlobalSettings>>(),
|
||||
packageRepoFileName);
|
||||
|
||||
private static LocalizedTextServiceFileSources SourcesFactory(IFactory container)
|
||||
{
|
||||
var hostingEnvironment = container.GetInstance<IHostingEnvironment>();
|
||||
var globalSettings = container.GetInstance<IGlobalSettings>();
|
||||
var globalSettings = container.GetInstance<IOptionsSnapshot<GlobalSettings>>().Value;
|
||||
var mainLangFolder = new DirectoryInfo(hostingEnvironment.MapPathContentRoot(WebPath.Combine(globalSettings.UmbracoPath , "config","lang")));
|
||||
var appPlugins = new DirectoryInfo(hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.AppPlugins));
|
||||
var configLangFolder = new DirectoryInfo(hostingEnvironment.MapPathContentRoot(WebPath.Combine(Constants.SystemDirectories.Config ,"lang")));
|
||||
|
||||
@@ -6,6 +6,7 @@ using System;
|
||||
using System.Reflection;
|
||||
using Umbraco.Core.Composing.LightInject;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
|
||||
namespace Umbraco.Core.Composing
|
||||
{
|
||||
@@ -29,7 +30,7 @@ namespace Umbraco.Core.Composing
|
||||
/// To override the default LightInjectContainer, add an appSetting named 'Umbraco.Core.RegisterType' with
|
||||
/// a fully qualified type name to a class with a static method "Create" returning an IRegister.
|
||||
/// </remarks>
|
||||
public static IRegister Create(IGlobalSettings globalSettings)
|
||||
public static IRegister Create(GlobalSettings globalSettings)
|
||||
{
|
||||
Type type;
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@ namespace Umbraco.Web.HealthCheck.NotificationMethods
|
||||
private readonly ILocalizedTextService _textService;
|
||||
private readonly IRequestAccessor _requestAccessor;
|
||||
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly ContentSettings _contentSettings;
|
||||
|
||||
public EmailNotificationMethod(
|
||||
ILocalizedTextService textService,
|
||||
IRequestAccessor requestAccessor,
|
||||
IGlobalSettings globalSettings,
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings,
|
||||
IHealthChecksSettings healthChecksSettings,
|
||||
IOptionsSnapshot<ContentSettings> contentSettings)
|
||||
: base(healthChecksSettings)
|
||||
@@ -39,7 +39,7 @@ namespace Umbraco.Web.HealthCheck.NotificationMethods
|
||||
|
||||
_textService = textService ?? throw new ArgumentNullException(nameof(textService));
|
||||
_requestAccessor = requestAccessor;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
_contentSettings = contentSettings.Value ?? throw new ArgumentNullException(nameof(contentSettings));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Install;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Web.Install
|
||||
{
|
||||
@@ -19,13 +21,13 @@ namespace Umbraco.Web.Install
|
||||
|
||||
// ensure Umbraco can write to these files (the directories must exist)
|
||||
private readonly string[] _permissionFiles = { };
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly IPublishedSnapshotService _publishedSnapshotService;
|
||||
|
||||
public FilePermissionHelper(IGlobalSettings globalSettings, IIOHelper ioHelper, IPublishedSnapshotService publishedSnapshotService)
|
||||
public FilePermissionHelper(IOptionsSnapshot<GlobalSettings> globalSettings, IIOHelper ioHelper, IPublishedSnapshotService publishedSnapshotService)
|
||||
{
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
_ioHelper = ioHelper;
|
||||
_publishedSnapshotService = publishedSnapshotService;
|
||||
_permissionDirs = new[] { _globalSettings.UmbracoCssPath, Constants.SystemDirectories.Config, Constants.SystemDirectories.Data, _globalSettings.UmbracoMediaPath, Constants.SystemDirectories.Preview };
|
||||
|
||||
@@ -13,6 +13,7 @@ using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Install.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Web.Install
|
||||
{
|
||||
@@ -22,7 +23,7 @@ namespace Umbraco.Web.Install
|
||||
private readonly DatabaseBuilder _databaseBuilder;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IUmbracoVersion _umbracoVersion;
|
||||
private readonly IConnectionStrings _connectionStrings;
|
||||
private readonly ConnectionStrings _connectionStrings;
|
||||
private readonly IInstallationService _installationService;
|
||||
private readonly ICookieManager _cookieManager;
|
||||
private readonly IUserAgentProvider _userAgentProvider;
|
||||
@@ -33,7 +34,7 @@ namespace Umbraco.Web.Install
|
||||
public InstallHelper(DatabaseBuilder databaseBuilder,
|
||||
ILogger logger,
|
||||
IUmbracoVersion umbracoVersion,
|
||||
IConnectionStrings connectionStrings,
|
||||
IOptionsSnapshot<ConnectionStrings> connectionStrings,
|
||||
IInstallationService installationService,
|
||||
ICookieManager cookieManager,
|
||||
IUserAgentProvider userAgentProvider,
|
||||
@@ -43,7 +44,7 @@ namespace Umbraco.Web.Install
|
||||
_logger = logger;
|
||||
_umbracoVersion = umbracoVersion;
|
||||
_databaseBuilder = databaseBuilder;
|
||||
_connectionStrings = connectionStrings ?? throw new ArgumentNullException(nameof(connectionStrings));
|
||||
_connectionStrings = connectionStrings.Value ?? throw new ArgumentNullException(nameof(connectionStrings));
|
||||
_installationService = installationService;
|
||||
_cookieManager = cookieManager;
|
||||
_userAgentProvider = userAgentProvider;
|
||||
|
||||
@@ -6,6 +6,7 @@ using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Migrations.Install;
|
||||
using Umbraco.Web.Install.Models;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Web.Install.InstallSteps
|
||||
{
|
||||
@@ -16,12 +17,12 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
{
|
||||
private readonly DatabaseBuilder _databaseBuilder;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IConnectionStrings _connectionStrings;
|
||||
private readonly ConnectionStrings _connectionStrings;
|
||||
|
||||
public DatabaseConfigureStep(DatabaseBuilder databaseBuilder, IConnectionStrings connectionStrings)
|
||||
public DatabaseConfigureStep(DatabaseBuilder databaseBuilder, IOptionsSnapshot<ConnectionStrings> connectionStrings)
|
||||
{
|
||||
_databaseBuilder = databaseBuilder;
|
||||
_connectionStrings = connectionStrings ?? throw new ArgumentNullException(nameof(connectionStrings));
|
||||
_connectionStrings = connectionStrings.Value ?? throw new ArgumentNullException(nameof(connectionStrings));
|
||||
}
|
||||
|
||||
public override Task<InstallSetupResult> ExecuteAsync(DatabaseModel database)
|
||||
|
||||
@@ -16,19 +16,11 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
{
|
||||
private readonly DatabaseBuilder _databaseBuilder;
|
||||
private readonly IRuntimeState _runtime;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly IConnectionStrings _connectionStrings;
|
||||
private readonly IConfigManipulator _configManipulator;
|
||||
|
||||
public DatabaseInstallStep(DatabaseBuilder databaseBuilder, IRuntimeState runtime, ILogger logger, IIOHelper ioHelper, IConnectionStrings connectionStrings, IConfigManipulator configManipulator)
|
||||
public DatabaseInstallStep(DatabaseBuilder databaseBuilder, IRuntimeState runtime)
|
||||
{
|
||||
_databaseBuilder = databaseBuilder;
|
||||
_runtime = runtime;
|
||||
_logger = logger;
|
||||
_ioHelper = ioHelper;
|
||||
_connectionStrings = connectionStrings;
|
||||
_configManipulator = configManipulator;
|
||||
}
|
||||
|
||||
public override Task<InstallSetupResult> ExecuteAsync(object model)
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Migrations.Install;
|
||||
@@ -20,8 +22,8 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
private readonly IRuntimeState _runtime;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IUmbracoVersion _umbracoVersion;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly IConnectionStrings _connectionStrings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly ConnectionStrings _connectionStrings;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly IConfigManipulator _configManipulator;
|
||||
|
||||
@@ -30,8 +32,8 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
IRuntimeState runtime,
|
||||
ILogger logger,
|
||||
IUmbracoVersion umbracoVersion,
|
||||
IGlobalSettings globalSettings,
|
||||
IConnectionStrings connectionStrings,
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings,
|
||||
IOptionsSnapshot<ConnectionStrings> connectionStrings,
|
||||
IIOHelper ioHelper,
|
||||
IConfigManipulator configManipulator)
|
||||
{
|
||||
@@ -39,8 +41,8 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
_runtime = runtime;
|
||||
_logger = logger;
|
||||
_umbracoVersion = umbracoVersion;
|
||||
_globalSettings = globalSettings;
|
||||
_connectionStrings = connectionStrings ?? throw new ArgumentNullException(nameof(connectionStrings));
|
||||
_globalSettings = globalSettings.Value;
|
||||
_connectionStrings = connectionStrings.Value ?? throw new ArgumentNullException(nameof(connectionStrings));
|
||||
_ioHelper = ioHelper;
|
||||
_configManipulator = configManipulator;
|
||||
}
|
||||
|
||||
@@ -30,29 +30,26 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
private readonly IUserService _userService;
|
||||
private readonly DatabaseBuilder _databaseBuilder;
|
||||
private static HttpClient _httpClient;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly UserPasswordConfigurationSettings _passwordConfiguration;
|
||||
private readonly SecuritySettings _securitySettings;
|
||||
private readonly IConnectionStrings _connectionStrings;
|
||||
private readonly ConnectionStrings _connectionStrings;
|
||||
private readonly ICookieManager _cookieManager;
|
||||
private readonly BackOfficeUserManager _userManager;
|
||||
|
||||
public NewInstallStep(
|
||||
IUserService userService,
|
||||
DatabaseBuilder databaseBuilder,
|
||||
IGlobalSettings globalSettings,
|
||||
IOptionsSnapshot<UserPasswordConfigurationSettings> passwordConfiguration,
|
||||
IOptionsSnapshot<SecuritySettings> securitySettings,
|
||||
IConnectionStrings connectionStrings,
|
||||
IOptionsSnapshot<ConnectionStrings> connectionStrings,
|
||||
ICookieManager cookieManager,
|
||||
BackOfficeUserManager userManager)
|
||||
{
|
||||
_userService = userService ?? throw new ArgumentNullException(nameof(userService));
|
||||
_databaseBuilder = databaseBuilder ?? throw new ArgumentNullException(nameof(databaseBuilder));
|
||||
_globalSettings = globalSettings ?? throw new ArgumentNullException(nameof(globalSettings));
|
||||
_passwordConfiguration = passwordConfiguration.Value ?? throw new ArgumentNullException(nameof(passwordConfiguration));
|
||||
_securitySettings = securitySettings.Value ?? throw new ArgumentNullException(nameof(securitySettings));
|
||||
_connectionStrings = connectionStrings ?? throw new ArgumentNullException(nameof(connectionStrings));
|
||||
_connectionStrings = connectionStrings.Value ?? throw new ArgumentNullException(nameof(connectionStrings));
|
||||
_cookieManager = cookieManager;
|
||||
_userManager = userManager ?? throw new ArgumentNullException(nameof(userManager));
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
@@ -21,7 +23,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
{
|
||||
private readonly IUmbracoDatabaseFactory _databaseFactory;
|
||||
private readonly IScopeProvider _scopeProvider;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IRuntimeState _runtime;
|
||||
private readonly IMigrationBuilder _migrationBuilder;
|
||||
private readonly IKeyValueService _keyValueService;
|
||||
@@ -38,7 +40,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
/// </summary>
|
||||
public DatabaseBuilder(
|
||||
IScopeProvider scopeProvider,
|
||||
IGlobalSettings globalSettings,
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings,
|
||||
IUmbracoDatabaseFactory databaseFactory,
|
||||
IRuntimeState runtime,
|
||||
ILogger logger,
|
||||
@@ -50,7 +52,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
IConfigManipulator configManipulator)
|
||||
{
|
||||
_scopeProvider = scopeProvider;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
_databaseFactory = databaseFactory;
|
||||
_runtime = runtime;
|
||||
_logger = logger;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using NPoco;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Migrations.Upgrade;
|
||||
using Umbraco.Core.Models;
|
||||
@@ -16,9 +17,9 @@ namespace Umbraco.Core.Migrations.Install
|
||||
private readonly IDatabase _database;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IUmbracoVersion _umbracoVersion;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
public DatabaseDataCreator(IDatabase database, ILogger logger, IUmbracoVersion umbracoVersion, IGlobalSettings globalSettings)
|
||||
public DatabaseDataCreator(IDatabase database, ILogger logger, IUmbracoVersion umbracoVersion, GlobalSettings globalSettings)
|
||||
{
|
||||
_database = database;
|
||||
_logger = logger;
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NPoco;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence;
|
||||
@@ -20,9 +21,9 @@ namespace Umbraco.Core.Migrations.Install
|
||||
private readonly IUmbracoDatabase _database;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IUmbracoVersion _umbracoVersion;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
public DatabaseSchemaCreator(IUmbracoDatabase database, ILogger logger, IUmbracoVersion umbracoVersion, IGlobalSettings globalSettings)
|
||||
public DatabaseSchemaCreator(IUmbracoDatabase database, ILogger logger, IUmbracoVersion umbracoVersion, GlobalSettings globalSettings)
|
||||
{
|
||||
_database = database;
|
||||
_logger = logger;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Semver;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Migrations.Upgrade.Common;
|
||||
using Umbraco.Core.Migrations.Upgrade.V_8_0_0;
|
||||
using Umbraco.Core.Migrations.Upgrade.V_8_0_1;
|
||||
@@ -16,13 +17,13 @@ namespace Umbraco.Core.Migrations.Upgrade
|
||||
public class UmbracoPlan : MigrationPlan
|
||||
{
|
||||
private readonly IUmbracoVersion _umbracoVersion;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private const string InitPrefix = "{init-";
|
||||
private const string InitSuffix = "}";
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UmbracoPlan"/> class.
|
||||
/// </summary>
|
||||
public UmbracoPlan(IUmbracoVersion umbracoVersion, IGlobalSettings globalSettings)
|
||||
public UmbracoPlan(IUmbracoVersion umbracoVersion, GlobalSettings globalSettings)
|
||||
: base(Constants.System.UmbracoUpgradePlanName)
|
||||
{
|
||||
_umbracoVersion = umbracoVersion;
|
||||
|
||||
@@ -13,6 +13,8 @@ using Umbraco.Core.Exceptions;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
@@ -30,13 +32,12 @@ namespace Umbraco.Web.Models.Mapping
|
||||
private readonly IMemberTypeService _memberTypeService;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IShortStringHelper _shortStringHelper;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
|
||||
|
||||
public ContentTypeMapDefinition(CommonMapper commonMapper, PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IFileService fileService,
|
||||
IContentTypeService contentTypeService, IMediaTypeService mediaTypeService, IMemberTypeService memberTypeService,
|
||||
ILogger logger, IShortStringHelper shortStringHelper, IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
ILogger logger, IShortStringHelper shortStringHelper, IOptionsSnapshot<GlobalSettings> globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
_commonMapper = commonMapper;
|
||||
_propertyEditors = propertyEditors;
|
||||
@@ -47,7 +48,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
_memberTypeService = memberTypeService;
|
||||
_logger = logger;
|
||||
_shortStringHelper = shortStringHelper;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ using Umbraco.Web.Actions;
|
||||
using Umbraco.Web.Services;
|
||||
using Umbraco.Core.Media;
|
||||
using Umbraco.Core.Persistence.Dtos;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
@@ -29,13 +31,13 @@ namespace Umbraco.Web.Models.Mapping
|
||||
private readonly ILocalizedTextService _textService;
|
||||
private readonly ActionCollection _actions;
|
||||
private readonly AppCaches _appCaches;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IMediaFileSystem _mediaFileSystem;
|
||||
private readonly IShortStringHelper _shortStringHelper;
|
||||
private readonly IImageUrlGenerator _imageUrlGenerator;
|
||||
|
||||
public UserMapDefinition(ILocalizedTextService textService, IUserService userService, IEntityService entityService, ISectionService sectionService,
|
||||
AppCaches appCaches, ActionCollection actions, IGlobalSettings globalSettings, IMediaFileSystem mediaFileSystem, IShortStringHelper shortStringHelper,
|
||||
AppCaches appCaches, ActionCollection actions, IOptionsSnapshot<GlobalSettings> globalSettings, IMediaFileSystem mediaFileSystem, IShortStringHelper shortStringHelper,
|
||||
IImageUrlGenerator imageUrlGenerator)
|
||||
{
|
||||
_sectionService = sectionService;
|
||||
@@ -44,7 +46,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
_textService = textService;
|
||||
_actions = actions;
|
||||
_appCaches = appCaches;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
_mediaFileSystem = mediaFileSystem;
|
||||
_shortStringHelper = shortStringHelper;
|
||||
_imageUrlGenerator = imageUrlGenerator;
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using Umbraco.Core.Collections;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
@@ -29,7 +30,7 @@ namespace Umbraco.Core.Packaging
|
||||
private readonly PropertyEditorCollection _propertyEditors;
|
||||
private readonly IScopeProvider _scopeProvider;
|
||||
private readonly IShortStringHelper _shortStringHelper;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly ILocalizedTextService _localizedTextService;
|
||||
private readonly IEntityService _entityService;
|
||||
private readonly IContentTypeService _contentTypeService;
|
||||
@@ -37,7 +38,7 @@ namespace Umbraco.Core.Packaging
|
||||
|
||||
public PackageDataInstallation(ILogger logger, IFileService fileService, IMacroService macroService, ILocalizationService localizationService,
|
||||
IDataTypeService dataTypeService, IEntityService entityService, IContentTypeService contentTypeService,
|
||||
IContentService contentService, PropertyEditorCollection propertyEditors, IScopeProvider scopeProvider, IShortStringHelper shortStringHelper, IGlobalSettings globalSettings,
|
||||
IContentService contentService, PropertyEditorCollection propertyEditors, IScopeProvider scopeProvider, IShortStringHelper shortStringHelper, GlobalSettings globalSettings,
|
||||
ILocalizedTextService localizedTextService)
|
||||
{
|
||||
_logger = logger;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Globalization;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence.Dtos;
|
||||
|
||||
@@ -7,7 +8,7 @@ namespace Umbraco.Core.Persistence.Factories
|
||||
{
|
||||
internal static class LanguageFactory
|
||||
{
|
||||
public static ILanguage BuildEntity(IGlobalSettings globalSettings, LanguageDto dto)
|
||||
public static ILanguage BuildEntity(GlobalSettings globalSettings, LanguageDto dto)
|
||||
{
|
||||
var lang = new Language(globalSettings, dto.IsoCode)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Core.Persistence.Dtos;
|
||||
|
||||
@@ -8,7 +9,7 @@ namespace Umbraco.Core.Persistence.Factories
|
||||
{
|
||||
internal static class UserFactory
|
||||
{
|
||||
public static IUser BuildEntity(IGlobalSettings globalSettings, UserDto dto)
|
||||
public static IUser BuildEntity(GlobalSettings globalSettings, UserDto dto)
|
||||
{
|
||||
var guidId = dto.Id.ToGuid();
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.Options;
|
||||
using NPoco;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
@@ -19,14 +21,14 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
/// </summary>
|
||||
internal class LanguageRepository : NPocoRepositoryBase<int, ILanguage>, ILanguageRepository
|
||||
{
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly Dictionary<string, int> _codeIdMap = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly Dictionary<int, string> _idCodeMap = new Dictionary<int, string>();
|
||||
|
||||
public LanguageRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger logger, IGlobalSettings globalSettings)
|
||||
public LanguageRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger logger, IOptionsSnapshot<GlobalSettings> globalSettings)
|
||||
: base(scopeAccessor, cache, logger)
|
||||
{
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
}
|
||||
|
||||
protected override IRepositoryCachePolicy<ILanguage, int> CreateCachePolicy()
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
@@ -14,13 +16,13 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
internal class ScriptRepository : FileRepository<string, IScript>, IScriptRepository
|
||||
{
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
public ScriptRepository(IFileSystems fileSystems, IIOHelper ioHelper, IGlobalSettings globalSettings)
|
||||
public ScriptRepository(IFileSystems fileSystems, IIOHelper ioHelper, IOptionsSnapshot<GlobalSettings> globalSettings)
|
||||
: base(fileSystems.ScriptsFileSystem)
|
||||
{
|
||||
_ioHelper = ioHelper ?? throw new ArgumentNullException(nameof(ioHelper));
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
}
|
||||
|
||||
#region Implementation of IRepository<string,Script>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
@@ -13,13 +15,13 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
internal class StylesheetRepository : FileRepository<string, IStylesheet>, IStylesheetRepository
|
||||
{
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
public StylesheetRepository(IFileSystems fileSystems, IIOHelper ioHelper, IGlobalSettings globalSettings)
|
||||
public StylesheetRepository(IFileSystems fileSystems, IIOHelper ioHelper, IOptionsSnapshot<GlobalSettings> globalSettings)
|
||||
: base(fileSystems.StylesheetsFileSystem)
|
||||
{
|
||||
_ioHelper = ioHelper;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
}
|
||||
|
||||
#region Overrides of FileRepository<string,Stylesheet>
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
internal class UserRepository : NPocoRepositoryBase<int, IUser>, IUserRepository
|
||||
{
|
||||
private readonly IMapperCollection _mapperCollection;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly UserPasswordConfigurationSettings _passwordConfiguration;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private string _passwordConfigJson;
|
||||
@@ -47,10 +47,10 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
AppCaches appCaches,
|
||||
ILogger logger,
|
||||
IMapperCollection mapperCollection,
|
||||
IGlobalSettings globalSettings,
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings,
|
||||
IOptionsSnapshot<UserPasswordConfigurationSettings> passwordConfiguration,
|
||||
IJsonSerializer jsonSerializer)
|
||||
: this(scopeAccessor, appCaches, logger, mapperCollection, globalSettings, passwordConfiguration.Value, jsonSerializer)
|
||||
: this(scopeAccessor, appCaches, logger, mapperCollection, globalSettings.Value, passwordConfiguration.Value, jsonSerializer)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
AppCaches appCaches,
|
||||
ILogger logger,
|
||||
IMapperCollection mapperCollection,
|
||||
IGlobalSettings globalSettings,
|
||||
GlobalSettings globalSettings,
|
||||
UserPasswordConfigurationSettings passwordConfiguration,
|
||||
IJsonSerializer jsonSerializer)
|
||||
: base(scopeAccessor, appCaches, logger)
|
||||
|
||||
@@ -6,6 +6,7 @@ using NPoco;
|
||||
using NPoco.FluentMappings;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence.FaultHandling;
|
||||
using Umbraco.Core.Persistence.Mappers;
|
||||
@@ -28,7 +29,7 @@ namespace Umbraco.Core.Persistence
|
||||
internal class UmbracoDatabaseFactory : DisposableObjectSlim, IUmbracoDatabaseFactory
|
||||
{
|
||||
private readonly IDbProviderFactoryCreator _dbProviderFactoryCreator;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly Lazy<IMapperCollection> _mappers;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
@@ -70,7 +71,7 @@ namespace Umbraco.Core.Persistence
|
||||
/// Initializes a new instance of the <see cref="UmbracoDatabaseFactory"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Used by core runtime.</remarks>
|
||||
public UmbracoDatabaseFactory(ILogger logger, IGlobalSettings globalSettings, IConnectionStrings connectionStrings, Lazy<IMapperCollection> mappers,IDbProviderFactoryCreator dbProviderFactoryCreator)
|
||||
public UmbracoDatabaseFactory(ILogger logger, GlobalSettings globalSettings, ConnectionStrings connectionStrings, Lazy<IMapperCollection> mappers,IDbProviderFactoryCreator dbProviderFactoryCreator)
|
||||
: this(logger, globalSettings, connectionStrings, Constants.System.UmbracoConnectionName, mappers, dbProviderFactoryCreator)
|
||||
{
|
||||
|
||||
@@ -80,7 +81,7 @@ namespace Umbraco.Core.Persistence
|
||||
/// Initializes a new instance of the <see cref="UmbracoDatabaseFactory"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Used by the other ctor and in tests.</remarks>
|
||||
public UmbracoDatabaseFactory(ILogger logger, IGlobalSettings globalSettings, IConnectionStrings connectionStrings, string connectionStringName, Lazy<IMapperCollection> mappers, IDbProviderFactoryCreator dbProviderFactoryCreator)
|
||||
public UmbracoDatabaseFactory(ILogger logger, GlobalSettings globalSettings, ConnectionStrings connectionStrings, string connectionStringName, Lazy<IMapperCollection> mappers, IDbProviderFactoryCreator dbProviderFactoryCreator)
|
||||
{
|
||||
if (connectionStringName == null) throw new ArgumentNullException(nameof(connectionStringName));
|
||||
if (string.IsNullOrWhiteSpace(connectionStringName)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(connectionStringName));
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Core.Models;
|
||||
@@ -24,15 +26,14 @@ namespace Umbraco.Web.Routing
|
||||
{
|
||||
private const string _eventStateKey = "Umbraco.Web.Redirects.RedirectTrackingEventHandler";
|
||||
|
||||
|
||||
private readonly IWebRoutingSettings _webRoutingSettings;
|
||||
private readonly WebRoutingSettings _webRoutingSettings;
|
||||
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
|
||||
private readonly IRedirectUrlService _redirectUrlService;
|
||||
private readonly IVariationContextAccessor _variationContextAccessor;
|
||||
|
||||
public RedirectTrackingComponent(IWebRoutingSettings webRoutingSettings, IPublishedSnapshotAccessor publishedSnapshotAccessor, IRedirectUrlService redirectUrlService, IVariationContextAccessor variationContextAccessor)
|
||||
public RedirectTrackingComponent(IOptionsSnapshot<WebRoutingSettings> webRoutingSettings, IPublishedSnapshotAccessor publishedSnapshotAccessor, IRedirectUrlService redirectUrlService, IVariationContextAccessor variationContextAccessor)
|
||||
{
|
||||
_webRoutingSettings = webRoutingSettings;
|
||||
_webRoutingSettings = webRoutingSettings.Value;
|
||||
_publishedSnapshotAccessor = publishedSnapshotAccessor;
|
||||
_redirectUrlService = redirectUrlService;
|
||||
_variationContextAccessor = variationContextAccessor;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Umbraco.Core.Composing;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace Umbraco.Core.Runtime
|
||||
@@ -7,12 +9,12 @@ namespace Umbraco.Core.Runtime
|
||||
public class CoreInitialComponent : IComponent
|
||||
{
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
public CoreInitialComponent(IIOHelper ioHelper, IGlobalSettings globalSettings)
|
||||
public CoreInitialComponent(IIOHelper ioHelper, IOptionsSnapshot<GlobalSettings> globalSettings)
|
||||
{
|
||||
_ioHelper = ioHelper;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.IO;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Exceptions;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
@@ -26,11 +27,12 @@ namespace Umbraco.Core.Runtime
|
||||
private readonly RuntimeState _state;
|
||||
private readonly IUmbracoBootPermissionChecker _umbracoBootPermissionChecker;
|
||||
private readonly IRequestCache _requestCache;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly IConnectionStrings _connectionStrings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly ConnectionStrings _connectionStrings;
|
||||
|
||||
public CoreRuntime(
|
||||
Configs configs,
|
||||
GlobalSettings globalSettings,
|
||||
ConnectionStrings connectionStrings,
|
||||
IUmbracoVersion umbracoVersion,
|
||||
IIOHelper ioHelper,
|
||||
ILogger logger,
|
||||
@@ -43,8 +45,10 @@ namespace Umbraco.Core.Runtime
|
||||
ITypeFinder typeFinder,
|
||||
IRequestCache requestCache)
|
||||
{
|
||||
_globalSettings = globalSettings;
|
||||
_connectionStrings = connectionStrings;
|
||||
|
||||
IOHelper = ioHelper;
|
||||
Configs = configs;
|
||||
UmbracoVersion = umbracoVersion;
|
||||
Profiler = profiler;
|
||||
HostingEnvironment = hostingEnvironment;
|
||||
@@ -58,14 +62,10 @@ namespace Umbraco.Core.Runtime
|
||||
MainDom = mainDom;
|
||||
TypeFinder = typeFinder;
|
||||
|
||||
_globalSettings = Configs.Global();
|
||||
_connectionStrings = configs.ConnectionStrings();
|
||||
|
||||
|
||||
// runtime state
|
||||
// beware! must use '() => _factory.GetInstance<T>()' and NOT '_factory.GetInstance<T>'
|
||||
// as the second one captures the current value (null) and therefore fails
|
||||
_state = new RuntimeState(Configs.Global(), UmbracoVersion)
|
||||
_state = new RuntimeState(_globalSettings, UmbracoVersion)
|
||||
{
|
||||
Level = RuntimeLevel.Boot
|
||||
};
|
||||
@@ -99,8 +99,8 @@ namespace Umbraco.Core.Runtime
|
||||
/// Gets the <see cref="IIOHelper"/>
|
||||
/// </summary>
|
||||
protected IIOHelper IOHelper { get; }
|
||||
|
||||
protected IHostingEnvironment HostingEnvironment { get; }
|
||||
protected Configs Configs { get; }
|
||||
protected IUmbracoVersion UmbracoVersion { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -179,7 +179,7 @@ namespace Umbraco.Core.Runtime
|
||||
var typeLoader = new TypeLoader(TypeFinder, appCaches.RuntimeCache, new DirectoryInfo(HostingEnvironment.LocalTempPath), ProfilingLogger);
|
||||
|
||||
// create the composition
|
||||
composition = new Composition(register, typeLoader, ProfilingLogger, _state, Configs, IOHelper, appCaches);
|
||||
composition = new Composition(register, typeLoader, ProfilingLogger, _state, IOHelper, appCaches);
|
||||
composition.RegisterEssentials(Logger, Profiler, ProfilingLogger, MainDom, appCaches, databaseFactory, typeLoader, _state, TypeFinder, IOHelper, UmbracoVersion, DbProviderFactoryCreator, HostingEnvironment, BackOfficeInfo);
|
||||
|
||||
// register ourselves (TODO: Should we put this in RegisterEssentials?)
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Security.Cryptography;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence;
|
||||
@@ -31,7 +32,7 @@ namespace Umbraco.Core.Runtime
|
||||
private bool _errorDuringAcquiring;
|
||||
private object _locker = new object();
|
||||
|
||||
public SqlMainDomLock(ILogger logger, IGlobalSettings globalSettings, IConnectionStrings connectionStrings, IDbProviderFactoryCreator dbProviderFactoryCreator, IHostingEnvironment hostingEnvironment)
|
||||
public SqlMainDomLock(ILogger logger, GlobalSettings globalSettings, ConnectionStrings connectionStrings, IDbProviderFactoryCreator dbProviderFactoryCreator, IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
// unique id for our appdomain, this is more unique than the appdomain id which is just an INT counter to its safer
|
||||
_lockId = Guid.NewGuid().ToString();
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Threading;
|
||||
using Semver;
|
||||
using Umbraco.Core.Collections;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Exceptions;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.Logging;
|
||||
@@ -16,13 +17,13 @@ namespace Umbraco.Core
|
||||
/// </summary>
|
||||
public class RuntimeState : IRuntimeState
|
||||
{
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IUmbracoVersion _umbracoVersion;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RuntimeState"/> class.
|
||||
/// </summary>
|
||||
public RuntimeState(IGlobalSettings globalSettings, IUmbracoVersion umbracoVersion)
|
||||
public RuntimeState(GlobalSettings globalSettings, IUmbracoVersion umbracoVersion)
|
||||
{
|
||||
_globalSettings = globalSettings;
|
||||
_umbracoVersion = umbracoVersion;
|
||||
|
||||
@@ -3,8 +3,10 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
@@ -29,7 +31,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
private readonly IPartialViewMacroRepository _partialViewMacroRepository;
|
||||
private readonly IAuditRepository _auditRepository;
|
||||
private readonly IShortStringHelper _shortStringHelper;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
|
||||
private const string PartialViewHeader = "@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage";
|
||||
@@ -38,7 +40,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
public FileService(IScopeProvider uowProvider, ILogger logger, IEventMessagesFactory eventMessagesFactory,
|
||||
IStylesheetRepository stylesheetRepository, IScriptRepository scriptRepository, ITemplateRepository templateRepository,
|
||||
IPartialViewRepository partialViewRepository, IPartialViewMacroRepository partialViewMacroRepository,
|
||||
IAuditRepository auditRepository, IShortStringHelper shortStringHelper, IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
IAuditRepository auditRepository, IShortStringHelper shortStringHelper, IOptionsSnapshot<GlobalSettings> globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
: base(uowProvider, logger, eventMessagesFactory)
|
||||
{
|
||||
_stylesheetRepository = stylesheetRepository;
|
||||
@@ -48,7 +50,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
_partialViewMacroRepository = partialViewMacroRepository;
|
||||
_auditRepository = auditRepository;
|
||||
_shortStringHelper = shortStringHelper;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,19 +26,19 @@ namespace Umbraco.Core.Services.Implement
|
||||
private readonly IContentService _contentService;
|
||||
private readonly ILocalizationService _localizationService;
|
||||
private readonly INotificationsRepository _notificationsRepository;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly ContentSettings _contentSettings;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
|
||||
public NotificationService(IScopeProvider provider, IUserService userService, IContentService contentService, ILocalizationService localizationService,
|
||||
ILogger logger, IIOHelper ioHelper, INotificationsRepository notificationsRepository, IGlobalSettings globalSettings, IOptionsSnapshot<ContentSettings> contentSettings)
|
||||
: this(provider, userService, contentService, localizationService, logger, ioHelper, notificationsRepository, globalSettings, contentSettings.Value)
|
||||
ILogger logger, IIOHelper ioHelper, INotificationsRepository notificationsRepository, IOptionsSnapshot<GlobalSettings> globalSettings, IOptionsSnapshot<ContentSettings> contentSettings)
|
||||
: this(provider, userService, contentService, localizationService, logger, ioHelper, notificationsRepository, globalSettings.Value, contentSettings.Value)
|
||||
{
|
||||
}
|
||||
|
||||
public NotificationService(IScopeProvider provider, IUserService userService, IContentService contentService, ILocalizationService localizationService,
|
||||
ILogger logger, IIOHelper ioHelper, INotificationsRepository notificationsRepository, IGlobalSettings globalSettings, ContentSettings contentSettings)
|
||||
ILogger logger, IIOHelper ioHelper, INotificationsRepository notificationsRepository, GlobalSettings globalSettings, ContentSettings contentSettings)
|
||||
{
|
||||
_notificationsRepository = notificationsRepository;
|
||||
_globalSettings = globalSettings;
|
||||
|
||||
@@ -4,7 +4,9 @@ using System.Data.Common;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
@@ -22,16 +24,16 @@ namespace Umbraco.Core.Services.Implement
|
||||
{
|
||||
private readonly IUserRepository _userRepository;
|
||||
private readonly IUserGroupRepository _userGroupRepository;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly bool _isUpgrading;
|
||||
|
||||
public UserService(IScopeProvider provider, ILogger logger, IEventMessagesFactory eventMessagesFactory, IRuntimeState runtimeState,
|
||||
IUserRepository userRepository, IUserGroupRepository userGroupRepository, IGlobalSettings globalSettings)
|
||||
IUserRepository userRepository, IUserGroupRepository userGroupRepository, IOptionsSnapshot<GlobalSettings> globalSettings)
|
||||
: base(provider, logger, eventMessagesFactory)
|
||||
{
|
||||
_userRepository = userRepository;
|
||||
_userGroupRepository = userGroupRepository;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
_isUpgrading = runtimeState.Level == RuntimeLevel.Install || runtimeState.Level == RuntimeLevel.Upgrade;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
using System.Linq;
|
||||
using System.Net.Mail;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Options;
|
||||
using MimeKit;
|
||||
using MimeKit.Text;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Events;
|
||||
using SmtpClient = MailKit.Net.Smtp.SmtpClient;
|
||||
|
||||
@@ -17,14 +19,23 @@ namespace Umbraco.Core
|
||||
{
|
||||
// TODO: This should encapsulate a BackgroundTaskRunner with a queue to send these emails!
|
||||
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly bool _enableEvents;
|
||||
|
||||
public EmailSender(IGlobalSettings globalSettings) : this(globalSettings, false)
|
||||
public EmailSender(IOptionsSnapshot<GlobalSettings> globalSettings) : this(globalSettings, false)
|
||||
{
|
||||
}
|
||||
|
||||
public EmailSender(IGlobalSettings globalSettings, bool enableEvents)
|
||||
public EmailSender(IOptionsSnapshot<GlobalSettings> globalSettings, bool enableEvents)
|
||||
: this(globalSettings.Value, enableEvents)
|
||||
{
|
||||
}
|
||||
|
||||
public EmailSender(GlobalSettings globalSettings) : this(globalSettings, false)
|
||||
{
|
||||
}
|
||||
|
||||
public EmailSender(GlobalSettings globalSettings, bool enableEvents)
|
||||
{
|
||||
_globalSettings = globalSettings;
|
||||
_enableEvents = enableEvents;
|
||||
@@ -107,7 +118,7 @@ namespace Umbraco.Core
|
||||
/// <remarks>
|
||||
/// We assume this is possible if either an event handler is registered or an smtp server is configured
|
||||
/// </remarks>
|
||||
public static bool CanSendRequiredEmail(IGlobalSettings globalSettings) => EventHandlerRegistered || globalSettings.IsSmtpServerConfigured;
|
||||
public static bool CanSendRequiredEmail(GlobalSettings globalSettings) => EventHandlerRegistered || globalSettings.IsSmtpServerConfigured;
|
||||
|
||||
/// <summary>
|
||||
/// returns true if an event handler has been registered
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
@@ -31,7 +32,7 @@ namespace Umbraco.Web.WebAssets
|
||||
/// <param name="globalSettings"></param>
|
||||
/// <param name="hostingEnvironment"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetJavascriptInitialization(IEnumerable<string> scripts, string angularModule, IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
public static string GetJavascriptInitialization(IEnumerable<string> scripts, string angularModule, GlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
var jarray = new StringBuilder();
|
||||
jarray.AppendLine("[");
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Manifest;
|
||||
@@ -25,7 +27,7 @@ namespace Umbraco.Web.WebAssets
|
||||
|
||||
private readonly IRuntimeMinifier _runtimeMinifier;
|
||||
private readonly IManifestParser _parser;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
private readonly PropertyEditorCollection _propertyEditorCollection;
|
||||
|
||||
@@ -34,13 +36,13 @@ namespace Umbraco.Web.WebAssets
|
||||
IManifestParser parser,
|
||||
PropertyEditorCollection propertyEditorCollection,
|
||||
IHostingEnvironment hostingEnvironment,
|
||||
IGlobalSettings globalSettings)
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings)
|
||||
{
|
||||
_runtimeMinifier = runtimeMinifier;
|
||||
_parser = parser;
|
||||
_propertyEditorCollection = propertyEditorCollection;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
}
|
||||
|
||||
public void CreateBundles()
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.WebAssets;
|
||||
@@ -15,7 +16,7 @@ namespace Umbraco.Web.WebAssets
|
||||
/// Returns the JavaScript to load the back office's assets
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static async Task<string> GetScriptForLoadingBackOfficeAsync(this IRuntimeMinifier minifier, IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
public static async Task<string> GetScriptForLoadingBackOfficeAsync(this IRuntimeMinifier minifier, GlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
var files = await minifier.GetAssetPathsAsync(BackOfficeWebAssets.UmbracoJsBundleName);
|
||||
var result = BackOfficeJavaScriptInitializer.GetJavascriptInitialization(files, "umbraco", globalSettings, hostingEnvironment);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Umbraco.Core.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
|
||||
namespace Umbraco.ModelsBuilder.Embedded.BackOffice
|
||||
@@ -10,7 +11,7 @@ namespace Umbraco.ModelsBuilder.Embedded.BackOffice
|
||||
// ReSharper disable once UnusedMember.Global - This is typed scanned
|
||||
public class ContentTypeModelValidator : ContentTypeModelValidatorBase<DocumentTypeSave, PropertyTypeBasic>
|
||||
{
|
||||
public ContentTypeModelValidator(IModelsBuilderConfig config) : base(config)
|
||||
public ContentTypeModelValidator(IOptionsSnapshot<ModelsBuilderConfig> config) : base(config)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Web.Editors;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
@@ -13,11 +14,11 @@ namespace Umbraco.ModelsBuilder.Embedded.BackOffice
|
||||
where TModel : ContentTypeSave<TProperty>
|
||||
where TProperty : PropertyTypeBasic
|
||||
{
|
||||
private readonly IModelsBuilderConfig _config;
|
||||
private readonly ModelsBuilderConfig _config;
|
||||
|
||||
public ContentTypeModelValidatorBase(IModelsBuilderConfig config)
|
||||
public ContentTypeModelValidatorBase(IOptionsSnapshot<ModelsBuilderConfig> config)
|
||||
{
|
||||
_config = config;
|
||||
_config = config.Value;
|
||||
}
|
||||
|
||||
protected override IEnumerable<ValidationResult> Validate(TModel model)
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
using System.Text;
|
||||
using Umbraco.Configuration;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
|
||||
namespace Umbraco.ModelsBuilder.Embedded.BackOffice
|
||||
{
|
||||
internal class DashboardReport
|
||||
{
|
||||
private readonly IModelsBuilderConfig _config;
|
||||
private readonly ModelsBuilderConfig _config;
|
||||
private readonly OutOfDateModelsStatus _outOfDateModels;
|
||||
private readonly ModelsGenerationError _mbErrors;
|
||||
|
||||
public DashboardReport(IModelsBuilderConfig config, OutOfDateModelsStatus outOfDateModels, ModelsGenerationError mbErrors)
|
||||
public DashboardReport(ModelsBuilderConfig config, OutOfDateModelsStatus outOfDateModels, ModelsGenerationError mbErrors)
|
||||
{
|
||||
_config = config;
|
||||
_outOfDateModels = outOfDateModels;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Umbraco.Core.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
|
||||
namespace Umbraco.ModelsBuilder.Embedded.BackOffice
|
||||
@@ -10,7 +11,7 @@ namespace Umbraco.ModelsBuilder.Embedded.BackOffice
|
||||
// ReSharper disable once UnusedMember.Global - This is typed scanned
|
||||
public class MediaTypeModelValidator : ContentTypeModelValidatorBase<MediaTypeSave, PropertyTypeBasic>
|
||||
{
|
||||
public MediaTypeModelValidator(IModelsBuilderConfig config) : base(config)
|
||||
public MediaTypeModelValidator(IOptionsSnapshot<ModelsBuilderConfig> config) : base(config)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web.Hosting;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Configuration;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Exceptions;
|
||||
using Umbraco.ModelsBuilder.Embedded.Building;
|
||||
using Umbraco.Web.Editors;
|
||||
@@ -23,20 +25,20 @@ namespace Umbraco.ModelsBuilder.Embedded.BackOffice
|
||||
[UmbracoApplicationAuthorize(Core.Constants.Applications.Settings)]
|
||||
public class ModelsBuilderDashboardController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
private readonly IModelsBuilderConfig _config;
|
||||
private readonly ModelsBuilderConfig _config;
|
||||
private readonly ModelsGenerator _modelGenerator;
|
||||
private readonly OutOfDateModelsStatus _outOfDateModels;
|
||||
private readonly ModelsGenerationError _mbErrors;
|
||||
private readonly DashboardReport _dashboardReport;
|
||||
|
||||
public ModelsBuilderDashboardController(IModelsBuilderConfig config, ModelsGenerator modelsGenerator, OutOfDateModelsStatus outOfDateModels, ModelsGenerationError mbErrors)
|
||||
public ModelsBuilderDashboardController(IOptionsSnapshot<ModelsBuilderConfig> config, ModelsGenerator modelsGenerator, OutOfDateModelsStatus outOfDateModels, ModelsGenerationError mbErrors)
|
||||
{
|
||||
//_umbracoServices = umbracoServices;
|
||||
_config = config;
|
||||
_config = config.Value;
|
||||
_modelGenerator = modelsGenerator;
|
||||
_outOfDateModels = outOfDateModels;
|
||||
_mbErrors = mbErrors;
|
||||
_dashboardReport = new DashboardReport(config, outOfDateModels, mbErrors);
|
||||
_dashboardReport = new DashboardReport(_config, outOfDateModels, mbErrors);
|
||||
}
|
||||
|
||||
// invoked by the dashboard
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
|
||||
namespace Umbraco.ModelsBuilder.Embedded.Building
|
||||
{
|
||||
@@ -70,7 +71,7 @@ namespace Umbraco.ModelsBuilder.Embedded.Building
|
||||
/// </summary>
|
||||
/// <param name="typeModels">The list of models to generate.</param>
|
||||
/// <param name="modelsNamespace">The models namespace.</param>
|
||||
protected Builder(IModelsBuilderConfig config, IList<TypeModel> typeModels)
|
||||
protected Builder(ModelsBuilderConfig config, IList<TypeModel> typeModels)
|
||||
{
|
||||
_typeModels = typeModels ?? throw new ArgumentNullException(nameof(typeModels));
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace Umbraco.ModelsBuilder.Embedded.Building
|
||||
@@ -8,11 +9,11 @@ namespace Umbraco.ModelsBuilder.Embedded.Building
|
||||
public class ModelsGenerator
|
||||
{
|
||||
private readonly UmbracoServices _umbracoService;
|
||||
private readonly IModelsBuilderConfig _config;
|
||||
private readonly ModelsBuilderConfig _config;
|
||||
private readonly OutOfDateModelsStatus _outOfDateModels;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
|
||||
public ModelsGenerator(UmbracoServices umbracoService, IModelsBuilderConfig config, OutOfDateModelsStatus outOfDateModels, IIOHelper ioHelper)
|
||||
public ModelsGenerator(UmbracoServices umbracoService, ModelsBuilderConfig config, OutOfDateModelsStatus outOfDateModels, IIOHelper ioHelper)
|
||||
{
|
||||
_umbracoService = umbracoService;
|
||||
_config = config;
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
|
||||
namespace Umbraco.ModelsBuilder.Embedded.Building
|
||||
{
|
||||
@@ -17,7 +17,7 @@ namespace Umbraco.ModelsBuilder.Embedded.Building
|
||||
/// and the result of code parsing.
|
||||
/// </summary>
|
||||
/// <param name="typeModels">The list of models to generate.</param>
|
||||
public TextBuilder(IModelsBuilderConfig config, IList<TypeModel> typeModels)
|
||||
public TextBuilder(ModelsBuilderConfig config, IList<TypeModel> typeModels)
|
||||
: base(config, typeModels)
|
||||
{ }
|
||||
|
||||
|
||||
@@ -15,19 +15,21 @@ using Umbraco.ModelsBuilder.Embedded.BackOffice;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.WebAssets;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.ModelsBuilder.Embedded.Compose
|
||||
{
|
||||
internal class ModelsBuilderComponent : IComponent
|
||||
{
|
||||
private readonly IModelsBuilderConfig _config;
|
||||
private readonly ModelsBuilderConfig _config;
|
||||
private readonly IShortStringHelper _shortStringHelper;
|
||||
private readonly LiveModelsProvider _liveModelsProvider;
|
||||
private readonly OutOfDateModelsStatus _outOfDateModels;
|
||||
|
||||
public ModelsBuilderComponent(IModelsBuilderConfig config, IShortStringHelper shortStringHelper, LiveModelsProvider liveModelsProvider, OutOfDateModelsStatus outOfDateModels)
|
||||
public ModelsBuilderComponent(IOptionsSnapshot<ModelsBuilderConfig> config, IShortStringHelper shortStringHelper, LiveModelsProvider liveModelsProvider, OutOfDateModelsStatus outOfDateModels)
|
||||
{
|
||||
_config = config;
|
||||
_config = config.Value;
|
||||
_shortStringHelper = shortStringHelper;
|
||||
_liveModelsProvider = liveModelsProvider;
|
||||
_outOfDateModels = outOfDateModels;
|
||||
|
||||
@@ -6,6 +6,7 @@ using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.ModelsBuilder.Embedded.Building;
|
||||
using Umbraco.Web.Cache;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
|
||||
namespace Umbraco.ModelsBuilder.Embedded
|
||||
{
|
||||
@@ -15,7 +16,7 @@ namespace Umbraco.ModelsBuilder.Embedded
|
||||
private static Mutex _mutex;
|
||||
private static int _req;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IModelsBuilderConfig _config;
|
||||
private readonly ModelsBuilderConfig _config;
|
||||
private readonly ModelsGenerator _modelGenerator;
|
||||
private readonly ModelsGenerationError _mbErrors;
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
@@ -23,7 +24,7 @@ namespace Umbraco.ModelsBuilder.Embedded
|
||||
// we do not manage pure live here
|
||||
internal bool IsEnabled => _config.ModelsMode.IsLiveNotPure();
|
||||
|
||||
public LiveModelsProvider(ILogger logger, IModelsBuilderConfig config, ModelsGenerator modelGenerator, ModelsGenerationError mbErrors, IHostingEnvironment hostingEnvironment)
|
||||
public LiveModelsProvider(ILogger logger, ModelsBuilderConfig config, ModelsGenerator modelGenerator, ModelsGenerationError mbErrors, IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
_logger = logger;
|
||||
_config = config ?? throw new ArgumentNullException(nameof(config));
|
||||
|
||||
@@ -2,16 +2,17 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace Umbraco.ModelsBuilder.Embedded
|
||||
{
|
||||
public sealed class ModelsGenerationError
|
||||
{
|
||||
private readonly IModelsBuilderConfig _config;
|
||||
private readonly ModelsBuilderConfig _config;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
|
||||
public ModelsGenerationError(IModelsBuilderConfig config, IIOHelper ioHelper)
|
||||
public ModelsGenerationError(ModelsBuilderConfig config, IIOHelper ioHelper)
|
||||
{
|
||||
_config = config;
|
||||
_ioHelper = ioHelper;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.IO;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Web.Cache;
|
||||
|
||||
@@ -7,10 +8,10 @@ namespace Umbraco.ModelsBuilder.Embedded
|
||||
{
|
||||
public sealed class OutOfDateModelsStatus
|
||||
{
|
||||
private readonly IModelsBuilderConfig _config;
|
||||
private readonly ModelsBuilderConfig _config;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
|
||||
public OutOfDateModelsStatus(IModelsBuilderConfig config, IIOHelper ioHelper)
|
||||
public OutOfDateModelsStatus(ModelsBuilderConfig config, IIOHelper ioHelper)
|
||||
{
|
||||
_config = config;
|
||||
_ioHelper = ioHelper;
|
||||
|
||||
@@ -19,6 +19,8 @@ using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.ModelsBuilder.Embedded.Building;
|
||||
using File = System.IO.File;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.ModelsBuilder.Embedded
|
||||
{
|
||||
@@ -41,7 +43,7 @@ namespace Umbraco.ModelsBuilder.Embedded
|
||||
private const string ProjVirt = "~/App_Data/Models/all.generated.cs";
|
||||
private static readonly string[] OurFiles = { "models.hash", "models.generated.cs", "all.generated.cs", "all.dll.path", "models.err" };
|
||||
|
||||
private readonly IModelsBuilderConfig _config;
|
||||
private readonly ModelsBuilderConfig _config;
|
||||
private readonly IApplicationShutdownRegistry _hostingLifetime;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly ModelsGenerationError _errors;
|
||||
@@ -49,7 +51,7 @@ namespace Umbraco.ModelsBuilder.Embedded
|
||||
public PureLiveModelFactory(
|
||||
Lazy<UmbracoServices> umbracoServices,
|
||||
IProfilingLogger logger,
|
||||
IModelsBuilderConfig config,
|
||||
IOptionsSnapshot<ModelsBuilderConfig> config,
|
||||
IHostingEnvironment hostingEnvironment,
|
||||
IApplicationShutdownRegistry hostingLifetime,
|
||||
IIOHelper ioHelper)
|
||||
|
||||
@@ -3,9 +3,11 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Xml.XPath;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Xml;
|
||||
using Umbraco.Core.Xml.XPath;
|
||||
@@ -19,7 +21,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
private readonly IAppCache _snapshotCache;
|
||||
private readonly IAppCache _elementsCache;
|
||||
private readonly IDomainCache _domainCache;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IVariationContextAccessor _variationContextAccessor;
|
||||
|
||||
#region Constructor
|
||||
@@ -29,7 +31,12 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
// it's too late for UmbracoContext which has captured previewDefault and stuff into these ctor vars
|
||||
// but, no, UmbracoContext returns snapshot.Content which comes from elements SO a resync should create a new cache
|
||||
|
||||
public ContentCache(bool previewDefault, ContentStore.Snapshot snapshot, IAppCache snapshotCache, IAppCache elementsCache, IDomainCache domainCache, IGlobalSettings globalSettings, IVariationContextAccessor variationContextAccessor)
|
||||
public ContentCache(bool previewDefault, ContentStore.Snapshot snapshot, IAppCache snapshotCache, IAppCache elementsCache, IDomainCache domainCache, IOptionsSnapshot<GlobalSettings> globalSettings, IVariationContextAccessor variationContextAccessor)
|
||||
: this(previewDefault, snapshot, snapshotCache, elementsCache, domainCache, globalSettings.Value, variationContextAccessor)
|
||||
{
|
||||
}
|
||||
|
||||
public ContentCache(bool previewDefault, ContentStore.Snapshot snapshot, IAppCache snapshotCache, IAppCache elementsCache, IDomainCache domainCache, GlobalSettings globalSettings, IVariationContextAccessor variationContextAccessor)
|
||||
: base(previewDefault)
|
||||
{
|
||||
_snapshot = snapshot;
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
using CSharpTest.Net.Collections;
|
||||
using CSharpTest.Net.Serialization;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
|
||||
namespace Umbraco.Web.PublishedCache.NuCache.DataSource
|
||||
{
|
||||
internal class BTree
|
||||
{
|
||||
public static BPlusTree<int, ContentNodeKit> GetTree(string filepath, bool exists, INuCacheSettings settings)
|
||||
public static BPlusTree<int, ContentNodeKit> GetTree(string filepath, bool exists, NuCacheSettings settings)
|
||||
{
|
||||
var keySerializer = new PrimitiveSerializer();
|
||||
var valueSerializer = new ContentNodeKitSerializer();
|
||||
@@ -22,7 +23,6 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource
|
||||
// default is 4096, min 2^9 = 512, max 2^16 = 64K
|
||||
FileBlockSize = GetBlockSize(settings),
|
||||
|
||||
|
||||
//HACK: Forces FileOptions to be WriteThrough here: https://github.com/mamift/CSharpTest.Net.Collections/blob/9f93733b3af7ee0e2de353e822ff54d908209b0b/src/CSharpTest.Net.Collections/IO/TransactedCompoundFile.cs#L316-L327,
|
||||
// as the reflection uses otherwise will failed in .NET Core as the "_handle" field in FileStream is renamed to "_fileHandle".
|
||||
StoragePerformance = StoragePerformance.CommitToDisk,
|
||||
@@ -40,7 +40,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource
|
||||
return tree;
|
||||
}
|
||||
|
||||
private static int GetBlockSize(INuCacheSettings settings)
|
||||
private static int GetBlockSize(NuCacheSettings settings)
|
||||
{
|
||||
var blockSize = 4096;
|
||||
|
||||
|
||||
@@ -6,11 +6,13 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CSharpTest.Net.Collections;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.Install;
|
||||
using Umbraco.Core.IO;
|
||||
@@ -45,7 +47,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
private readonly IDocumentRepository _documentRepository;
|
||||
private readonly IMediaRepository _mediaRepository;
|
||||
private readonly IMemberRepository _memberRepository;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IEntityXmlSerializer _entitySerializer;
|
||||
private readonly IPublishedModelFactory _publishedModelFactory;
|
||||
private readonly IDefaultCultureAccessor _defaultCultureAccessor;
|
||||
@@ -53,7 +55,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
private readonly IShortStringHelper _shortStringHelper;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly INuCacheSettings _config;
|
||||
private readonly NuCacheSettings _config;
|
||||
|
||||
// volatile because we read it with no lock
|
||||
private volatile bool _isReady;
|
||||
@@ -84,14 +86,15 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor, IProfilingLogger logger, IScopeProvider scopeProvider,
|
||||
IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository,
|
||||
IDefaultCultureAccessor defaultCultureAccessor,
|
||||
IDataSource dataSource, IGlobalSettings globalSettings,
|
||||
IDataSource dataSource,
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings,
|
||||
IEntityXmlSerializer entitySerializer,
|
||||
IPublishedModelFactory publishedModelFactory,
|
||||
UrlSegmentProviderCollection urlSegmentProviders,
|
||||
IHostingEnvironment hostingEnvironment,
|
||||
IShortStringHelper shortStringHelper,
|
||||
IIOHelper ioHelper,
|
||||
INuCacheSettings config)
|
||||
IOptionsSnapshot<NuCacheSettings> config)
|
||||
: base(publishedSnapshotAccessor, variationContextAccessor)
|
||||
{
|
||||
//if (Interlocked.Increment(ref _singletonCheck) > 1)
|
||||
@@ -106,12 +109,12 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
_mediaRepository = mediaRepository;
|
||||
_memberRepository = memberRepository;
|
||||
_defaultCultureAccessor = defaultCultureAccessor;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
_urlSegmentProviders = urlSegmentProviders;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
_shortStringHelper = shortStringHelper;
|
||||
_ioHelper = ioHelper;
|
||||
_config = config;
|
||||
_config = config.Value;
|
||||
|
||||
// we need an Xml serializer here so that the member cache can support XPath,
|
||||
// for members this is done by navigating the serialized-to-xml member
|
||||
|
||||
@@ -3,7 +3,7 @@ using Moq;
|
||||
using Semver;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Legacy;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
@@ -16,25 +16,23 @@ namespace Umbraco.Tests.Common
|
||||
{
|
||||
}
|
||||
|
||||
public IGlobalSettings GenerateMockGlobalSettings(IUmbracoVersion umbVersion = null)
|
||||
public GlobalSettings GenerateStubGlobalSettings(IUmbracoVersion umbVersion = null)
|
||||
{
|
||||
var semanticVersion = umbVersion?.SemanticVersion ?? new SemVersion(9);
|
||||
|
||||
var config = Mock.Of<IGlobalSettings>(
|
||||
settings =>
|
||||
settings.UseHttps == false &&
|
||||
settings.HideTopLevelNodeFromPath == false &&
|
||||
settings.TimeOutInMinutes == 20 &&
|
||||
settings.DefaultUILanguage == "en" &&
|
||||
settings.ReservedPaths == (GlobalSettings.StaticReservedPaths + "~/umbraco") &&
|
||||
settings.ReservedUrls == GlobalSettings.StaticReservedUrls &&
|
||||
settings.UmbracoPath == "~/umbraco" &&
|
||||
settings.UmbracoMediaPath == "~/media" &&
|
||||
settings.UmbracoCssPath == "~/css" &&
|
||||
settings.UmbracoScriptsPath == "~/scripts"
|
||||
);
|
||||
|
||||
|
||||
var config = new GlobalSettings
|
||||
{
|
||||
UseHttps = false,
|
||||
HideTopLevelNodeFromPath = false,
|
||||
TimeOutInMinutes = 20,
|
||||
DefaultUILanguage = "en",
|
||||
ReservedPaths = (GlobalSettings.StaticReservedPaths + "~/umbraco"),
|
||||
ReservedUrls = GlobalSettings.StaticReservedUrls,
|
||||
UmbracoPath = "~/umbraco",
|
||||
UmbracoMediaPath = "~/media",
|
||||
UmbracoCssPath = "~/css",
|
||||
UmbracoScriptsPath = "~/scripts",
|
||||
};
|
||||
|
||||
return config;
|
||||
}
|
||||
@@ -104,15 +102,15 @@ namespace Umbraco.Tests.Common
|
||||
_defaultHostingSettings = null;
|
||||
}
|
||||
|
||||
private readonly Dictionary<SemVersion, IGlobalSettings> _defaultGlobalSettings = new Dictionary<SemVersion, IGlobalSettings>();
|
||||
private readonly Dictionary<SemVersion, GlobalSettings> _defaultGlobalSettings = new Dictionary<SemVersion, GlobalSettings>();
|
||||
private IHostingSettings _defaultHostingSettings;
|
||||
|
||||
public IGlobalSettings GetDefaultGlobalSettings(IUmbracoVersion umbVersion)
|
||||
public GlobalSettings GetDefaultGlobalSettings(IUmbracoVersion umbVersion)
|
||||
{
|
||||
if (_defaultGlobalSettings.TryGetValue(umbVersion.SemanticVersion, out var settings))
|
||||
return settings;
|
||||
|
||||
settings = GenerateMockGlobalSettings(umbVersion);
|
||||
settings = GenerateStubGlobalSettings(umbVersion);
|
||||
_defaultGlobalSettings[umbVersion.SemanticVersion] = settings;
|
||||
return settings;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Umbraco.Tests.Common
|
||||
get
|
||||
{
|
||||
if (_ioHelper == null)
|
||||
_ioHelper = new IOHelper(GetHostingEnvironment(), SettingsForTests.GenerateMockGlobalSettings());
|
||||
_ioHelper = new IOHelper(GetHostingEnvironment(), SettingsForTests.GenerateStubGlobalSettings());
|
||||
return _ioHelper;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Web.Common.AspNetCore;
|
||||
using IHostingEnvironment = Umbraco.Core.Hosting.IHostingEnvironment;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Umbraco.Tests.Integration.Implementations
|
||||
|
||||
public class TestHostingEnvironment : AspNetCoreHostingEnvironment, IHostingEnvironment
|
||||
{
|
||||
public TestHostingEnvironment(IHostingSettings hostingSettings, IWebHostEnvironment webHostEnvironment)
|
||||
public TestHostingEnvironment(IOptionsSnapshot<HostingSettings> hostingSettings, IWebHostEnvironment webHostEnvironment)
|
||||
: base(hostingSettings, webHostEnvironment)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Umbraco.Tests.Security
|
||||
var testHelper = new TestHelper();
|
||||
|
||||
var httpContextAccessor = testHelper.GetHttpContextAccessor();
|
||||
var globalSettings = testHelper.SettingsForTests.GenerateMockGlobalSettings();
|
||||
var globalSettings = testHelper.SettingsForTests.GenerateStubGlobalSettings();
|
||||
|
||||
var runtime = Mock.Of<IRuntimeState>(x => x.Level == RuntimeLevel.Install);
|
||||
var mgr = new BackOfficeCookieManager(
|
||||
@@ -50,7 +50,7 @@ namespace Umbraco.Tests.Security
|
||||
//hostingEnvironment.ToAbsolute(globalSettings.UmbracoPath);
|
||||
|
||||
var httpContextAccessor = testHelper.GetHttpContextAccessor();
|
||||
var globalSettings = testHelper.SettingsForTests.GenerateMockGlobalSettings();
|
||||
var globalSettings = testHelper.SettingsForTests.GenerateStubGlobalSettings();
|
||||
|
||||
var runtime = Mock.Of<IRuntimeState>(x => x.Level == RuntimeLevel.Run);
|
||||
var mgr = new BackOfficeCookieManager(
|
||||
@@ -72,7 +72,7 @@ namespace Umbraco.Tests.Security
|
||||
var testHelper = new TestHelper();
|
||||
|
||||
var httpContextAccessor = testHelper.GetHttpContextAccessor();
|
||||
var globalSettings = testHelper.SettingsForTests.GenerateMockGlobalSettings();
|
||||
var globalSettings = testHelper.SettingsForTests.GenerateStubGlobalSettings();
|
||||
|
||||
var runtime = Mock.Of<IRuntimeState>(x => x.Level == RuntimeLevel.Run);
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Umbraco.Tests.Security
|
||||
var testHelper = new TestHelper();
|
||||
|
||||
var httpContextAccessor = testHelper.GetHttpContextAccessor();
|
||||
var globalSettings = testHelper.SettingsForTests.GenerateMockGlobalSettings();
|
||||
var globalSettings = testHelper.SettingsForTests.GenerateStubGlobalSettings();
|
||||
|
||||
var runtime = Mock.Of<IRuntimeState>(x => x.Level == RuntimeLevel.Run);
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Umbraco.Tests.Security
|
||||
var testHelper = new TestHelper();
|
||||
|
||||
var httpContextAccessor = testHelper.GetHttpContextAccessor();
|
||||
var globalSettings = testHelper.SettingsForTests.GenerateMockGlobalSettings();
|
||||
var globalSettings = testHelper.SettingsForTests.GenerateStubGlobalSettings();
|
||||
|
||||
var runtime = Mock.Of<IRuntimeState>(x => x.Level == RuntimeLevel.Run);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Extensions
|
||||
{
|
||||
_settingsForTests = new SettingsForTests();
|
||||
_hostEnvironment = Mock.Of<IWebHostEnvironment>();
|
||||
_globalSettings = _settingsForTests.GenerateMockGlobalSettings();
|
||||
_globalSettings = _settingsForTests.GenerateStubGlobalSettings();
|
||||
}
|
||||
|
||||
private SettingsForTests _settingsForTests;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
|
||||
namespace Umbraco.Tests.TestHelpers
|
||||
@@ -7,7 +8,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
{
|
||||
private static Common.SettingsForTests _settingsForTests = new Common.SettingsForTests();
|
||||
|
||||
public static IGlobalSettings GenerateMockGlobalSettings() => _settingsForTests.GenerateMockGlobalSettings(TestHelper.GetUmbracoVersion());
|
||||
public static IGlobalSettings GenerateMockGlobalSettings() => _settingsForTests.GenerateStubGlobalSettings(TestHelper.GetUmbracoVersion());
|
||||
|
||||
/// <summary>
|
||||
/// Returns generated settings which can be stubbed to return whatever values necessary
|
||||
@@ -45,7 +46,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
|
||||
public static void Reset() => _settingsForTests.Reset();
|
||||
|
||||
internal static IGlobalSettings DefaultGlobalSettings => _settingsForTests.GetDefaultGlobalSettings(TestHelper.GetUmbracoVersion());
|
||||
internal static GlobalSettings DefaultGlobalSettings => _settingsForTests.GetDefaultGlobalSettings(TestHelper.GetUmbracoVersion());
|
||||
|
||||
internal static IHostingSettings DefaultHostingSettings => _settingsForTests.DefaultHostingSettings;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
|
||||
public override IBackOfficeInfo GetBackOfficeInfo()
|
||||
=> new AspNetBackOfficeInfo(
|
||||
SettingsForTests.GenerateMockGlobalSettings(GetUmbracoVersion()),
|
||||
SettingsForTests.GenerateStubGlobalSettings(GetUmbracoVersion()),
|
||||
TestHelper.IOHelper, Mock.Of<ILogger>(), SettingsForTests.GenerateMockWebRoutingSettings());
|
||||
|
||||
public override IHostingEnvironment GetHostingEnvironment()
|
||||
|
||||
@@ -8,6 +8,7 @@ using Moq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
@@ -136,10 +137,11 @@ namespace Umbraco.Tests.TestHelpers
|
||||
return umbracoContextFactory.EnsureUmbracoContext().UmbracoContext;
|
||||
}
|
||||
|
||||
public IGlobalSettings GetGlobalSettings()
|
||||
public GlobalSettings GetGlobalSettings()
|
||||
{
|
||||
return SettingsForTests.DefaultGlobalSettings;
|
||||
}
|
||||
|
||||
public IFileSystems GetFileSystemsMock()
|
||||
{
|
||||
var fileSystems = Mock.Of<IFileSystems>();
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
private readonly IUserService _userService;
|
||||
private readonly ILocalizedTextService _textService;
|
||||
private readonly UmbracoMapper _umbracoMapper;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly SecuritySettings _securitySettings;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IIpResolver _ipResolver;
|
||||
@@ -64,7 +64,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
IUserService userService,
|
||||
ILocalizedTextService textService,
|
||||
UmbracoMapper umbracoMapper,
|
||||
IGlobalSettings globalSettings,
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings,
|
||||
IOptionsSnapshot<SecuritySettings> securitySettings,
|
||||
ILogger logger,
|
||||
IIpResolver ipResolver,
|
||||
@@ -79,7 +79,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
_userService = userService;
|
||||
_textService = textService;
|
||||
_umbracoMapper = umbracoMapper;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
_securitySettings = securitySettings.Value;
|
||||
_logger = logger;
|
||||
_ipResolver = ipResolver;
|
||||
|
||||
@@ -3,8 +3,10 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
@@ -17,9 +19,9 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
{
|
||||
private readonly IFileSystem _jsLibFileSystem;
|
||||
|
||||
public BackOfficeAssetsController(IIOHelper ioHelper, IHostingEnvironment hostingEnvironment, ILogger logger, IGlobalSettings globalSettings)
|
||||
public BackOfficeAssetsController(IIOHelper ioHelper, IHostingEnvironment hostingEnvironment, ILogger logger, IOptionsSnapshot<GlobalSettings> globalSettings)
|
||||
{
|
||||
_jsLibFileSystem = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, globalSettings.UmbracoPath + Path.DirectorySeparatorChar + "lib");
|
||||
_jsLibFileSystem = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, globalSettings.Value.UmbracoPath + Path.DirectorySeparatorChar + "lib");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
|
||||
@@ -5,13 +5,14 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.BackOffice;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Grid;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Services;
|
||||
@@ -35,7 +36,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
{
|
||||
private readonly BackOfficeUserManager _userManager;
|
||||
private readonly IRuntimeMinifier _runtimeMinifier;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
|
||||
private readonly ILocalizedTextService _textService;
|
||||
@@ -49,7 +50,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
public BackOfficeController(
|
||||
BackOfficeUserManager userManager,
|
||||
IRuntimeMinifier runtimeMinifier,
|
||||
IGlobalSettings globalSettings,
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings,
|
||||
IHostingEnvironment hostingEnvironment,
|
||||
IUmbracoContextAccessor umbracoContextAccessor,
|
||||
ILocalizedTextService textService,
|
||||
@@ -59,11 +60,10 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
BackOfficeSignInManager signInManager,
|
||||
IWebSecurity webSecurity,
|
||||
ILogger logger)
|
||||
|
||||
{
|
||||
_userManager = userManager;
|
||||
_runtimeMinifier = runtimeMinifier;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
_umbracoContextAccessor = umbracoContextAccessor;
|
||||
_textService = textService;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
private readonly LinkGenerator _linkGenerator;
|
||||
private readonly IRuntimeState _runtimeState;
|
||||
private readonly UmbracoFeatures _features;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IUmbracoVersion _umbracoVersion;
|
||||
private readonly ContentSettings _contentSettings;
|
||||
private readonly TreeCollection _treeCollection;
|
||||
@@ -46,7 +46,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
LinkGenerator linkGenerator,
|
||||
IRuntimeState runtimeState,
|
||||
UmbracoFeatures features,
|
||||
IGlobalSettings globalSettings,
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings,
|
||||
IUmbracoVersion umbracoVersion,
|
||||
IOptionsSnapshot<ContentSettings> contentSettings,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
@@ -60,7 +60,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
_linkGenerator = linkGenerator;
|
||||
_runtimeState = runtimeState;
|
||||
_features = features;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
_umbracoVersion = umbracoVersion;
|
||||
_contentSettings = contentSettings.Value ?? throw new ArgumentNullException(nameof(contentSettings));
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
||||
@@ -3,11 +3,10 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Legacy;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Mapping;
|
||||
using Umbraco.Core.Models;
|
||||
@@ -15,15 +14,13 @@ using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Core.Strings.Css;
|
||||
using Umbraco.Extensions;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Stylesheet = Umbraco.Core.Models.Stylesheet;
|
||||
using StylesheetRule = Umbraco.Web.Models.ContentEditing.StylesheetRule;
|
||||
using Umbraco.Web.BackOffice.Filters;
|
||||
using Umbraco.Web.Common.ActionsResults;
|
||||
using Umbraco.Web.Common.Attributes;
|
||||
using Umbraco.Web.Common.Exceptions;
|
||||
using Umbraco.Web.Editors;
|
||||
using Umbraco.Web.BackOffice.Trees;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Stylesheet = Umbraco.Core.Models.Stylesheet;
|
||||
using StylesheetRule = Umbraco.Web.Models.ContentEditing.StylesheetRule;
|
||||
|
||||
namespace Umbraco.Web.BackOffice.Controllers
|
||||
{
|
||||
@@ -41,7 +38,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
private readonly ILocalizedTextService _localizedTextService;
|
||||
private readonly UmbracoMapper _umbracoMapper;
|
||||
private readonly IShortStringHelper _shortStringHelper;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
public CodeFileController(
|
||||
IIOHelper ioHelper,
|
||||
@@ -51,9 +48,8 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
ILocalizedTextService localizedTextService,
|
||||
UmbracoMapper umbracoMapper,
|
||||
IShortStringHelper shortStringHelper,
|
||||
IGlobalSettings globalSettings)
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings)
|
||||
{
|
||||
|
||||
_ioHelper = ioHelper;
|
||||
_fileSystems = fileSystems;
|
||||
_fileService = fileService;
|
||||
@@ -61,7 +57,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
_localizedTextService = localizedTextService;
|
||||
_umbracoMapper = umbracoMapper;
|
||||
_shortStringHelper = shortStringHelper;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -39,6 +39,8 @@ using Umbraco.Web.Editors;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Security;
|
||||
using ContentType = Umbraco.Core.Models.ContentType;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Web.BackOffice.Controllers
|
||||
{
|
||||
@@ -55,7 +57,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
public class ContentTypeController : ContentTypeControllerBase<IContentType>
|
||||
{
|
||||
private readonly IEntityXmlSerializer _serializer;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly PropertyEditorCollection _propertyEditors;
|
||||
private readonly IScopeProvider _scopeProvider;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
@@ -74,7 +76,6 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
private readonly IEntityService _entityService;
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
|
||||
|
||||
public ContentTypeController(
|
||||
ICultureDictionary cultureDictionary,
|
||||
EditorValidatorCollection editorValidatorCollection,
|
||||
@@ -84,7 +85,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
UmbracoMapper umbracoMapper,
|
||||
ILocalizedTextService localizedTextService,
|
||||
IEntityXmlSerializer serializer,
|
||||
IGlobalSettings globalSettings,
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings,
|
||||
PropertyEditorCollection propertyEditors,
|
||||
IScopeProvider scopeProvider,
|
||||
IIOHelper ioHelper,
|
||||
@@ -108,7 +109,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
localizedTextService)
|
||||
{
|
||||
_serializer = serializer;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
_propertyEditors = propertyEditors;
|
||||
_scopeProvider = scopeProvider;
|
||||
_ioHelper = ioHelper;
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// Initializes a new instance of the <see cref="DashboardController"/> with all its dependencies.
|
||||
/// </summary>
|
||||
public DashboardController(
|
||||
IGlobalSettings globalSettings,
|
||||
IUmbracoContextAccessor umbracoContextAccessor,
|
||||
ISqlContext sqlContext,
|
||||
ServiceContext services,
|
||||
|
||||
@@ -15,6 +15,8 @@ using Umbraco.Web.Common.Exceptions;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.Security;
|
||||
using Constants = Umbraco.Core.Constants;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Web.BackOffice.Controllers
|
||||
{
|
||||
@@ -33,7 +35,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILocalizationService _localizationService;
|
||||
private readonly IWebSecurity _webSecurity;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly ILocalizedTextService _localizedTextService;
|
||||
private readonly UmbracoMapper _umbracoMapper;
|
||||
|
||||
@@ -41,7 +43,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
ILogger logger,
|
||||
ILocalizationService localizationService,
|
||||
IWebSecurity webSecurity,
|
||||
IGlobalSettings globalSettings,
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings,
|
||||
ILocalizedTextService localizedTextService,
|
||||
UmbracoMapper umbracoMapper
|
||||
)
|
||||
@@ -49,7 +51,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
_localizationService = localizationService ?? throw new ArgumentNullException(nameof(localizationService));
|
||||
_webSecurity = webSecurity ?? throw new ArgumentNullException(nameof(webSecurity));
|
||||
_globalSettings = globalSettings ?? throw new ArgumentNullException(nameof(globalSettings));
|
||||
_globalSettings = globalSettings.Value ?? throw new ArgumentNullException(nameof(globalSettings));
|
||||
_localizedTextService = localizedTextService ?? throw new ArgumentNullException(nameof(localizedTextService));
|
||||
_umbracoMapper = umbracoMapper ?? throw new ArgumentNullException(nameof(umbracoMapper));
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Mapping;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Services;
|
||||
@@ -25,15 +27,15 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
{
|
||||
private readonly ILocalizationService _localizationService;
|
||||
private readonly UmbracoMapper _umbracoMapper;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
public LanguageController(ILocalizationService localizationService,
|
||||
UmbracoMapper umbracoMapper,
|
||||
IGlobalSettings globalSettings)
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings)
|
||||
{
|
||||
_localizationService = localizationService ?? throw new ArgumentNullException(nameof(localizationService));
|
||||
_umbracoMapper = umbracoMapper ?? throw new ArgumentNullException(nameof(umbracoMapper));
|
||||
_globalSettings = globalSettings ?? throw new ArgumentNullException(nameof(globalSettings));
|
||||
_globalSettings = globalSettings.Value ?? throw new ArgumentNullException(nameof(globalSettings));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.ViewEngines;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.Services;
|
||||
@@ -28,7 +30,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
public class PreviewController : Controller
|
||||
{
|
||||
private readonly UmbracoFeatures _features;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IPublishedSnapshotService _publishedSnapshotService;
|
||||
private readonly IWebSecurity _webSecurity;
|
||||
private readonly ILocalizationService _localizationService;
|
||||
@@ -39,7 +41,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
|
||||
public PreviewController(
|
||||
UmbracoFeatures features,
|
||||
IGlobalSettings globalSettings,
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings,
|
||||
IPublishedSnapshotService publishedSnapshotService,
|
||||
IWebSecurity webSecurity,
|
||||
ILocalizationService localizationService,
|
||||
@@ -49,7 +51,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
ICompositeViewEngine viewEngines)
|
||||
{
|
||||
_features = features;
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
_publishedSnapshotService = publishedSnapshotService;
|
||||
_webSecurity = webSecurity;
|
||||
_localizationService = localizationService;
|
||||
|
||||
@@ -12,6 +12,8 @@ using Umbraco.Core.Mapping;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Common.Attributes;
|
||||
using Umbraco.Web.Security;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Web.BackOffice.Controllers
|
||||
{
|
||||
@@ -19,21 +21,21 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
public class RedirectUrlManagementController : UmbracoAuthorizedApiController
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IWebRoutingSettings _webRoutingSettings;
|
||||
private readonly WebRoutingSettings _webRoutingSettings;
|
||||
private readonly IWebSecurity _webSecurity;
|
||||
private readonly IRedirectUrlService _redirectUrlService;
|
||||
private readonly UmbracoMapper _umbracoMapper;
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
|
||||
public RedirectUrlManagementController(ILogger logger,
|
||||
IWebRoutingSettings webRoutingSettings,
|
||||
IOptionsSnapshot<WebRoutingSettings> webRoutingSettings,
|
||||
IWebSecurity webSecurity,
|
||||
IRedirectUrlService redirectUrlService,
|
||||
UmbracoMapper umbracoMapper,
|
||||
IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
_webRoutingSettings = webRoutingSettings ?? throw new ArgumentNullException(nameof(webRoutingSettings));
|
||||
_webRoutingSettings = webRoutingSettings.Value ?? throw new ArgumentNullException(nameof(webRoutingSettings));
|
||||
_webSecurity = webSecurity ?? throw new ArgumentNullException(nameof(webSecurity));
|
||||
_redirectUrlService = redirectUrlService ?? throw new ArgumentNullException(nameof(redirectUrlService));
|
||||
_umbracoMapper = umbracoMapper ?? throw new ArgumentNullException(nameof(umbracoMapper));
|
||||
|
||||
@@ -3,10 +3,12 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Semver;
|
||||
using Umbraco.Composing;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Common.Attributes;
|
||||
@@ -22,20 +24,20 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
private readonly IUmbracoVersion _umbracoVersion;
|
||||
private readonly ICookieManager _cookieManager;
|
||||
private readonly IWebSecurity _webSecurity;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
public UpdateCheckController(
|
||||
IUpgradeService upgradeService,
|
||||
IUmbracoVersion umbracoVersion,
|
||||
ICookieManager cookieManager,
|
||||
IWebSecurity webSecurity,
|
||||
IGlobalSettings globalSettings)
|
||||
IOptionsSnapshot<GlobalSettings> globalSettings)
|
||||
{
|
||||
_upgradeService = upgradeService ?? throw new ArgumentNullException(nameof(upgradeService));
|
||||
_umbracoVersion = umbracoVersion ?? throw new ArgumentNullException(nameof(umbracoVersion));
|
||||
_cookieManager = cookieManager ?? throw new ArgumentNullException(nameof(cookieManager));
|
||||
_webSecurity = webSecurity ?? throw new ArgumentNullException(nameof(webSecurity));
|
||||
_globalSettings = globalSettings ?? throw new ArgumentNullException(nameof(globalSettings));
|
||||
_globalSettings = globalSettings.Value ?? throw new ArgumentNullException(nameof(globalSettings));
|
||||
}
|
||||
|
||||
[UpdateCheckResponseFilter]
|
||||
@@ -77,11 +79,11 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
|
||||
private class UpdateCheckResponseFilter : IActionFilter
|
||||
{
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
public UpdateCheckResponseFilter(IGlobalSettings globalSettings)
|
||||
public UpdateCheckResponseFilter(IOptionsSnapshot<GlobalSettings> globalSettings)
|
||||
{
|
||||
_globalSettings = globalSettings;
|
||||
_globalSettings = globalSettings.Value;
|
||||
}
|
||||
|
||||
public void OnActionExecuted(ActionExecutedContext context)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user