diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 5537a46ef8..295dc54371 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -123,7 +123,7 @@ You can get in touch with [the core contributors team](#the-core-contributors-te
In order to build the Umbraco source code locally, first make sure you have the following installed.
- * [Visual Studio 2017 v15.9.7+](https://visualstudio.microsoft.com/vs/)
+ * [Visual Studio 2019 v16.3+ (with .NET Core 3.0)](https://visualstudio.microsoft.com/vs/)
* [Node.js v10+](https://nodejs.org/en/download/)
* npm v6.4.1+ (installed with Node.js)
* [Git command line](https://git-scm.com/download/)
diff --git a/.github/ISSUE_TEMPLATE/3_BugNetCore.md b/.github/ISSUE_TEMPLATE/3_BugNetCore.md
new file mode 100644
index 0000000000..989904d4d8
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/3_BugNetCore.md
@@ -0,0 +1,65 @@
+---
+name: 🌟 .Net Core Bug Report
+about: For bugs specifically for the upcoming .NET Core release of Umbraco, don't use this if you're working with Umbraco version 7 or 8
+labels: project/net-core
+---
+
+ℹ️ If this bug **also** appears on the current version 8 of Umbraco then please [report it as a regular bug](https://github.com/umbraco/Umbraco-CMS/issues/new?template=1_Bug.md), fixes in version 8 will be merged to the .NET Core version.
+
+A brief description of the issue goes here.
+
+
+
+
+Reproduction
+------------
+
+If you're filing a bug, please describe how to reproduce it. Include as much
+relevant information as possible, such as:
+
+### Bug summary
+
+
+
+### Specifics
+
+
+
+### Steps to reproduce
+
+
+
+### Expected result
+
+
+
+### Actual result
+
+
diff --git a/.github/ISSUE_TEMPLATE/3_Support_question.md b/.github/ISSUE_TEMPLATE/4_Support_question.md
similarity index 100%
rename from .github/ISSUE_TEMPLATE/3_Support_question.md
rename to .github/ISSUE_TEMPLATE/4_Support_question.md
diff --git a/.github/ISSUE_TEMPLATE/4_Documentation_issue.md b/.github/ISSUE_TEMPLATE/5_Documentation_issue.md
similarity index 100%
rename from .github/ISSUE_TEMPLATE/4_Documentation_issue.md
rename to .github/ISSUE_TEMPLATE/5_Documentation_issue.md
diff --git a/.github/ISSUE_TEMPLATE/5_Security_issue.md b/.github/ISSUE_TEMPLATE/6_Security_issue.md
similarity index 100%
rename from .github/ISSUE_TEMPLATE/5_Security_issue.md
rename to .github/ISSUE_TEMPLATE/6_Security_issue.md
diff --git a/.gitignore b/.gitignore
index e35117d8e6..8b8a0782af 100644
--- a/.gitignore
+++ b/.gitignore
@@ -174,6 +174,7 @@ cypress.env.json
# eof
/src/Umbraco.Web.UI.Client/TESTS-*.xml
/src/ApiDocs/api/*
+/src/Umbraco.Web.UI.Client/package-lock.json
/src/Umbraco.Web.UI.NetCore/wwwroot/Media/*
/src/Umbraco.Web.UI.NetCore/wwwroot/is-cache/*
/src/Umbraco.Tests.Integration/App_Data/*
diff --git a/build/NuSpecs/UmbracoCms.Core.nuspec b/build/NuSpecs/UmbracoCms.Core.nuspec
index 477bb143f9..eeff783d6f 100644
--- a/build/NuSpecs/UmbracoCms.Core.nuspec
+++ b/build/NuSpecs/UmbracoCms.Core.nuspec
@@ -23,41 +23,42 @@
the latter would pick anything below 3.0.0 and that includes prereleases such as 3.0.0-alpha, and we do
not want this to happen as the alpha of the next major is, really, the next major already.
-->
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
+
-
+
+
-
-
+
+
-
+
@@ -71,7 +72,6 @@
-
@@ -79,7 +79,6 @@
-
@@ -87,7 +86,6 @@
-
diff --git a/build/NuSpecs/UmbracoCms.Web.nuspec b/build/NuSpecs/UmbracoCms.Web.nuspec
index 1aeead52a5..7800d05920 100644
--- a/build/NuSpecs/UmbracoCms.Web.nuspec
+++ b/build/NuSpecs/UmbracoCms.Web.nuspec
@@ -24,16 +24,16 @@
not want this to happen as the alpha of the next major is, really, the next major already.
-->
-
-
-
-
+
+
+
+
+
-
-
+
@@ -43,18 +43,18 @@
-
+
-
+
-
+
diff --git a/build/NuSpecs/tools/Web.config.install.xdt b/build/NuSpecs/tools/Web.config.install.xdt
index f118fa8c3a..e215bdbf29 100644
--- a/build/NuSpecs/tools/Web.config.install.xdt
+++ b/build/NuSpecs/tools/Web.config.install.xdt
@@ -1,139 +1,136 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
-
-
- >
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -177,20 +174,21 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/build.ps1 b/build/build.ps1
index 98f975da4f..ee05710f47 100644
--- a/build/build.ps1
+++ b/build/build.ps1
@@ -125,7 +125,23 @@
$error.Clear()
Write-Output "### gulp build for version $($this.Version.Release)" >> $log 2>&1
- npx gulp build --buildversion=$this.Version.Release >> $log 2>&1
+ npm run build --buildversion=$this.Version.Release >> $log 2>&1
+
+ # We can ignore this warning, we need to update to node 12 at some point - https://github.com/jsdom/jsdom/issues/2939
+ $indexes = [System.Collections.ArrayList]::new()
+ $index = 0;
+ $error | ForEach-Object {
+ # Find which of the errors is the ExperimentalWarning
+ if($_.ToString().Contains("ExperimentalWarning: The fs.promises API is experimental")) {
+ [void]$indexes.Add($index)
+ }
+ $index++
+ }
+ $indexes | ForEach-Object {
+ # Loop through the list of indexes and remove the errors that we expect and feel confident we can ignore
+ $error.Remove($error[$_])
+ }
+
if (-not $?) { throw "Failed to build" } # that one is expected to work
} finally {
Pop-Location
diff --git a/build/templates/UmbracoSolution/.template.config/template.json b/build/templates/UmbracoSolution/.template.config/template.json
index c222161245..ed83414eb6 100644
--- a/build/templates/UmbracoSolution/.template.config/template.json
+++ b/build/templates/UmbracoSolution/.template.config/template.json
@@ -15,7 +15,7 @@
"version": {
"type": "parameter",
"datatype": "string",
- "defaultValue": "0.5.0-alpha001",
+ "defaultValue": "0.5.0-alpha002",
"description": "The version of Umbraco to load using NuGet",
"replaces": "UMBRACO_VERSION_FROM_TEMPLATE"
},
diff --git a/src/Umbraco.Configuration/AspNetCoreConfigsFactory.cs b/src/Umbraco.Configuration/AspNetCoreConfigsFactory.cs
deleted file mode 100644
index 0cacab9e1d..0000000000
--- a/src/Umbraco.Configuration/AspNetCoreConfigsFactory.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Configuration.Models;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.Configuration.HealthChecks;
-using Umbraco.Core.Configuration.UmbracoSettings;
-using ConnectionStrings = Umbraco.Configuration.Models.ConnectionStrings;
-using CoreDebugSettings = Umbraco.Configuration.Models.CoreDebugSettings;
-
-namespace Umbraco.Configuration
-{
- public class AspNetCoreConfigsFactory : IConfigsFactory
- {
- private readonly IConfiguration _configuration;
-
- public AspNetCoreConfigsFactory(IConfiguration configuration)
- {
- _configuration = configuration ?? throw new System.ArgumentNullException(nameof(configuration));
- }
-
- public Configs Create()
- {
- var configs = new Configs();
-
- configs.Add(() => new TourSettings(_configuration));
- configs.Add(() => new CoreDebugSettings(_configuration));
- configs.Add(() => new RequestHandlerSettings(_configuration));
- configs.Add(() => new SecuritySettings(_configuration));
- configs.Add(() => new UserPasswordConfigurationSettings(_configuration));
- configs.Add(() => new MemberPasswordConfigurationSettings(_configuration));
- configs.Add(() => new KeepAliveSettings(_configuration));
- configs.Add(() => new ContentSettings(_configuration));
- configs.Add(() => new HealthChecksSettings(_configuration));
- configs.Add(() => new LoggingSettings(_configuration));
- configs.Add(() => new ExceptionFilterSettings(_configuration));
- configs.Add(() => new ActiveDirectorySettings(_configuration));
- configs.Add(() => new RuntimeSettings(_configuration));
- configs.Add(() => new TypeFinderSettings(_configuration));
- configs.Add(() => new NuCacheSettings(_configuration));
- configs.Add(() => new WebRoutingSettings(_configuration));
- configs.Add(() => new IndexCreatorSettings(_configuration));
- configs.Add(() => new ModelsBuilderConfig(_configuration));
- configs.Add(() => new HostingSettings(_configuration));
- configs.Add(() => new GlobalSettings(_configuration));
- configs.Add(() => new ConnectionStrings(_configuration));
- configs.Add(() => new ImagingSettings(_configuration));
-
- return configs;
- }
- }
-}
diff --git a/src/Umbraco.Configuration/ConfigsFactory.cs b/src/Umbraco.Configuration/ConfigsFactory.cs
deleted file mode 100644
index be6cee2d0c..0000000000
--- a/src/Umbraco.Configuration/ConfigsFactory.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using Umbraco.Configuration;
-using Umbraco.Configuration.Implementations;
-using Umbraco.Configuration.Legacy;
-using Umbraco.Core.Configuration.HealthChecks;
-using Umbraco.Core.Configuration.Legacy;
-using Umbraco.Core.Configuration.UmbracoSettings;
-
-namespace Umbraco.Core.Configuration
-{
- public class ConfigsFactory : IConfigsFactory
- {
- public IHostingSettings HostingSettings { get; } = new HostingSettings();
- public ICoreDebugSettings CoreDebugSettings { get; } = new CoreDebugSettings();
- public IIndexCreatorSettings IndexCreatorSettings { get; } = new IndexCreatorSettings();
- public INuCacheSettings NuCacheSettings { get; } = new NuCacheSettings();
- public ITypeFinderSettings TypeFinderSettings { get; } = new TypeFinderSettings();
- public IRuntimeSettings RuntimeSettings { get; } = new RuntimeSettings();
- public IActiveDirectorySettings ActiveDirectorySettings { get; } = new ActiveDirectorySettings();
- public IExceptionFilterSettings ExceptionFilterSettings { get; } = new ExceptionFilterSettings();
- public ITourSettings TourSettings { get; } = new TourSettings();
- public ILoggingSettings LoggingSettings { get; } = new LoggingSettings();
- public IKeepAliveSettings KeepAliveSettings { get; } = new KeepAliveSettings();
- public IWebRoutingSettings WebRoutingSettings { get; } = new WebRoutingSettings();
- public IRequestHandlerSettings RequestHandlerSettings { get; } = new RequestHandlerSettings();
- public ISecuritySettings SecuritySettings { get; } = new SecuritySettings();
- public IUserPasswordConfiguration UserPasswordConfigurationSettings { get; } = new UserPasswordConfigurationSettings();
- public IMemberPasswordConfiguration MemberPasswordConfigurationSettings { get; } = new MemberPasswordConfigurationSettings();
- public IContentSettings ContentSettings { get; } = new ContentSettings();
- public IGlobalSettings GlobalSettings { get; } = new GlobalSettings();
- public IHealthChecksSettings HealthChecksSettings { get; } = new HealthChecksSettings();
- public IConnectionStrings ConnectionStrings { get; } = new ConnectionStrings();
- public IModelsBuilderConfig ModelsBuilderConfig { get; } = new ModelsBuilderConfig();
-
- public Configs Create()
- {
- var configs = new Configs();
-
- configs.Add(() => GlobalSettings);
- configs.Add(() => HostingSettings);
- configs.Add(() => HealthChecksSettings);
- configs.Add(() => CoreDebugSettings);
- configs.Add(() => ConnectionStrings);
- configs.Add(() => ModelsBuilderConfig);
- configs.Add(() => IndexCreatorSettings);
- configs.Add(() => NuCacheSettings);
- configs.Add(() => TypeFinderSettings);
- configs.Add(() => RuntimeSettings);
- configs.Add(() => ActiveDirectorySettings);
- configs.Add(() => ExceptionFilterSettings);
- configs.Add(() => TourSettings);
- configs.Add(() => LoggingSettings);
- configs.Add(() => KeepAliveSettings);
- configs.Add(() => WebRoutingSettings);
- configs.Add(() => RequestHandlerSettings);
- configs.Add(() => SecuritySettings);
- configs.Add(() => UserPasswordConfigurationSettings);
- configs.Add(() => MemberPasswordConfigurationSettings);
- configs.Add(() => ContentSettings);
-
- return configs;
- }
- }
-}
diff --git a/src/Umbraco.Configuration/HealthChecks/DisabledHealthCheckElement.cs b/src/Umbraco.Configuration/HealthChecks/DisabledHealthCheckElement.cs
deleted file mode 100644
index 01392da614..0000000000
--- a/src/Umbraco.Configuration/HealthChecks/DisabledHealthCheckElement.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Linq;
-using System.Text;
-
-namespace Umbraco.Core.Configuration.HealthChecks
-{
- public class DisabledHealthCheckElement : ConfigurationElement, IDisabledHealthCheck
- {
- private const string IdKey = "id";
- private const string DisabledOnKey = "disabledOn";
- private const string DisabledByKey = "disabledBy";
-
- [ConfigurationProperty(IdKey, IsKey = true, IsRequired = true)]
- public Guid Id
- {
- get
- {
- return ((Guid)(base[IdKey]));
- }
- }
-
- [ConfigurationProperty(DisabledOnKey, IsKey = false, IsRequired = false)]
- public DateTime DisabledOn
- {
- get
- {
- return ((DateTime)(base[DisabledOnKey]));
- }
- }
-
- [ConfigurationProperty(DisabledByKey, IsKey = false, IsRequired = false)]
- public int DisabledBy
- {
- get
- {
- return ((int)(base[DisabledByKey]));
- }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/HealthChecks/DisabledHealthChecksElementCollection.cs b/src/Umbraco.Configuration/HealthChecks/DisabledHealthChecksElementCollection.cs
deleted file mode 100644
index 87600b8ae3..0000000000
--- a/src/Umbraco.Configuration/HealthChecks/DisabledHealthChecksElementCollection.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.HealthChecks
-{
- [ConfigurationCollection(typeof(DisabledHealthCheckElement), AddItemName = "check")]
- public class DisabledHealthChecksElementCollection : ConfigurationElementCollection, IEnumerable
- {
- protected override ConfigurationElement CreateNewElement()
- {
- return new DisabledHealthCheckElement();
- }
-
- protected override object GetElementKey(ConfigurationElement element)
- {
- return ((DisabledHealthCheckElement)(element)).Id;
- }
-
- public new DisabledHealthCheckElement this[string key]
- {
- get
- {
- return (DisabledHealthCheckElement)BaseGet(key);
- }
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- yield return BaseGet(i) as DisabledHealthCheckElement;
- }
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
-}
diff --git a/src/Umbraco.Configuration/HealthChecks/HealthCheckNotificationSettingsElement.cs b/src/Umbraco.Configuration/HealthChecks/HealthCheckNotificationSettingsElement.cs
deleted file mode 100644
index 1ccf3e357b..0000000000
--- a/src/Umbraco.Configuration/HealthChecks/HealthCheckNotificationSettingsElement.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.HealthChecks
-{
- public class HealthCheckNotificationSettingsElement : ConfigurationElement, IHealthCheckNotificationSettings
- {
- private const string EnabledKey = "enabled";
- private const string FirstRunTimeKey = "firstRunTime";
- private const string PeriodKey = "periodInHours";
- private const string NotificationMethodsKey = "notificationMethods";
- private const string DisabledChecksKey = "disabledChecks";
-
- [ConfigurationProperty(EnabledKey, IsRequired = true)]
- public bool Enabled
- {
- get
- {
- return (bool)base[EnabledKey];
- }
- }
-
- [ConfigurationProperty(FirstRunTimeKey, IsRequired = false)]
- public string FirstRunTime
- {
- get
- {
- return (string)base[FirstRunTimeKey];
- }
- }
-
- [ConfigurationProperty(PeriodKey, IsRequired = true)]
- public int PeriodInHours
- {
- get
- {
- return (int)base[PeriodKey];
- }
- }
-
- [ConfigurationProperty(NotificationMethodsKey, IsDefaultCollection = true, IsRequired = false)]
- public NotificationMethodsElementCollection NotificationMethods
- {
- get
- {
- return (NotificationMethodsElementCollection)base[NotificationMethodsKey];
- }
- }
-
- [ConfigurationProperty(DisabledChecksKey, IsDefaultCollection = false, IsRequired = false)]
- public DisabledHealthChecksElementCollection DisabledChecks
- {
- get
- {
- return (DisabledHealthChecksElementCollection)base[DisabledChecksKey];
- }
- }
-
- bool IHealthCheckNotificationSettings.Enabled
- {
- get { return Enabled; }
- }
-
- string IHealthCheckNotificationSettings.FirstRunTime
- {
- get { return FirstRunTime; }
- }
-
- int IHealthCheckNotificationSettings.PeriodInHours
- {
- get { return PeriodInHours; }
- }
-
- IReadOnlyDictionary IHealthCheckNotificationSettings.NotificationMethods
- {
- get { return NotificationMethods; }
- }
-
- IEnumerable IHealthCheckNotificationSettings.DisabledChecks
- {
- get { return DisabledChecks; }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/HealthChecks/HealthChecksSection.cs b/src/Umbraco.Configuration/HealthChecks/HealthChecksSection.cs
deleted file mode 100644
index 373d846567..0000000000
--- a/src/Umbraco.Configuration/HealthChecks/HealthChecksSection.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.HealthChecks
-{
- public class HealthChecksSection : ConfigurationSection
- {
- private const string DisabledChecksKey = "disabledChecks";
- private const string NotificationSettingsKey = "notificationSettings";
-
- [ConfigurationProperty(DisabledChecksKey)]
- public DisabledHealthChecksElementCollection DisabledChecks
- {
- get { return ((DisabledHealthChecksElementCollection)(base[DisabledChecksKey])); }
- }
-
- [ConfigurationProperty(NotificationSettingsKey, IsRequired = true)]
- public HealthCheckNotificationSettingsElement NotificationSettings
- {
- get { return ((HealthCheckNotificationSettingsElement)(base[NotificationSettingsKey])); }
- }
-
- }
-}
diff --git a/src/Umbraco.Configuration/HealthChecks/NotificationMethodElement.cs b/src/Umbraco.Configuration/HealthChecks/NotificationMethodElement.cs
deleted file mode 100644
index cbbe5e8b02..0000000000
--- a/src/Umbraco.Configuration/HealthChecks/NotificationMethodElement.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.HealthChecks
-{
- public class NotificationMethodElement : ConfigurationElement, INotificationMethod
- {
- private const string AliasKey = "alias";
- private const string EnabledKey = "enabled";
- private const string VerbosityKey = "verbosity";
- private const string FailureonlyKey = "failureOnly";
- private const string SettingsKey = "settings";
-
- [ConfigurationProperty(AliasKey, IsKey = true, IsRequired = true)]
- public string Alias
- {
- get
- {
- return (string)base[AliasKey];
- }
- }
-
- [ConfigurationProperty(EnabledKey, IsKey = true, IsRequired = true)]
- public bool Enabled
- {
- get
- {
- return (bool)base[EnabledKey];
- }
- }
-
- [ConfigurationProperty(VerbosityKey, IsRequired = true)]
- public HealthCheckNotificationVerbosity Verbosity
- {
- get
- {
- return (HealthCheckNotificationVerbosity)base[VerbosityKey];
- }
- }
-
- [ConfigurationProperty(FailureonlyKey, IsRequired = false)]
- public bool FailureOnly
- {
- get
- {
- return (bool)base[FailureonlyKey];
- }
- }
-
- [ConfigurationProperty(SettingsKey, IsDefaultCollection = true, IsRequired = false)]
- public NotificationMethodSettingsElementCollection Settings
- {
- get
- {
- return (NotificationMethodSettingsElementCollection)base[SettingsKey];
- }
- }
-
- string INotificationMethod.Alias
- {
- get { return Alias; }
- }
-
- bool INotificationMethod.Enabled
- {
- get { return Enabled; }
- }
-
- HealthCheckNotificationVerbosity INotificationMethod.Verbosity
- {
- get { return Verbosity; }
- }
-
- bool INotificationMethod.FailureOnly
- {
- get { return FailureOnly; }
- }
-
- IReadOnlyDictionary INotificationMethod.Settings
- {
- get { return Settings; }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/HealthChecks/NotificationMethodSettingsElement.cs b/src/Umbraco.Configuration/HealthChecks/NotificationMethodSettingsElement.cs
deleted file mode 100644
index ed42eb7221..0000000000
--- a/src/Umbraco.Configuration/HealthChecks/NotificationMethodSettingsElement.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.HealthChecks
-{
- public class NotificationMethodSettingsElement : ConfigurationElement, INotificationMethodSettings
- {
- private const string KeyKey = "key";
- private const string ValueKey = "value";
-
- [ConfigurationProperty(KeyKey, IsKey = true, IsRequired = true)]
- public string Key
- {
- get
- {
- return (string)base[KeyKey];
- }
- }
-
- [ConfigurationProperty(ValueKey, IsRequired = true)]
- public string Value
- {
- get
- {
- return (string)base[ValueKey];
- }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/HealthChecks/NotificationMethodSettingsElementCollection.cs b/src/Umbraco.Configuration/HealthChecks/NotificationMethodSettingsElementCollection.cs
deleted file mode 100644
index 226278ab61..0000000000
--- a/src/Umbraco.Configuration/HealthChecks/NotificationMethodSettingsElementCollection.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Linq;
-
-namespace Umbraco.Core.Configuration.HealthChecks
-{
- [ConfigurationCollection(typeof(NotificationMethodSettingsElement), AddItemName = "add")]
- public class NotificationMethodSettingsElementCollection : ConfigurationElementCollection, IEnumerable, IReadOnlyDictionary
- {
- protected override ConfigurationElement CreateNewElement()
- {
- return new NotificationMethodSettingsElement();
- }
-
- protected override object GetElementKey(ConfigurationElement element)
- {
- return ((NotificationMethodSettingsElement)(element)).Key;
- }
-
- IEnumerator> IEnumerable>.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- var val = (NotificationMethodSettingsElement)BaseGet(i);
- var key = (string)BaseGetKey(i);
- yield return new KeyValuePair(key, val);
- }
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- yield return (NotificationMethodSettingsElement)BaseGet(i);
- }
- }
-
- bool IReadOnlyDictionary.ContainsKey(string key)
- {
- return ((IReadOnlyDictionary)this).Keys.Any(x => x == key);
- }
-
- bool IReadOnlyDictionary.TryGetValue(string key, out INotificationMethodSettings value)
- {
- try
- {
- var val = (NotificationMethodSettingsElement)BaseGet(key);
- value = val;
- return true;
- }
- catch (Exception)
- {
- value = null;
- return false;
- }
- }
-
- INotificationMethodSettings IReadOnlyDictionary.this[string key]
- {
- get { return (NotificationMethodSettingsElement)BaseGet(key); }
- }
-
- IEnumerable IReadOnlyDictionary.Keys
- {
- get { return BaseGetAllKeys().Cast(); }
- }
-
- IEnumerable IReadOnlyDictionary.Values
- {
- get
- {
- for (var i = 0; i < Count; i++)
- {
- yield return (NotificationMethodSettingsElement)BaseGet(i);
- }
- }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/HealthChecks/NotificationMethodsElementCollection.cs b/src/Umbraco.Configuration/HealthChecks/NotificationMethodsElementCollection.cs
deleted file mode 100644
index ee7e135961..0000000000
--- a/src/Umbraco.Configuration/HealthChecks/NotificationMethodsElementCollection.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Linq;
-
-namespace Umbraco.Core.Configuration.HealthChecks
-{
- [ConfigurationCollection(typeof(NotificationMethodElement), AddItemName = "notificationMethod")]
- public class NotificationMethodsElementCollection : ConfigurationElementCollection, IEnumerable, IReadOnlyDictionary
- {
- protected override ConfigurationElement CreateNewElement()
- {
- return new NotificationMethodElement();
- }
-
- protected override object GetElementKey(ConfigurationElement element)
- {
- return ((NotificationMethodElement)(element)).Alias;
- }
-
- IEnumerator> IEnumerable>.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- var val = (NotificationMethodElement)BaseGet(i);
- var key = (string)BaseGetKey(i);
- yield return new KeyValuePair(key, val);
- }
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- yield return (NotificationMethodElement)BaseGet(i);
- }
- }
-
- bool IReadOnlyDictionary.ContainsKey(string key)
- {
- return ((IReadOnlyDictionary) this).Keys.Any(x => x == key);
- }
-
- bool IReadOnlyDictionary.TryGetValue(string key, out INotificationMethod value)
- {
- try
- {
- var val = (NotificationMethodElement)BaseGet(key);
- value = val;
- return true;
- }
- catch (Exception)
- {
- value = null;
- return false;
- }
- }
-
- INotificationMethod IReadOnlyDictionary.this[string key]
- {
- get { return (NotificationMethodElement)BaseGet(key); }
- }
-
- IEnumerable IReadOnlyDictionary.Keys
- {
- get { return BaseGetAllKeys().Cast(); }
- }
-
- IEnumerable IReadOnlyDictionary.Values
- {
- get
- {
- for (var i = 0; i < Count; i++)
- {
- yield return (NotificationMethodElement)BaseGet(i);
- }
- }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/ActiveDirectorySettings.cs b/src/Umbraco.Configuration/Legacy/ActiveDirectorySettings.cs
deleted file mode 100644
index ef100afed6..0000000000
--- a/src/Umbraco.Configuration/Legacy/ActiveDirectorySettings.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Configuration;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Legacy
-{
- public class ActiveDirectorySettings : IActiveDirectorySettings
- {
- public ActiveDirectorySettings()
- {
- ActiveDirectoryDomain = ConfigurationManager.AppSettings["ActiveDirectoryDomain"];
- }
-
- public string ActiveDirectoryDomain { get; }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/CommaDelimitedConfigurationElement.cs b/src/Umbraco.Configuration/Legacy/CommaDelimitedConfigurationElement.cs
deleted file mode 100644
index 3ced2fab46..0000000000
--- a/src/Umbraco.Configuration/Legacy/CommaDelimitedConfigurationElement.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration
-{
- ///
- /// Defines a configuration section that contains inner text that is comma delimited
- ///
- internal class CommaDelimitedConfigurationElement : InnerTextConfigurationElement, IEnumerable
- {
- public override CommaDelimitedStringCollection Value
- {
- get
- {
- var converter = new CommaDelimitedStringCollectionConverter();
- return (CommaDelimitedStringCollection) converter.ConvertFrom(RawValue);
- }
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return new InnerEnumerator(Value.GetEnumerator());
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return new InnerEnumerator(Value.GetEnumerator());
- }
-
- ///
- /// A wrapper for StringEnumerator since it doesn't explicitly implement IEnumerable
- ///
- private class InnerEnumerator : IEnumerator
- {
- private readonly StringEnumerator _stringEnumerator;
-
- public InnerEnumerator(StringEnumerator stringEnumerator)
- {
- _stringEnumerator = stringEnumerator;
- }
-
- public bool MoveNext()
- {
- return _stringEnumerator.MoveNext();
- }
-
- public void Reset()
- {
- _stringEnumerator.Reset();
- }
-
- string IEnumerator.Current
- {
- get { return _stringEnumerator.Current; }
- }
-
- public object Current
- {
- get { return _stringEnumerator.Current; }
- }
-
- public void Dispose()
- {
- _stringEnumerator.DisposeIfDisposable();
- }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/ConfigurationManagerConfigBase.cs b/src/Umbraco.Configuration/Legacy/ConfigurationManagerConfigBase.cs
deleted file mode 100644
index 0302a7ea31..0000000000
--- a/src/Umbraco.Configuration/Legacy/ConfigurationManagerConfigBase.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Configuration;
-using Umbraco.Core.Configuration.UmbracoSettings;
-
-namespace Umbraco.Configuration.Implementations
-{
- internal abstract class ConfigurationManagerConfigBase
- {
- private UmbracoSettingsSection _umbracoSettingsSection;
-
- protected UmbracoSettingsSection UmbracoSettingsSection
- {
- get
- {
- if (_umbracoSettingsSection is null)
- {
- _umbracoSettingsSection = ConfigurationManager.GetSection("umbracoConfiguration/settings") as UmbracoSettingsSection;
- }
- return _umbracoSettingsSection;
- }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/ConnectionStrings.cs b/src/Umbraco.Configuration/Legacy/ConnectionStrings.cs
deleted file mode 100644
index a02c351118..0000000000
--- a/src/Umbraco.Configuration/Legacy/ConnectionStrings.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration
-{
- public class ConnectionStrings : IConnectionStrings
- {
- public ConfigConnectionString this[string key]
- {
- get
- {
- var settings = ConfigurationManager.ConnectionStrings[key];
- if (settings == null) return null;
- return new ConfigConnectionString(settings.ConnectionString, settings.ProviderName, settings.Name);
- }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/ContentSettings.cs b/src/Umbraco.Configuration/Legacy/ContentSettings.cs
deleted file mode 100644
index 1c3f543bfe..0000000000
--- a/src/Umbraco.Configuration/Legacy/ContentSettings.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Collections.Generic;
-using Umbraco.Core.Configuration.UmbracoSettings;
-using Umbraco.Core.Macros;
-
-namespace Umbraco.Configuration.Implementations
-{
- internal class ContentSettings : ConfigurationManagerConfigBase, IContentSettings
- {
- public string NotificationEmailAddress => UmbracoSettingsSection.Content.Notifications.NotificationEmailAddress;
- public bool DisableHtmlEmail => UmbracoSettingsSection.Content.Notifications.DisableHtmlEmail;
- public IEnumerable ImageFileTypes => UmbracoSettingsSection.Content.Imaging.ImageFileTypes;
- public IEnumerable ImageAutoFillProperties => UmbracoSettingsSection.Content.Imaging.ImageAutoFillProperties;
- public bool ResolveUrlsFromTextString => UmbracoSettingsSection.Content.ResolveUrlsFromTextString;
- public IEnumerable Error404Collection => UmbracoSettingsSection.Content.Error404Collection;
- public string PreviewBadge => UmbracoSettingsSection.Content.PreviewBadge;
- public MacroErrorBehaviour MacroErrorBehaviour => UmbracoSettingsSection.Content.MacroErrors;
- public IEnumerable DisallowedUploadFiles => UmbracoSettingsSection.Content.DisallowedUploadFiles;
- public IEnumerable AllowedUploadFiles => UmbracoSettingsSection.Content.AllowedUploadFiles;
- public bool ShowDeprecatedPropertyEditors => UmbracoSettingsSection.Content.ShowDeprecatedPropertyEditors;
- public string LoginBackgroundImage => UmbracoSettingsSection.Content.LoginBackgroundImage;
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/CoreDebugSettings.cs b/src/Umbraco.Configuration/Legacy/CoreDebugSettings.cs
deleted file mode 100644
index 4902d4489f..0000000000
--- a/src/Umbraco.Configuration/Legacy/CoreDebugSettings.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration
-{
- public class CoreDebugSettings : ICoreDebugSettings
- {
- public CoreDebugSettings()
- {
- var appSettings = ConfigurationManager.AppSettings;
- LogUncompletedScopes = string.Equals("true", appSettings[Constants.AppSettings.Debug.LogUncompletedScopes], StringComparison.OrdinalIgnoreCase);
- DumpOnTimeoutThreadAbort = string.Equals("true", appSettings[Constants.AppSettings.Debug.DumpOnTimeoutThreadAbort], StringComparison.OrdinalIgnoreCase);
- }
-
- ///
- public bool LogUncompletedScopes { get; }
-
- ///
- public bool DumpOnTimeoutThreadAbort { get; }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/ExceptionFilterSettings.cs b/src/Umbraco.Configuration/Legacy/ExceptionFilterSettings.cs
deleted file mode 100644
index 50e2207485..0000000000
--- a/src/Umbraco.Configuration/Legacy/ExceptionFilterSettings.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Configuration;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Legacy
-{
- public class ExceptionFilterSettings : IExceptionFilterSettings
- {
- public ExceptionFilterSettings()
- {
- if (bool.TryParse(ConfigurationManager.AppSettings["Umbraco.Web.DisableModelBindingExceptionFilter"],
- out var disabled))
- {
- Disabled = disabled;
- }
- }
- public bool Disabled { get; }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/GlobalSettings.cs b/src/Umbraco.Configuration/Legacy/GlobalSettings.cs
deleted file mode 100644
index fabe95f5bd..0000000000
--- a/src/Umbraco.Configuration/Legacy/GlobalSettings.cs
+++ /dev/null
@@ -1,377 +0,0 @@
-using System;
-using System.Configuration;
-using System.Linq;
-using System.Net.Mail;
-using System.Xml.Linq;
-using Umbraco.Composing;
-using Umbraco.Configuration;
-using Umbraco.Core.IO;
-
-namespace Umbraco.Core.Configuration.Legacy
-{
- // TODO: Replace checking for if the app settings exist and returning an empty string, instead return the defaults!
- // TODO: need to massively cleanup these configuration classes
-
- ///
- /// The GlobalSettings Class contains general settings information for the entire Umbraco instance based on information from web.config appsettings
- ///
- public class GlobalSettings : IGlobalSettings
- {
-
- // TODO these should not be static
- private static string _reservedPaths;
- private static string _reservedUrls;
-
- //ensure the built on (non-changeable) reserved paths are there at all times
- internal const string StaticReservedPaths = "~/app_plugins/,~/install/,~/mini-profiler-resources/,"; //must end with a comma!
- internal const string StaticReservedUrls = "~/config/splashes/noNodes.aspx,~/.well-known,"; //must end with a comma!
-
- ///
- /// Used in unit testing to reset all config items that were set with property setters (i.e. did not come from config)
- ///
- private static void ResetInternal()
- {
- _reservedPaths = null;
- _reservedUrls = null;
- }
-
- ///
- /// Resets settings that were set programmatically, to their initial values.
- ///
- /// To be used in unit tests.
- internal static void Reset()
- {
- ResetInternal();
- }
-
-
- public bool IsSmtpServerConfigured
- {
- get
- {
- var smtpSettings = SmtpSettings;
-
- if (smtpSettings is null) return false;
-
- if (!(smtpSettings.From is null)) return true;
- if (!(smtpSettings.Host is null)) return true;
- if (!(smtpSettings.PickupDirectoryLocation is null)) return true;
-
- return false;
- }
- }
-
- public ISmtpSettings SmtpSettings
- {
- get
- {
- var smtpSection = ConfigurationManager.GetSection("system.net/mailSettings/smtp") as ConfigurationSection;
- if (smtpSection is null) return null;
-
- var result = new SmtpSettings();
- var from = smtpSection.ElementInformation.Properties["from"];
- if (@from != null
- && @from.Value is string fromPropValue
- && string.IsNullOrEmpty(fromPropValue) == false
- && !string.Equals("noreply@example.com", fromPropValue, StringComparison.OrdinalIgnoreCase))
- {
- result.From = fromPropValue;
- }
-
- var specifiedPickupDirectorySection = ConfigurationManager.GetSection("system.net/mailSettings/smtp/specifiedPickupDirectory") as ConfigurationSection;
- var pickupDirectoryLocation = specifiedPickupDirectorySection?.ElementInformation.Properties["pickupDirectoryLocation"];
- if (pickupDirectoryLocation != null
- && pickupDirectoryLocation.Value is string pickupDirectoryLocationPropValue
- && string.IsNullOrEmpty(pickupDirectoryLocationPropValue) == false)
- {
- result.PickupDirectoryLocation = pickupDirectoryLocationPropValue;
- }
-
- // SmtpClient can magically read the section system.net/mailSettings/smtp/network, witch is always
- // null if we use ConfigurationManager.GetSection. SmtpSection does not exist in .Net Standard
- var smtpClient = new SmtpClient();
-
- result.Host = smtpClient.Host;
- result.Port = smtpClient.Port;
-
- return result;
-
- }
- }
-
- ///
- /// Gets the reserved urls from web.config.
- ///
- /// The reserved urls.
- public string ReservedUrls
- {
- get
- {
- if (_reservedUrls != null) return _reservedUrls;
-
- var urls = ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.ReservedUrls)
- ? ConfigurationManager.AppSettings[Constants.AppSettings.ReservedUrls]
- : string.Empty;
-
- //ensure the built on (non-changeable) reserved paths are there at all times
- _reservedUrls = StaticReservedUrls + urls;
- return _reservedUrls;
- }
- internal set => _reservedUrls = value;
- }
-
- ///
- /// Gets the reserved paths from web.config
- ///
- /// The reserved paths.
- public string ReservedPaths
- {
- get
- {
- if (_reservedPaths != null) return _reservedPaths;
-
- var reservedPaths = StaticReservedPaths;
- var umbPath = ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.UmbracoPath) && !ConfigurationManager.AppSettings[Constants.AppSettings.UmbracoPath].IsNullOrWhiteSpace()
- ? ConfigurationManager.AppSettings[Constants.AppSettings.UmbracoPath]
- : "~/umbraco";
- //always add the umbraco path to the list
- reservedPaths += umbPath.EnsureEndsWith(',');
-
- var allPaths = ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.ReservedPaths)
- ? ConfigurationManager.AppSettings[Constants.AppSettings.ReservedPaths]
- : string.Empty;
-
- _reservedPaths = reservedPaths + allPaths;
- return _reservedPaths;
- }
- }
-
-
-
-
- ///
- /// Gets or sets the configuration status. This will return the version number of the currently installed umbraco instance.
- ///
- /// The configuration status.
- public string ConfigurationStatus
- {
- get
- {
- return ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.ConfigurationStatus)
- ? ConfigurationManager.AppSettings[Constants.AppSettings.ConfigurationStatus]
- : string.Empty;
- }
- set
- {
- SaveSetting(Constants.AppSettings.ConfigurationStatus, value, Current.IOHelper); //TODO remove
- }
- }
-
- ///
- /// Saves a setting into the configuration file.
- ///
- /// Key of the setting to be saved.
- /// Value of the setting to be saved.
- internal static void SaveSetting(string key, string value, IIOHelper ioHelper)
- {
- var fileName = ioHelper.MapPath("~/web.config");
- var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace);
-
- var appSettings = xml.Root.DescendantsAndSelf("appSettings").Single();
-
- // Update appSetting if it exists, or else create a new appSetting for the given key and value
- var setting = appSettings.Descendants("add").FirstOrDefault(s => s.Attribute("key").Value == key);
- if (setting == null)
- appSettings.Add(new XElement("add", new XAttribute("key", key), new XAttribute("value", value)));
- else
- setting.Attribute("value").Value = value;
-
- xml.Save(fileName, SaveOptions.DisableFormatting);
- ConfigurationManager.RefreshSection("appSettings");
- }
-
-
- ///
- /// Gets the time out in minutes.
- ///
- /// The time out in minutes.
- public int TimeOutInMinutes
- {
- get
- {
- try
- {
- return int.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.TimeOutInMinutes]);
- }
- catch
- {
- return 20;
- }
- }
- }
-
- ///
- /// Returns the number of days that should take place between version checks.
- ///
- /// The version check period in days (0 = never).
- public int VersionCheckPeriod
- {
- get
- {
- try
- {
- var val = ConfigurationManager.AppSettings[Constants.AppSettings.VersionCheckPeriod];
- if (!(val is null))
- {
- return int.Parse(val);
- }
- }
- catch
- {
- // Ignore
- }
- return 7;
- }
- }
-
-
-
-
- ///
- /// Gets the default UI language.
- ///
- /// The default UI language.
- // ReSharper disable once InconsistentNaming
- public string DefaultUILanguage
- {
- get
- {
- return ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.DefaultUILanguage)
- ? ConfigurationManager.AppSettings[Constants.AppSettings.DefaultUILanguage]
- : string.Empty;
- }
- }
-
- ///
- /// Gets a value indicating whether umbraco should hide top level nodes from generated urls.
- ///
- ///
- /// true if umbraco hides top level nodes from urls; otherwise, false.
- ///
- public bool HideTopLevelNodeFromPath
- {
- get
- {
- try
- {
- return bool.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.HideTopLevelNodeFromPath]);
- }
- catch
- {
- return false;
- }
- }
- }
-
- ///
- /// Gets a value indicating whether umbraco should force a secure (https) connection to the backoffice.
- ///
- public bool UseHttps
- {
- get
- {
- try
- {
- return bool.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.UseHttps]);
- }
- catch
- {
- return false;
- }
- }
- }
-
- private string _umbracoMediaPath = null;
- public string UmbracoMediaPath => GetterWithDefaultValue(Constants.AppSettings.UmbracoMediaPath, "~/media", ref _umbracoMediaPath);
-
- private string _umbracoScriptsPath = null;
- public string UmbracoScriptsPath => GetterWithDefaultValue(Constants.AppSettings.UmbracoScriptsPath, "~/scripts", ref _umbracoScriptsPath);
-
- private string _umbracoCssPath = null;
- public string UmbracoCssPath => GetterWithDefaultValue(Constants.AppSettings.UmbracoCssPath, "~/css", ref _umbracoCssPath);
-
- private string _umbracoPath = null;
- public string UmbracoPath => GetterWithDefaultValue(Constants.AppSettings.UmbracoPath, "~/umbraco", ref _umbracoPath);
-
- private bool _installMissingDatabase;
- public bool InstallMissingDatabase => GetterWithDefaultValue("Umbraco.Core.RuntimeState.InstallMissingDatabase", false, ref _installMissingDatabase);
-
- private bool _installEmptyDatabase;
- public bool InstallEmptyDatabase => GetterWithDefaultValue("Umbraco.Core.RuntimeState.InstallEmptyDatabase", false, ref _installEmptyDatabase);
-
- private bool _disableElectionForSingleServer;
- public bool DisableElectionForSingleServer => GetterWithDefaultValue(Constants.AppSettings.DisableElectionForSingleServer, false, ref _disableElectionForSingleServer);
-
- private string _registerType;
- public string RegisterType => GetterWithDefaultValue(Constants.AppSettings.RegisterType, string.Empty, ref _registerType);
-
- private string _databaseFactoryServerVersion;
- public string DatabaseFactoryServerVersion => GetterWithDefaultValue(Constants.AppSettings.Debug.DatabaseFactoryServerVersion, string.Empty, ref _databaseFactoryServerVersion);
-
-
-
- private string _iconsPath;
- ///
- /// Gets the path to folder containing the icons used in the umbraco backoffice (/umbraco/assets/icons by default).
- ///
- /// The icons path.
- public string IconsPath => GetterWithDefaultValue(Constants.AppSettings.IconsPath, $"{UmbracoPath}/assets/icons", ref _iconsPath);
-
- private string _mainDomLock;
-
- public string MainDomLock => GetterWithDefaultValue(Constants.AppSettings.MainDomLock, string.Empty, ref _mainDomLock);
-
- private T GetterWithDefaultValue(string appSettingKey, T defaultValue, ref T backingField)
- {
- if (backingField != null) return backingField;
-
- if (ConfigurationManager.AppSettings.ContainsKey(appSettingKey))
- {
- try
- {
- var value = ConfigurationManager.AppSettings[appSettingKey];
-
- backingField = (T)Convert.ChangeType(value, typeof(T));
- }
- catch
- {
- /* ignore and use default value */
- backingField = defaultValue;
- }
- }
- else
- {
- backingField = defaultValue;
- }
-
- return backingField;
- }
-
- ///
- /// Gets the path to the razor file used when no published content is available.
- ///
- public string NoNodesViewPath
- {
- get
- {
- var configuredValue = ConfigurationManager.AppSettings[Constants.AppSettings.NoNodesViewPath];
- if (!string.IsNullOrWhiteSpace(configuredValue))
- {
- return configuredValue;
- }
-
- return "~/config/splashes/NoNodes.cshtml";
- }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/HealthChecksSettings.cs b/src/Umbraco.Configuration/Legacy/HealthChecksSettings.cs
deleted file mode 100644
index 23385d1378..0000000000
--- a/src/Umbraco.Configuration/Legacy/HealthChecksSettings.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System.Collections.Generic;
-using System.Configuration;
-using Umbraco.Core.Configuration.HealthChecks;
-
-namespace Umbraco.Core.Configuration.Legacy
-{
- public class HealthChecksSettings : IHealthChecksSettings
- {
- private HealthChecksSection _healthChecksSection;
-
- private HealthChecksSection HealthChecksSection
- {
- get
- {
- if (_healthChecksSection is null)
- {
- _healthChecksSection = ConfigurationManager.GetSection("umbracoConfiguration/HealthChecks") as HealthChecksSection;
- }
- return _healthChecksSection;
- }
- }
-
- public IEnumerable DisabledChecks => HealthChecksSection.DisabledChecks;
- public IHealthCheckNotificationSettings NotificationSettings => HealthChecksSection.NotificationSettings;
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/HostingSettings.cs b/src/Umbraco.Configuration/Legacy/HostingSettings.cs
deleted file mode 100644
index 1858e8a4a4..0000000000
--- a/src/Umbraco.Configuration/Legacy/HostingSettings.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.Legacy
-{
- public class HostingSettings : IHostingSettings
- {
- private bool? _debugMode;
-
- ///
- public LocalTempStorage LocalTempStorageLocation
- {
- get
- {
- var setting = ConfigurationManager.AppSettings[Constants.AppSettings.LocalTempStorage];
- if (!string.IsNullOrWhiteSpace(setting))
- return Enum.Parse(setting);
-
- return LocalTempStorage.Default;
- }
- }
-
- public string ApplicationVirtualPath => null;
-
- ///
- /// Gets a value indicating whether umbraco is running in [debug mode].
- ///
- /// true if [debug mode]; otherwise, false.
- public bool DebugMode
- {
- get
- {
- if (!_debugMode.HasValue)
- {
- try
- {
- if (ConfigurationManager.GetSection("system.web/compilation") is ConfigurationSection compilation)
- {
- var debugElement = compilation.ElementInformation.Properties["debug"];
-
- _debugMode = debugElement != null && (debugElement.Value is bool debug && debug);
-
- }
- }
- catch
- {
- _debugMode = false;
- }
- }
-
- return _debugMode.GetValueOrDefault();
- }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/IndexCreatorSettings.cs b/src/Umbraco.Configuration/Legacy/IndexCreatorSettings.cs
deleted file mode 100644
index d023d46246..0000000000
--- a/src/Umbraco.Configuration/Legacy/IndexCreatorSettings.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Configuration;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Legacy
-{
- public class IndexCreatorSettings : IIndexCreatorSettings
- {
- public IndexCreatorSettings()
- {
- LuceneDirectoryFactory = ConfigurationManager.AppSettings["Umbraco.Examine.LuceneDirectoryFactory"];
- }
-
- public string LuceneDirectoryFactory { get; }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/InnerTextConfigurationElement.cs b/src/Umbraco.Configuration/Legacy/InnerTextConfigurationElement.cs
deleted file mode 100644
index 6a125f2c1b..0000000000
--- a/src/Umbraco.Configuration/Legacy/InnerTextConfigurationElement.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-using System;
-using System.Xml;
-using System.Xml.Linq;
-
-namespace Umbraco.Core.Configuration
-{
- ///
- /// A full config section is required for any full element and we have some elements that are defined like this:
- /// {element}MyValue{/element} instead of as attribute values.
- ///
- ///
- internal class InnerTextConfigurationElement : RawXmlConfigurationElement
- {
- public InnerTextConfigurationElement()
- {
- }
-
- public InnerTextConfigurationElement(XElement rawXml) : base(rawXml)
- {
- }
-
- protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey)
- {
- base.DeserializeElement(reader, serializeCollectionKey);
- //now validate and set the raw value
- if (RawXml.HasElements)
- throw new InvalidOperationException("An InnerTextConfigurationElement cannot contain any child elements, only attributes and a value");
- RawValue = RawXml.Value.Trim();
-
- //RawValue = reader.ReadElementContentAsString();
- }
-
- public virtual T Value
- {
- get
- {
- var converted = RawValue.TryConvertTo();
- if (converted.Success == false)
- throw new InvalidCastException("Could not convert value " + RawValue + " to type " + typeof(T));
- return converted.Result;
- }
- }
-
- ///
- /// Exposes the raw string value
- ///
- internal string RawValue { get; set; }
-
- ///
- /// Implicit operator so we don't need to use the 'Value' property explicitly
- ///
- ///
- ///
- public static implicit operator T(InnerTextConfigurationElement m)
- {
- return m.Value;
- }
-
- ///
- /// Return the string value of Value
- ///
- ///
- public override string ToString()
- {
- return string.Format("{0}", Value);
- }
-
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/KeepAliveSettings.cs b/src/Umbraco.Configuration/Legacy/KeepAliveSettings.cs
deleted file mode 100644
index 0b8315d447..0000000000
--- a/src/Umbraco.Configuration/Legacy/KeepAliveSettings.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using Umbraco.Core.Configuration.UmbracoSettings;
-
-namespace Umbraco.Configuration.Implementations
-{
- internal class KeepAliveSettings : ConfigurationManagerConfigBase, IKeepAliveSettings
- {
- public bool DisableKeepAliveTask => UmbracoSettingsSection.KeepAlive.DisableKeepAliveTask;
- public string KeepAlivePingUrl => UmbracoSettingsSection.KeepAlive.KeepAlivePingUrl;
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/LoggingSettings.cs b/src/Umbraco.Configuration/Legacy/LoggingSettings.cs
deleted file mode 100644
index 020b0c0e64..0000000000
--- a/src/Umbraco.Configuration/Legacy/LoggingSettings.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using Umbraco.Core.Configuration.UmbracoSettings;
-
-namespace Umbraco.Configuration.Implementations
-{
- internal class LoggingSettings : ConfigurationManagerConfigBase, ILoggingSettings
- {
- public int MaxLogAge => UmbracoSettingsSection.Logging.MaxLogAge;
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/MemberPasswordConfigurationSettings.cs b/src/Umbraco.Configuration/Legacy/MemberPasswordConfigurationSettings.cs
deleted file mode 100644
index e42b02de73..0000000000
--- a/src/Umbraco.Configuration/Legacy/MemberPasswordConfigurationSettings.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Implementations
-{
- internal class MemberPasswordConfigurationSettings : ConfigurationManagerConfigBase, IMemberPasswordConfiguration
- {
- public int RequiredLength => UmbracoSettingsSection.Security.UserPasswordConfiguration.RequiredLength;
- public bool RequireNonLetterOrDigit => UmbracoSettingsSection.Security.UserPasswordConfiguration.RequireNonLetterOrDigit;
- public bool RequireDigit => UmbracoSettingsSection.Security.UserPasswordConfiguration.RequireDigit;
- public bool RequireLowercase=> UmbracoSettingsSection.Security.UserPasswordConfiguration.RequireLowercase;
- public bool RequireUppercase=> UmbracoSettingsSection.Security.UserPasswordConfiguration.RequireUppercase;
- public bool UseLegacyEncoding=> UmbracoSettingsSection.Security.UserPasswordConfiguration.UseLegacyEncoding;
- public string HashAlgorithmType=> UmbracoSettingsSection.Security.UserPasswordConfiguration.HashAlgorithmType;
- public int MaxFailedAccessAttemptsBeforeLockout => UmbracoSettingsSection.Security.UserPasswordConfiguration.MaxFailedAccessAttemptsBeforeLockout;
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/ModelsBuilderConfig.cs b/src/Umbraco.Configuration/Legacy/ModelsBuilderConfig.cs
deleted file mode 100644
index f6395b23b4..0000000000
--- a/src/Umbraco.Configuration/Legacy/ModelsBuilderConfig.cs
+++ /dev/null
@@ -1,200 +0,0 @@
-using System;
-using System.Configuration;
-using System.IO;
-using System.Threading;
-using Umbraco.Core.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.IO;
-
-namespace Umbraco.Configuration.Legacy
-{
- ///
- /// Represents the models builder configuration.
- ///
- public class ModelsBuilderConfig : IModelsBuilderConfig
- {
-
- private const string Prefix = "Umbraco.ModelsBuilder.";
- private object _modelsModelLock;
- private bool _modelsModelConfigured;
- private ModelsMode _modelsMode;
- private object _flagOutOfDateModelsLock;
- private bool _flagOutOfDateModelsConfigured;
- private bool _flagOutOfDateModels;
-
-
- public string DefaultModelsDirectory => "~/App_Data/Models";
-
- ///
- /// Initializes a new instance of the class.
- ///
- public ModelsBuilderConfig()
- {
- // giant kill switch, default: false
- // must be explicitely set to true for anything else to happen
- Enable = ConfigurationManager.AppSettings[Prefix + "Enable"] == "true";
-
- // ensure defaults are initialized for tests
- ModelsNamespace = Constants.ModelsBuilder.DefaultModelsNamespace;
- ModelsDirectory = DefaultModelsDirectory;
- DebugLevel = 0;
-
- // stop here, everything is false
- if (!Enable) return;
-
- // default: false
- AcceptUnsafeModelsDirectory = ConfigurationManager.AppSettings[Prefix + "AcceptUnsafeModelsDirectory"].InvariantEquals("true");
-
- // default: true
- EnableFactory = !ConfigurationManager.AppSettings[Prefix + "EnableFactory"].InvariantEquals("false");
-
- // default: initialized above with DefaultModelsNamespace const
- var value = ConfigurationManager.AppSettings[Prefix + "ModelsNamespace"];
- if (!string.IsNullOrWhiteSpace(value))
- ModelsNamespace = value;
-
- // default: initialized above with DefaultModelsDirectory const
- value = ConfigurationManager.AppSettings[Prefix + "ModelsDirectory"];
- if (!string.IsNullOrWhiteSpace(value))
- {
- // GetModelsDirectory will ensure that the path is safe
- ModelsDirectory = value;
- }
-
- // default: 0
- value = ConfigurationManager.AppSettings[Prefix + "DebugLevel"];
- if (!string.IsNullOrWhiteSpace(value))
- {
- if (!int.TryParse(value, out var debugLevel))
- throw new ConfigurationErrorsException($"Invalid debug level \"{value}\".");
- DebugLevel = debugLevel;
- }
-
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- public ModelsBuilderConfig(
- bool enable = false,
- ModelsMode modelsMode = ModelsMode.Nothing,
- string modelsNamespace = null,
- bool enableFactory = true,
- bool flagOutOfDateModels = true,
- string modelsDirectory = null,
- bool acceptUnsafeModelsDirectory = false,
- int debugLevel = 0)
- {
- Enable = enable;
- _modelsMode = modelsMode;
-
- ModelsNamespace = string.IsNullOrWhiteSpace(modelsNamespace) ? Constants.ModelsBuilder.DefaultModelsNamespace : modelsNamespace;
- EnableFactory = enableFactory;
- _flagOutOfDateModels = flagOutOfDateModels;
- ModelsDirectory = string.IsNullOrWhiteSpace(modelsDirectory) ? DefaultModelsDirectory : modelsDirectory;
- AcceptUnsafeModelsDirectory = acceptUnsafeModelsDirectory;
- DebugLevel = debugLevel;
- }
-
-
-
- ///
- /// Gets a value indicating whether the whole models experience is enabled.
- ///
- ///
- /// If this is false then absolutely nothing happens.
- /// Default value is false which means that unless we have this setting, nothing happens.
- ///
- public bool Enable { get; }
-
- ///
- /// Gets the models mode.
- ///
- public ModelsMode ModelsMode =>
- LazyInitializer.EnsureInitialized(ref _modelsMode, ref _modelsModelConfigured, ref _modelsModelLock, () =>
- {
- // mode
- var modelsMode = ConfigurationManager.AppSettings[Prefix + "ModelsMode"];
- if (string.IsNullOrWhiteSpace(modelsMode)) return ModelsMode.Nothing; //default
- switch (modelsMode)
- {
- case nameof(ModelsMode.Nothing):
- return ModelsMode.Nothing;
- case nameof(ModelsMode.PureLive):
- return ModelsMode.PureLive;
- case nameof(ModelsMode.AppData):
- return ModelsMode.AppData;
- case nameof(ModelsMode.LiveAppData):
- return ModelsMode.LiveAppData;
- default:
- throw new ConfigurationErrorsException($"ModelsMode \"{modelsMode}\" is not a valid mode." + " Note that modes are case-sensitive. Possible values are: " + string.Join(", ", Enum.GetNames(typeof(ModelsMode))));
- }
- });
-
- ///
- /// Gets a value indicating whether system.web/compilation/@debug is true.
- ///
- public bool IsDebug
- {
- get
- {
- if (ConfigurationManager.GetSection("system.web/compilation") is ConfigurationSection section &&
- bool.TryParse(section.ElementInformation.Properties["debug"].Value.ToString(), out var isDebug))
- {
- return isDebug;
- }
-
- return false;
- }
- }
-
- ///
- /// Gets the models namespace.
- ///
- /// That value could be overriden by other (attribute in user's code...). Return default if no value was supplied.
- public string ModelsNamespace { get; }
-
- ///
- /// Gets a value indicating whether we should enable the models factory.
- ///
- /// Default value is true because no factory is enabled by default in Umbraco.
- public bool EnableFactory { get; }
-
- ///
- /// Gets a value indicating whether we should flag out-of-date models.
- ///
- /// Models become out-of-date when data types or content types are updated. When this
- /// setting is activated the ~/App_Data/Models/ood.txt file is then created. When models are
- /// generated through the dashboard, the files is cleared. Default value is false.
- public bool FlagOutOfDateModels
- => LazyInitializer.EnsureInitialized(ref _flagOutOfDateModels, ref _flagOutOfDateModelsConfigured, ref _flagOutOfDateModelsLock, () =>
- {
- var flagOutOfDateModels = !ConfigurationManager.AppSettings[Prefix + "FlagOutOfDateModels"].InvariantEquals("false");
- if (ModelsMode == ModelsMode.Nothing || ModelsMode.IsLive())
- {
- flagOutOfDateModels = false;
- }
-
- return flagOutOfDateModels;
- });
-
- ///
- /// Gets the models directory.
- ///
- /// Default is ~/App_Data/Models but that can be changed.
- public string ModelsDirectory { get; }
-
- ///
- /// Gets a value indicating whether to accept an unsafe value for ModelsDirectory.
- ///
- /// An unsafe value is an absolute path, or a relative path pointing outside
- /// of the website root.
- public bool AcceptUnsafeModelsDirectory { get; }
-
- ///
- /// Gets a value indicating the debug log level.
- ///
- /// 0 means minimal (safe on live site), anything else means more and more details (maybe not safe).
- public int DebugLevel { get; }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/NuCacheSettings.cs b/src/Umbraco.Configuration/Legacy/NuCacheSettings.cs
deleted file mode 100644
index 25f52a5c7d..0000000000
--- a/src/Umbraco.Configuration/Legacy/NuCacheSettings.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Configuration;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Legacy
-{
- public class NuCacheSettings : INuCacheSettings
- {
- public NuCacheSettings()
- {
- BTreeBlockSize = ConfigurationManager.AppSettings["Umbraco.Web.PublishedCache.NuCache.BTree.BlockSize"];
- }
- public string BTreeBlockSize { get; }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/OptionalCommaDelimitedConfigurationElement.cs b/src/Umbraco.Configuration/Legacy/OptionalCommaDelimitedConfigurationElement.cs
deleted file mode 100644
index 610067d2db..0000000000
--- a/src/Umbraco.Configuration/Legacy/OptionalCommaDelimitedConfigurationElement.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System.Configuration;
-using Umbraco.Core.Configuration.UmbracoSettings;
-
-namespace Umbraco.Core.Configuration
-{
- ///
- /// Used for specifying default values for comma delimited config
- ///
- internal class OptionalCommaDelimitedConfigurationElement : CommaDelimitedConfigurationElement
- {
- private readonly CommaDelimitedConfigurationElement _wrapped;
- private readonly string[] _defaultValue;
-
- public OptionalCommaDelimitedConfigurationElement()
- {
- }
-
- public OptionalCommaDelimitedConfigurationElement(CommaDelimitedConfigurationElement wrapped, string[] defaultValue)
- {
- _wrapped = wrapped;
- _defaultValue = defaultValue;
- }
-
- public override CommaDelimitedStringCollection Value
- {
- get
- {
- if (_wrapped == null)
- {
- return base.Value;
- }
-
- if (string.IsNullOrEmpty(_wrapped.RawValue))
- {
- var val = new CommaDelimitedStringCollection();
- val.AddRange(_defaultValue);
- return val;
- }
- return _wrapped.Value;
- }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/OptionalInnerTextConfigurationElement.cs b/src/Umbraco.Configuration/Legacy/OptionalInnerTextConfigurationElement.cs
deleted file mode 100644
index b15e33019d..0000000000
--- a/src/Umbraco.Configuration/Legacy/OptionalInnerTextConfigurationElement.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace Umbraco.Core.Configuration
-{
- ///
- /// This is used to supply optional/default values when using InnerTextConfigurationElement
- ///
- ///
- internal class OptionalInnerTextConfigurationElement : InnerTextConfigurationElement
- {
- private readonly InnerTextConfigurationElement _wrapped;
- private readonly T _defaultValue;
-
- public OptionalInnerTextConfigurationElement(InnerTextConfigurationElement wrapped, T defaultValue)
- {
- _wrapped = wrapped;
- _defaultValue = defaultValue;
- }
-
- public override T Value
- {
- get { return string.IsNullOrEmpty(_wrapped.RawValue) ? _defaultValue : _wrapped.Value; }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/RawXmlConfigurationElement.cs b/src/Umbraco.Configuration/Legacy/RawXmlConfigurationElement.cs
deleted file mode 100644
index 5bc6ad3d32..0000000000
--- a/src/Umbraco.Configuration/Legacy/RawXmlConfigurationElement.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System.Configuration;
-using System.Xml;
-using System.Xml.Linq;
-
-namespace Umbraco.Core.Configuration
-{
- ///
- /// A configuration section that simply exposes the entire raw xml of the section itself which inheritors can use
- /// to do with as they please.
- ///
- internal abstract class RawXmlConfigurationElement : ConfigurationElement
- {
- protected RawXmlConfigurationElement()
- {
-
- }
-
- protected RawXmlConfigurationElement(XElement rawXml)
- {
- RawXml = rawXml;
- }
-
- protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey)
- {
- RawXml = (XElement)XNode.ReadFrom(reader);
- }
-
- protected XElement RawXml { get; private set; }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/RequestHandlerSettings.cs b/src/Umbraco.Configuration/Legacy/RequestHandlerSettings.cs
deleted file mode 100644
index 1c54f4d475..0000000000
--- a/src/Umbraco.Configuration/Legacy/RequestHandlerSettings.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
-
-namespace Umbraco.Configuration.Implementations
-{
- internal class RequestHandlerSettings : ConfigurationManagerConfigBase, IRequestHandlerSettings
- {
- public bool AddTrailingSlash => UmbracoSettingsSection?.RequestHandler?.AddTrailingSlash ?? true;
- public bool ConvertUrlsToAscii => UmbracoSettingsSection?.RequestHandler?.UrlReplacing?.ConvertUrlsToAscii.InvariantEquals("true") ?? false;
- public bool TryConvertUrlsToAscii => UmbracoSettingsSection?.RequestHandler?.UrlReplacing?.ConvertUrlsToAscii.InvariantEquals("try") ?? false;
- public IEnumerable CharCollection => UmbracoSettingsSection?.RequestHandler?.UrlReplacing?.CharCollection ?? Enumerable.Empty();
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/RuntimeSettings.cs b/src/Umbraco.Configuration/Legacy/RuntimeSettings.cs
deleted file mode 100644
index 200642a819..0000000000
--- a/src/Umbraco.Configuration/Legacy/RuntimeSettings.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System.Configuration;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Legacy
-{
- public class RuntimeSettings : IRuntimeSettings
- {
- public RuntimeSettings()
- {
- if (ConfigurationManager.GetSection("system.web/httpRuntime") is ConfigurationSection section)
- {
- var maxRequestLengthProperty = section.ElementInformation.Properties["maxRequestLength"];
- if (maxRequestLengthProperty != null && maxRequestLengthProperty.Value is int requestLength)
- {
- MaxRequestLength = requestLength;
- }
-
- var maxQueryStringProperty = section.ElementInformation.Properties["maxQueryStringLength"];
- if (maxQueryStringProperty != null && maxQueryStringProperty.Value is int maxQueryStringLength)
- {
- MaxQueryStringLength = maxQueryStringLength;
- }
- }
- }
- public int? MaxQueryStringLength { get; }
- public int? MaxRequestLength { get; }
-
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/SecuritySettings.cs b/src/Umbraco.Configuration/Legacy/SecuritySettings.cs
deleted file mode 100644
index b7e39b0608..0000000000
--- a/src/Umbraco.Configuration/Legacy/SecuritySettings.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using Umbraco.Core.Configuration.UmbracoSettings;
-
-namespace Umbraco.Configuration.Implementations
-{
- internal class SecuritySettings : ConfigurationManagerConfigBase, ISecuritySettings
- {
- public bool KeepUserLoggedIn => UmbracoSettingsSection.Security.KeepUserLoggedIn;
- public bool HideDisabledUsersInBackoffice => UmbracoSettingsSection.Security.HideDisabledUsersInBackoffice;
- public bool AllowPasswordReset => UmbracoSettingsSection.Security.AllowPasswordReset;
- public string AuthCookieName => UmbracoSettingsSection.Security.AuthCookieName;
- public string AuthCookieDomain => UmbracoSettingsSection.Security.AuthCookieDomain;
- public bool UsernameIsEmail => UmbracoSettingsSection.Security.UsernameIsEmail;
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/TourSettings.cs b/src/Umbraco.Configuration/Legacy/TourSettings.cs
deleted file mode 100644
index 134c3c48d5..0000000000
--- a/src/Umbraco.Configuration/Legacy/TourSettings.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using Umbraco.Core.Configuration.UmbracoSettings;
-
-namespace Umbraco.Configuration.Implementations
-{
- internal class TourSettings : ConfigurationManagerConfigBase, ITourSettings
- {
- public bool EnableTours => UmbracoSettingsSection.BackOffice.Tours.EnableTours;
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/TypeFinderSettings.cs b/src/Umbraco.Configuration/Legacy/TypeFinderSettings.cs
deleted file mode 100644
index b1009f754b..0000000000
--- a/src/Umbraco.Configuration/Legacy/TypeFinderSettings.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Legacy
-{
- public class TypeFinderSettings : ITypeFinderSettings
- {
- public TypeFinderSettings()
- {
- AssembliesAcceptingLoadExceptions = ConfigurationManager.AppSettings[
- Constants.AppSettings.AssembliesAcceptingLoadExceptions];
- }
-
- public string AssembliesAcceptingLoadExceptions { get; }
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/UmbracoConfigurationSection.cs b/src/Umbraco.Configuration/Legacy/UmbracoConfigurationSection.cs
deleted file mode 100644
index 8c0754b91d..0000000000
--- a/src/Umbraco.Configuration/Legacy/UmbracoConfigurationSection.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration
-{
- ///
- /// Represents an Umbraco section within the configuration file.
- ///
- ///
- /// The requirement for these sections is to be read-only.
- /// However for unit tests purposes it is internally possible to override some values, and
- /// then calling >ResetSection should cancel these changes and bring the section back to
- /// what it was originally.
- /// The UmbracoSettings.For{T} method will return a section, either one that
- /// is in the configuration file, or a section that was created with default values.
- ///
- public abstract class UmbracoConfigurationSection : ConfigurationSection, IUmbracoConfigurationSection
- {
- ///
- /// Gets a value indicating whether the section actually is in the configuration file.
- ///
- protected bool IsPresent { get { return ElementInformation.IsPresent; } }
-
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/UserPasswordConfigurationSettings.cs b/src/Umbraco.Configuration/Legacy/UserPasswordConfigurationSettings.cs
deleted file mode 100644
index 51dd645c42..0000000000
--- a/src/Umbraco.Configuration/Legacy/UserPasswordConfigurationSettings.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using Umbraco.Core.Configuration;
-namespace Umbraco.Configuration.Implementations
-{
- internal class UserPasswordConfigurationSettings : ConfigurationManagerConfigBase, IUserPasswordConfiguration
- {
- public int RequiredLength => UmbracoSettingsSection.Security.UserPasswordConfiguration.RequiredLength;
- public bool RequireNonLetterOrDigit => UmbracoSettingsSection.Security.UserPasswordConfiguration.RequireNonLetterOrDigit;
- public bool RequireDigit => UmbracoSettingsSection.Security.UserPasswordConfiguration.RequireDigit;
- public bool RequireLowercase=> UmbracoSettingsSection.Security.UserPasswordConfiguration.RequireLowercase;
- public bool RequireUppercase=> UmbracoSettingsSection.Security.UserPasswordConfiguration.RequireUppercase;
- public bool UseLegacyEncoding=> UmbracoSettingsSection.Security.UserPasswordConfiguration.UseLegacyEncoding;
- public string HashAlgorithmType=> UmbracoSettingsSection.Security.UserPasswordConfiguration.HashAlgorithmType;
- public int MaxFailedAccessAttemptsBeforeLockout => UmbracoSettingsSection.Security.UserPasswordConfiguration.MaxFailedAccessAttemptsBeforeLockout;
- }
-}
diff --git a/src/Umbraco.Configuration/Legacy/WebRoutingSettings.cs b/src/Umbraco.Configuration/Legacy/WebRoutingSettings.cs
deleted file mode 100644
index cfca66822b..0000000000
--- a/src/Umbraco.Configuration/Legacy/WebRoutingSettings.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using Umbraco.Core.Configuration.UmbracoSettings;
-
-namespace Umbraco.Configuration.Implementations
-{
- internal class WebRoutingSettings : ConfigurationManagerConfigBase, IWebRoutingSettings
- {
- public bool TrySkipIisCustomErrors => UmbracoSettingsSection?.WebRouting?.TrySkipIisCustomErrors ?? false;
- public bool InternalRedirectPreservesTemplate => UmbracoSettingsSection?.WebRouting?.InternalRedirectPreservesTemplate ?? false;
- public bool DisableAlternativeTemplates => UmbracoSettingsSection?.WebRouting?.DisableAlternativeTemplates ?? false;
- public bool ValidateAlternativeTemplates => UmbracoSettingsSection?.WebRouting?.ValidateAlternativeTemplates ?? false;
- public bool DisableFindContentByIdPath => UmbracoSettingsSection?.WebRouting?.DisableFindContentByIdPath ?? false;
- public bool DisableRedirectUrlTracking => UmbracoSettingsSection?.WebRouting?.DisableRedirectUrlTracking ?? false;
- public string UrlProviderMode => UmbracoSettingsSection?.WebRouting?.UrlProviderMode ?? "Auto";
- public string UmbracoApplicationUrl => UmbracoSettingsSection?.WebRouting?.UmbracoApplicationUrl;
- }
-}
diff --git a/src/Umbraco.Configuration/Models/ActiveDirectorySettings.cs b/src/Umbraco.Configuration/Models/ActiveDirectorySettings.cs
deleted file mode 100644
index 015fb17a8e..0000000000
--- a/src/Umbraco.Configuration/Models/ActiveDirectorySettings.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Models
-{
- internal class ActiveDirectorySettings : IActiveDirectorySettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "ActiveDirectory:";
- private readonly IConfiguration _configuration;
-
- public ActiveDirectorySettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public string ActiveDirectoryDomain => _configuration.GetValue(Prefix+"Domain");
- }
-}
diff --git a/src/Umbraco.Configuration/Models/ConnectionStrings.cs b/src/Umbraco.Configuration/Models/ConnectionStrings.cs
deleted file mode 100644
index 586765714c..0000000000
--- a/src/Umbraco.Configuration/Models/ConnectionStrings.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-using System;
-using System.Data.Common;
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Models
-{
- public class ConnectionStrings : IConnectionStrings
- {
- private readonly IConfiguration _configuration;
-
- public ConnectionStrings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public ConfigConnectionString this[string key]
- {
- get
- {
- var connectionString = _configuration.GetConnectionString(key);
- var provider = ParseProvider(connectionString);
- return new ConfigConnectionString(connectionString, provider, key);
- }
- set => throw new NotImplementedException();
- }
-
- private string ParseProvider(string connectionString)
- {
- if (string.IsNullOrEmpty(connectionString))
- {
- return null;
- }
-
- var builder = new DbConnectionStringBuilder();
-
- builder.ConnectionString = connectionString;
-
- if (builder.TryGetValue("Data Source", out var ds) && ds is string dataSource)
- {
- if (dataSource.EndsWith(".sdf"))
- {
- return Constants.DbProviderNames.SqlCe;
- }
- }
-
- if (builder.TryGetValue("Server", out var s) && s is string server && !string.IsNullOrEmpty(server))
- {
- if (builder.TryGetValue("Database", out var db) && db is string database && !string.IsNullOrEmpty(database))
- {
- return Constants.DbProviderNames.SqlServer;
- }
-
- if (builder.TryGetValue("AttachDbFileName", out var a) && a is string attachDbFileName && !string.IsNullOrEmpty(attachDbFileName))
- {
- return Constants.DbProviderNames.SqlServer;
- }
-
- if (builder.TryGetValue("Initial Catalog", out var i) && i is string initialCatalog && !string.IsNullOrEmpty(initialCatalog))
- {
- return Constants.DbProviderNames.SqlServer;
- }
- }
-
- throw new ArgumentException("Cannot determine provider name from connection string", nameof(connectionString));
- }
- }
-}
diff --git a/src/Umbraco.Configuration/Models/ContentSettings.cs b/src/Umbraco.Configuration/Models/ContentSettings.cs
deleted file mode 100644
index 6c9b986dd1..0000000000
--- a/src/Umbraco.Configuration/Models/ContentSettings.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
-using Umbraco.Core.Macros;
-
-namespace Umbraco.Configuration.Models
-{
- internal class ContentSettings : IContentSettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "Content:";
- private const string NotificationsPrefix = Prefix + "Notifications:";
- private const string ImagingPrefix = Prefix + "Imaging:";
- private const string DefaultPreviewBadge =
- @"";
-
- private static readonly ImagingAutoFillUploadField[] DefaultImagingAutoFillUploadField =
- {
- new ImagingAutoFillUploadField
- {
- Alias = Constants.Conventions.Media.File,
- WidthFieldAlias = Constants.Conventions.Media.Width,
- HeightFieldAlias =Constants.Conventions.Media.Height,
- ExtensionFieldAlias =Constants.Conventions.Media.Extension,
- LengthFieldAlias =Constants.Conventions.Media.Bytes,
- }
- };
-
- private readonly IConfiguration _configuration;
-
- public ContentSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public string NotificationEmailAddress =>
- _configuration.GetValue(NotificationsPrefix+"Email");
-
- public bool DisableHtmlEmail =>
- _configuration.GetValue(NotificationsPrefix+"DisableHtmlEmail", false);
-
- public IEnumerable ImageFileTypes => _configuration.GetValue(
- ImagingPrefix+"ImageFileTypes", new[] { "jpeg", "jpg", "gif", "bmp", "png", "tiff", "tif" });
-
- public IEnumerable ImageAutoFillProperties =>
- _configuration.GetValue(ImagingPrefix+"AutoFillImageProperties",
- DefaultImagingAutoFillUploadField);
-
-
- public bool ResolveUrlsFromTextString =>
- _configuration.GetValue(Prefix+"ResolveUrlsFromTextString", false);
-
- public IEnumerable Error404Collection => _configuration
- .GetSection(Prefix+"Errors:Error404")
- .GetChildren()
- .Select(x => new ContentErrorPage(x));
-
- public string PreviewBadge => _configuration.GetValue(Prefix+"PreviewBadge", DefaultPreviewBadge);
-
- public MacroErrorBehaviour MacroErrorBehaviour =>
- _configuration.GetValue(Prefix+"MacroErrors", MacroErrorBehaviour.Inline);
-
- public IEnumerable DisallowedUploadFiles => _configuration.GetValue(
- Prefix+"DisallowedUploadFiles",
- new[] { "ashx", "aspx", "ascx", "config", "cshtml", "vbhtml", "asmx", "air", "axd" });
-
- public IEnumerable AllowedUploadFiles =>
- _configuration.GetValue(Prefix+"AllowedUploadFiles", Array.Empty());
-
- public bool ShowDeprecatedPropertyEditors =>
- _configuration.GetValue(Prefix+"ShowDeprecatedPropertyEditors", false);
-
- public string LoginBackgroundImage =>
- _configuration.GetValue(Prefix+"LoginBackgroundImage", "assets/img/login.jpg");
-
- private class ContentErrorPage : IContentErrorPage
- {
- public ContentErrorPage(IConfigurationSection configurationSection)
- {
- Culture = configurationSection.Key;
-
- var value = configurationSection.Value;
-
- if (int.TryParse(value, out var contentId))
- {
- HasContentId = true;
- ContentId = contentId;
- }
- else if (Guid.TryParse(value, out var contentKey))
- {
- HasContentKey = true;
- ContentKey = contentKey;
- }
- else
- {
- ContentXPath = value;
- }
- }
-
- public int ContentId { get; }
- public Guid ContentKey { get; }
- public string ContentXPath { get; }
- public bool HasContentId { get; }
- public bool HasContentKey { get; }
- public string Culture { get; set; }
- }
-
- private class ImagingAutoFillUploadField : IImagingAutoFillUploadField
- {
- public string Alias { get; set; }
- public string WidthFieldAlias { get; set; }
- public string HeightFieldAlias { get; set; }
- public string LengthFieldAlias { get; set; }
- public string ExtensionFieldAlias { get; set; }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/Models/CoreDebugSettings.cs b/src/Umbraco.Configuration/Models/CoreDebugSettings.cs
deleted file mode 100644
index 6d6c0eaf0d..0000000000
--- a/src/Umbraco.Configuration/Models/CoreDebugSettings.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Models
-{
- internal class CoreDebugSettings : ICoreDebugSettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "Core:Debug:";
- private readonly IConfiguration _configuration;
-
- public CoreDebugSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public bool LogUncompletedScopes =>
- _configuration.GetValue(Prefix+"LogUncompletedScopes", false);
-
- public bool DumpOnTimeoutThreadAbort =>
- _configuration.GetValue(Prefix+"DumpOnTimeoutThreadAbort", false);
- }
-}
diff --git a/src/Umbraco.Configuration/Models/ExceptionFilterSettings.cs b/src/Umbraco.Configuration/Models/ExceptionFilterSettings.cs
deleted file mode 100644
index 581daf9f40..0000000000
--- a/src/Umbraco.Configuration/Models/ExceptionFilterSettings.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Models
-{
- internal class ExceptionFilterSettings : IExceptionFilterSettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "ExceptionFilter:";
- private readonly IConfiguration _configuration;
-
- public ExceptionFilterSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public bool Disabled => _configuration.GetValue(Prefix+"Disabled", false);
- }
-}
diff --git a/src/Umbraco.Configuration/Models/GlobalSettings.cs b/src/Umbraco.Configuration/Models/GlobalSettings.cs
deleted file mode 100644
index 02b73d1196..0000000000
--- a/src/Umbraco.Configuration/Models/GlobalSettings.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-using System;
-using System.Linq;
-using System.Net.Mail;
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Models
-{
- ///
- /// The GlobalSettings Class contains general settings information for the entire Umbraco instance based on information
- /// from web.config appsettings
- ///
- internal class GlobalSettings : IGlobalSettings
- {
- private const string Prefix = Constants.Configuration.ConfigGlobalPrefix;
-
- internal const string
- StaticReservedPaths = "~/app_plugins/,~/install/,~/mini-profiler-resources/,"; //must end with a comma!
-
- internal const string
- StaticReservedUrls = "~/config/splashes/noNodes.aspx,~/.well-known,"; //must end with a comma!
-
- private readonly IConfiguration _configuration;
-
- public GlobalSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public string ReservedUrls => _configuration.GetValue(Prefix + "ReservedUrls", StaticReservedUrls);
- public string ReservedPaths => _configuration.GetValue(Prefix + "ReservedPaths", StaticReservedPaths);
-
- // TODO: https://github.com/umbraco/Umbraco-CMS/issues/4238 - stop having version in web.config appSettings
- public string ConfigurationStatus
- {
- get => _configuration.GetValue(Prefix + "ConfigurationStatus");
- set => throw new NotImplementedException("We should remove this and only use the value from database");
- }
-
- public int TimeOutInMinutes => _configuration.GetValue(Prefix + "TimeOutInMinutes", 20);
- public string DefaultUILanguage => _configuration.GetValue(Prefix + "DefaultUILanguage", "en-US");
-
- public bool HideTopLevelNodeFromPath =>
- _configuration.GetValue(Prefix + "HideTopLevelNodeFromPath", true);
-
- public bool UseHttps => _configuration.GetValue(Prefix + "UseHttps", false);
- public int VersionCheckPeriod => _configuration.GetValue(Prefix + "VersionCheckPeriod", 7);
- public string UmbracoPath => _configuration.GetValue(Prefix + "UmbracoPath", "~/umbraco");
- public string IconsPath => _configuration.GetValue(Prefix + "IconsPath", $"{UmbracoPath}/assets/icons");
-
- public string UmbracoCssPath => _configuration.GetValue(Prefix + "UmbracoCssPath", "~/css");
-
- public string UmbracoScriptsPath =>
- _configuration.GetValue(Prefix + "UmbracoScriptsPath", "~/scripts");
-
- public string UmbracoMediaPath => _configuration.GetValue(Prefix + "UmbracoMediaPath", "~/media");
-
- public bool InstallMissingDatabase =>
- _configuration.GetValue(Prefix + "InstallMissingDatabase", false);
-
- public bool InstallEmptyDatabase => _configuration.GetValue(Prefix + "InstallEmptyDatabase", false);
-
- public bool DisableElectionForSingleServer =>
- _configuration.GetValue(Prefix + "DisableElectionForSingleServer", false);
-
- public string RegisterType => _configuration.GetValue(Prefix + "RegisterType", string.Empty);
-
- public string DatabaseFactoryServerVersion =>
- _configuration.GetValue(Prefix + "DatabaseFactoryServerVersion", string.Empty);
-
- public string MainDomLock => _configuration.GetValue(Prefix + "MainDomLock", string.Empty);
-
- public string NoNodesViewPath =>
- _configuration.GetValue(Prefix + "NoNodesViewPath", "~/config/splashes/NoNodes.cshtml");
-
- public bool IsSmtpServerConfigured =>
- _configuration.GetSection(Constants.Configuration.ConfigGlobalPrefix + "Smtp")?.GetChildren().Any() ?? false;
-
- public ISmtpSettings SmtpSettings =>
- new SmtpSettingsImpl(_configuration.GetSection(Constants.Configuration.ConfigGlobalPrefix + "Smtp"));
-
- private class SmtpSettingsImpl : ISmtpSettings
- {
- private readonly IConfigurationSection _configurationSection;
-
- public SmtpSettingsImpl(IConfigurationSection configurationSection)
- {
- _configurationSection = configurationSection;
- }
-
- public string From => _configurationSection.GetValue("From");
- public string Host => _configurationSection.GetValue("Host");
- public int Port => _configurationSection.GetValue("Port");
- public string PickupDirectoryLocation => _configurationSection.GetValue("PickupDirectoryLocation");
- public SmtpDeliveryMethod DeliveryMethod => _configurationSection.GetValue("DeliveryMethod");
-
- public string Username => _configurationSection.GetValue("Username");
-
- public string Password => _configurationSection.GetValue("Password");
- }
- }
-}
diff --git a/src/Umbraco.Configuration/Models/HealthChecksSettingsSettings.cs b/src/Umbraco.Configuration/Models/HealthChecksSettingsSettings.cs
deleted file mode 100644
index 1e3751b6aa..0000000000
--- a/src/Umbraco.Configuration/Models/HealthChecksSettingsSettings.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration.HealthChecks;
-
-namespace Umbraco.Configuration.Models
-{
- internal class HealthChecksSettings : IHealthChecksSettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "HealthChecks:";
- private readonly IConfiguration _configuration;
-
- public HealthChecksSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public IEnumerable DisabledChecks => _configuration
- .GetSection(Prefix+"DisabledChecks")
- .GetChildren()
- .Select(
- x => new DisabledHealthCheck
- {
- Id = x.GetValue("Id"),
- DisabledOn = x.GetValue("DisabledOn"),
- DisabledBy = x.GetValue("DisabledBy")
- });
-
- public IHealthCheckNotificationSettings NotificationSettings =>
- new HealthCheckNotificationSettings(
- _configuration.GetSection(Prefix+"NotificationSettings"));
-
- private class DisabledHealthCheck : IDisabledHealthCheck
- {
- public Guid Id { get; set; }
- public DateTime DisabledOn { get; set; }
- public int DisabledBy { get; set; }
- }
-
- private class HealthCheckNotificationSettings : IHealthCheckNotificationSettings
- {
- private readonly IConfigurationSection _configurationSection;
-
- public HealthCheckNotificationSettings(IConfigurationSection configurationSection)
- {
- _configurationSection = configurationSection;
- }
-
- public bool Enabled => _configurationSection.GetValue("Enabled", false);
- public string FirstRunTime => _configurationSection.GetValue("FirstRunTime");
- public int PeriodInHours => _configurationSection.GetValue("PeriodInHours", 24);
-
- public IReadOnlyDictionary NotificationMethods => _configurationSection
- .GetSection("NotificationMethods")
- .GetChildren()
- .ToDictionary(x => x.Key, x => (INotificationMethod) new NotificationMethod(x.Key, x), StringComparer.InvariantCultureIgnoreCase);
-
- public IEnumerable DisabledChecks => _configurationSection
- .GetSection("DisabledChecks").GetChildren().Select(
- x => new DisabledHealthCheck
- {
- Id = x.GetValue("Id"),
- DisabledOn = x.GetValue("DisabledOn"),
- DisabledBy = x.GetValue("DisabledBy")
- });
- }
-
- private class NotificationMethod : INotificationMethod
- {
- private readonly IConfigurationSection _configurationSection;
-
- public NotificationMethod(string alias, IConfigurationSection configurationSection)
- {
- Alias = alias;
- _configurationSection = configurationSection;
- }
-
- public string Alias { get; }
- public bool Enabled => _configurationSection.GetValue("Enabled", false);
-
- public HealthCheckNotificationVerbosity Verbosity =>
- _configurationSection.GetValue("Verbosity", HealthCheckNotificationVerbosity.Summary);
-
- public bool FailureOnly => _configurationSection.GetValue("FailureOnly", true);
-
- public IReadOnlyDictionary Settings => _configurationSection
- .GetSection("Settings").GetChildren().ToDictionary(x => x.Key,
- x => (INotificationMethodSettings) new NotificationMethodSettings(x.Key, x.Value), StringComparer.InvariantCultureIgnoreCase);
- }
-
- private class NotificationMethodSettings : INotificationMethodSettings
- {
- public NotificationMethodSettings(string key, string value)
- {
- Key = key;
- Value = value;
- }
-
- public string Key { get; }
- public string Value { get; }
- }
- }
-}
diff --git a/src/Umbraco.Configuration/Models/HostingSettings.cs b/src/Umbraco.Configuration/Models/HostingSettings.cs
deleted file mode 100644
index f0fbcf4cab..0000000000
--- a/src/Umbraco.Configuration/Models/HostingSettings.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Models
-{
- internal class HostingSettings : IHostingSettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "Hosting:";
- private readonly IConfiguration _configuration;
-
- public HostingSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- ///
- public LocalTempStorage LocalTempStorageLocation =>
- _configuration.GetValue(Prefix+"LocalTempStorage", LocalTempStorage.Default);
-
- public string ApplicationVirtualPath => null;
-
- ///
- /// Gets a value indicating whether umbraco is running in [debug mode].
- ///
- /// true if [debug mode]; otherwise, false.
- public bool DebugMode => _configuration.GetValue(Prefix+"Debug", false);
- }
-}
diff --git a/src/Umbraco.Configuration/Models/ImagingSettings.cs b/src/Umbraco.Configuration/Models/ImagingSettings.cs
deleted file mode 100644
index 4a9501b2ba..0000000000
--- a/src/Umbraco.Configuration/Models/ImagingSettings.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Models
-{
- internal class ImagingSettings : IImagingSettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "Imaging:";
- private const string CachePrefix = Prefix + "Cache:";
- private const string ResizePrefix = Prefix + "Resize:";
- private readonly IConfiguration _configuration;
-
- public ImagingSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public int MaxBrowserCacheDays => _configuration.GetValue(CachePrefix + "MaxBrowserCacheDays", 7);
- public int MaxCacheDays => _configuration.GetValue(CachePrefix + "MaxCacheDays", 365);
- public uint CachedNameLength => _configuration.GetValue(CachePrefix + "CachedNameLength", (uint) 8);
- public string CacheFolder => _configuration.GetValue(CachePrefix + "Folder", "../App_Data/Cache");
- public int MaxResizeWidth => _configuration.GetValue(ResizePrefix + "MaxWidth", 5000);
- public int MaxResizeHeight => _configuration.GetValue(ResizePrefix + "MaxHeight", 5000);
- }
-}
diff --git a/src/Umbraco.Configuration/Models/IndexCreatorSettings.cs b/src/Umbraco.Configuration/Models/IndexCreatorSettings.cs
deleted file mode 100644
index b4bb000552..0000000000
--- a/src/Umbraco.Configuration/Models/IndexCreatorSettings.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Models
-{
- internal class IndexCreatorSettings : IIndexCreatorSettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "Examine:";
- private readonly IConfiguration _configuration;
-
- public IndexCreatorSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public string LuceneDirectoryFactory =>
- _configuration.GetValue(Prefix + "LuceneDirectoryFactory");
- }
-}
diff --git a/src/Umbraco.Configuration/Models/KeepAliveSettings.cs b/src/Umbraco.Configuration/Models/KeepAliveSettings.cs
deleted file mode 100644
index 04194e1a3c..0000000000
--- a/src/Umbraco.Configuration/Models/KeepAliveSettings.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
-
-namespace Umbraco.Configuration.Models
-{
- internal class KeepAliveSettings : IKeepAliveSettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "KeepAlive:";
- private readonly IConfiguration _configuration;
-
- public KeepAliveSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public bool DisableKeepAliveTask =>
- _configuration.GetValue(Prefix + "DisableKeepAliveTask", false);
-
- public string KeepAlivePingUrl => _configuration.GetValue(Prefix + "KeepAlivePingUrl",
- "{umbracoApplicationUrl}/api/keepalive/ping");
- }
-}
diff --git a/src/Umbraco.Configuration/Models/LoggingSettings.cs b/src/Umbraco.Configuration/Models/LoggingSettings.cs
deleted file mode 100644
index b05fe03875..0000000000
--- a/src/Umbraco.Configuration/Models/LoggingSettings.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
-
-namespace Umbraco.Configuration.Models
-{
- internal class LoggingSettings : ILoggingSettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "Logging:";
- private readonly IConfiguration _configuration;
-
- public LoggingSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public int MaxLogAge => _configuration.GetValue(Prefix + "MaxLogAge", -1);
- }
-}
diff --git a/src/Umbraco.Configuration/Models/MemberPasswordConfigurationSettings.cs b/src/Umbraco.Configuration/Models/MemberPasswordConfigurationSettings.cs
deleted file mode 100644
index 5a8313a351..0000000000
--- a/src/Umbraco.Configuration/Models/MemberPasswordConfigurationSettings.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Models
-{
- internal class MemberPasswordConfigurationSettings : IMemberPasswordConfiguration
- {
- private const string Prefix = Constants.Configuration.ConfigSecurityPrefix + "MemberPassword:";
- private readonly IConfiguration _configuration;
-
- public MemberPasswordConfigurationSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public int RequiredLength =>
- _configuration.GetValue(Prefix + "RequiredLength", 10);
-
- public bool RequireNonLetterOrDigit =>
- _configuration.GetValue(Prefix + "RequireNonLetterOrDigit", false);
-
- public bool RequireDigit =>
- _configuration.GetValue(Prefix + "RequireDigit", false);
-
- public bool RequireLowercase =>
- _configuration.GetValue(Prefix + "RequireLowercase", false);
-
- public bool RequireUppercase =>
- _configuration.GetValue(Prefix + "RequireUppercase", false);
-
- public string HashAlgorithmType =>
- _configuration.GetValue(Prefix + "HashAlgorithmType", Constants.Security.AspNetUmbraco8PasswordHashAlgorithmName); // TODO: Need to change to current format when we do members
-
- public int MaxFailedAccessAttemptsBeforeLockout =>
- _configuration.GetValue(Prefix + "MaxFailedAccessAttemptsBeforeLockout", 5);
- }
-}
diff --git a/src/Umbraco.Configuration/Models/NuCacheSettings.cs b/src/Umbraco.Configuration/Models/NuCacheSettings.cs
deleted file mode 100644
index 51b8b1fe08..0000000000
--- a/src/Umbraco.Configuration/Models/NuCacheSettings.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Models
-{
- internal class NuCacheSettings : INuCacheSettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "NuCache:";
- private readonly IConfiguration _configuration;
-
- public NuCacheSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public string BTreeBlockSize => _configuration.GetValue(Prefix+"BTreeBlockSize");
- }
-}
diff --git a/src/Umbraco.Configuration/Models/RuntimeSettings.cs b/src/Umbraco.Configuration/Models/RuntimeSettings.cs
deleted file mode 100644
index ef129030b6..0000000000
--- a/src/Umbraco.Configuration/Models/RuntimeSettings.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Models
-{
- internal class RuntimeSettings : IRuntimeSettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "Runtime:";
- private readonly IConfiguration _configuration;
- public RuntimeSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public int? MaxQueryStringLength => _configuration.GetValue(Prefix+"MaxRequestLength");
- public int? MaxRequestLength => _configuration.GetValue(Prefix+"MaxRequestLength");
- }
-}
diff --git a/src/Umbraco.Configuration/Models/SecuritySettings.cs b/src/Umbraco.Configuration/Models/SecuritySettings.cs
deleted file mode 100644
index 297c95b1af..0000000000
--- a/src/Umbraco.Configuration/Models/SecuritySettings.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
-
-namespace Umbraco.Configuration.Models
-{
- internal class SecuritySettings : ISecuritySettings
- {
- private const string Prefix = Constants.Configuration.ConfigSecurityPrefix;
- private readonly IConfiguration _configuration;
-
- public SecuritySettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public bool KeepUserLoggedIn => _configuration.GetValue(Prefix + "KeepUserLoggedIn", false);
-
- public bool HideDisabledUsersInBackoffice =>
- _configuration.GetValue(Prefix + "HideDisabledUsersInBackoffice", false);
-
- public bool AllowPasswordReset =>
- _configuration.GetValue(Prefix + "AllowPasswordResetAllowPasswordReset", true);
-
- public string AuthCookieName =>
- _configuration.GetValue(Prefix + "AuthCookieName", "UMB_UCONTEXT");
-
- public string AuthCookieDomain =>
- _configuration.GetValue(Prefix + "AuthCookieDomain");
-
- public bool UsernameIsEmail => _configuration.GetValue(Prefix + "UsernameIsEmail", true);
- }
-}
diff --git a/src/Umbraco.Configuration/Models/TourSettings.cs b/src/Umbraco.Configuration/Models/TourSettings.cs
deleted file mode 100644
index 9fe1814ff5..0000000000
--- a/src/Umbraco.Configuration/Models/TourSettings.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
-
-namespace Umbraco.Configuration.Models
-{
- internal class TourSettings : ITourSettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "Tours:";
- private readonly IConfiguration _configuration;
-
- public TourSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public string Type { get; set; }
-
- public bool EnableTours => _configuration.GetValue(Prefix+"EnableTours", true);
- }
-}
diff --git a/src/Umbraco.Configuration/Models/TypeFinderSettings.cs b/src/Umbraco.Configuration/Models/TypeFinderSettings.cs
deleted file mode 100644
index 8a1f7ac9e0..0000000000
--- a/src/Umbraco.Configuration/Models/TypeFinderSettings.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Models
-{
- internal class TypeFinderSettings : ITypeFinderSettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "TypeFinder:";
- private readonly IConfiguration _configuration;
-
- public TypeFinderSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public string AssembliesAcceptingLoadExceptions =>
- _configuration.GetValue(Prefix+"AssembliesAcceptingLoadExceptions");
- }
-}
diff --git a/src/Umbraco.Configuration/Models/UserPasswordConfigurationSettings.cs b/src/Umbraco.Configuration/Models/UserPasswordConfigurationSettings.cs
deleted file mode 100644
index 25ce3e3d9a..0000000000
--- a/src/Umbraco.Configuration/Models/UserPasswordConfigurationSettings.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-
-namespace Umbraco.Configuration.Models
-{
- internal class UserPasswordConfigurationSettings : IUserPasswordConfiguration
- {
- private const string Prefix = Constants.Configuration.ConfigSecurityPrefix + "UserPassword:";
- private readonly IConfiguration _configuration;
-
- public UserPasswordConfigurationSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public int RequiredLength => _configuration.GetValue(Prefix + "RequiredLength", 10);
-
- public bool RequireNonLetterOrDigit =>
- _configuration.GetValue(Prefix + "RequireNonLetterOrDigit", false);
-
- public bool RequireDigit => _configuration.GetValue(Prefix + "RequireDigit", false);
-
- public bool RequireLowercase =>
- _configuration.GetValue(Prefix + "RequireLowercase", false);
-
- public bool RequireUppercase =>
- _configuration.GetValue(Prefix + "RequireUppercase", false);
-
- public string HashAlgorithmType =>
- _configuration.GetValue(Prefix + "HashAlgorithmType", Constants.Security.AspNetCoreV3PasswordHashAlgorithmName);
-
- public int MaxFailedAccessAttemptsBeforeLockout =>
- _configuration.GetValue(Prefix + "MaxFailedAccessAttemptsBeforeLockout", 5);
- }
-}
diff --git a/src/Umbraco.Configuration/Models/WebRoutingSettings.cs b/src/Umbraco.Configuration/Models/WebRoutingSettings.cs
deleted file mode 100644
index 9ac856ca9f..0000000000
--- a/src/Umbraco.Configuration/Models/WebRoutingSettings.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Umbraco.Core;
-using Umbraco.Core.Configuration.UmbracoSettings;
-using Umbraco.Core.Models.PublishedContent;
-
-namespace Umbraco.Configuration.Models
-{
- internal class WebRoutingSettings : IWebRoutingSettings
- {
- private const string Prefix = Constants.Configuration.ConfigPrefix + "WebRouting:";
- private readonly IConfiguration _configuration;
-
- public WebRoutingSettings(IConfiguration configuration)
- {
- _configuration = configuration;
- }
-
- public bool TrySkipIisCustomErrors =>
- _configuration.GetValue(Prefix + "TrySkipIisCustomErrors", false);
-
- public bool InternalRedirectPreservesTemplate =>
- _configuration.GetValue(Prefix + "InternalRedirectPreservesTemplate", false);
-
- public bool DisableAlternativeTemplates =>
- _configuration.GetValue(Prefix + "DisableAlternativeTemplates", false);
-
- public bool ValidateAlternativeTemplates =>
- _configuration.GetValue(Prefix + "ValidateAlternativeTemplates", false);
-
- public bool DisableFindContentByIdPath =>
- _configuration.GetValue(Prefix + "DisableFindContentByIdPath", false);
-
- public bool DisableRedirectUrlTracking =>
- _configuration.GetValue(Prefix + "DisableRedirectUrlTracking", false);
-
- public string UrlProviderMode =>
- _configuration.GetValue(Prefix + "UrlProviderMode", UrlMode.Auto.ToString());
-
- public string UmbracoApplicationUrl =>
- _configuration.GetValue(Prefix + "UmbracoApplicationUrl");
- }
-}
diff --git a/src/Umbraco.Configuration/Umbraco.Configuration.csproj b/src/Umbraco.Configuration/Umbraco.Configuration.csproj
index a4dac22386..21a6dd83af 100644
--- a/src/Umbraco.Configuration/Umbraco.Configuration.csproj
+++ b/src/Umbraco.Configuration/Umbraco.Configuration.csproj
@@ -26,9 +26,9 @@
-
-
-
+
+
+
diff --git a/src/Umbraco.Configuration/UmbracoSettings/BackOfficeElement.cs b/src/Umbraco.Configuration/UmbracoSettings/BackOfficeElement.cs
deleted file mode 100644
index 46b9bf32a9..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/BackOfficeElement.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class BackOfficeElement : UmbracoConfigurationElement, IBackOfficeSection
- {
- [ConfigurationProperty("tours")]
- internal TourConfigElement Tours => (TourConfigElement)this["tours"];
-
- ITourSettings IBackOfficeSection.Tours => Tours;
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/CharCollection.cs b/src/Umbraco.Configuration/UmbracoSettings/CharCollection.cs
deleted file mode 100644
index 7b62fcc123..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/CharCollection.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class CharCollection : ConfigurationElementCollection, IEnumerable
- {
- internal void Add(CharElement c)
- {
- BaseAdd(c);
- }
-
- protected override ConfigurationElement CreateNewElement()
- {
- return new CharElement();
- }
-
- protected override object GetElementKey(ConfigurationElement element)
- {
- return ((CharElement)element).Char;
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- yield return BaseGet(i) as IChar;
- }
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/CharElement.cs b/src/Umbraco.Configuration/UmbracoSettings/CharElement.cs
deleted file mode 100644
index 1ff63ac017..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/CharElement.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class CharElement : InnerTextConfigurationElement, IChar
- {
- private string _char;
- private string _replacement;
-
- internal string Char
- {
- get => _char ?? (_char = (string)RawXml.Attribute("org"));
- set => _char = value;
- }
-
- internal string Replacement
- {
- get => _replacement ?? (_replacement = Value);
- set => _replacement = value;
- }
-
- string IChar.Char => Char;
-
- string IChar.Replacement => Replacement;
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/ContentElement.cs b/src/Umbraco.Configuration/UmbracoSettings/ContentElement.cs
deleted file mode 100644
index 28b4314c9a..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/ContentElement.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using System.Collections.Generic;
-using System.Configuration;
-using Umbraco.Core.Macros;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ContentElement : UmbracoConfigurationElement, IContentSettings
- {
- private const string DefaultPreviewBadge = @"";
-
- [ConfigurationProperty("imaging")]
- internal ContentImagingElement Imaging => (ContentImagingElement) this["imaging"];
-
- [ConfigurationProperty("ResolveUrlsFromTextString")]
- internal InnerTextConfigurationElement ResolveUrlsFromTextString => GetOptionalTextElement("ResolveUrlsFromTextString", false);
-
- public IEnumerable Error404Collection => Errors.Error404Collection;
-
- [ConfigurationProperty("errors", IsRequired = true)]
- internal ContentErrorsElement Errors => (ContentErrorsElement) base["errors"];
-
- [ConfigurationProperty("notifications", IsRequired = true)]
- internal NotificationsElement Notifications => (NotificationsElement) base["notifications"];
-
- [ConfigurationProperty("PreviewBadge")]
- internal InnerTextConfigurationElement PreviewBadge => GetOptionalTextElement("PreviewBadge", DefaultPreviewBadge);
-
- [ConfigurationProperty("MacroErrors")]
- internal InnerTextConfigurationElement MacroErrors => GetOptionalTextElement("MacroErrors", MacroErrorBehaviour.Inline);
-
- [ConfigurationProperty("disallowedUploadFiles")]
- internal CommaDelimitedConfigurationElement DisallowedUploadFiles => GetOptionalDelimitedElement("disallowedUploadFiles", new[] {"ashx", "aspx", "ascx", "config", "cshtml", "vbhtml", "asmx", "air", "axd"});
-
- [ConfigurationProperty("allowedUploadFiles")]
- internal CommaDelimitedConfigurationElement AllowedUploadFiles => GetOptionalDelimitedElement("allowedUploadFiles", new string[0]);
-
- [ConfigurationProperty("showDeprecatedPropertyEditors")]
- internal InnerTextConfigurationElement ShowDeprecatedPropertyEditors => GetOptionalTextElement("showDeprecatedPropertyEditors", false);
-
- [ConfigurationProperty("loginBackgroundImage")]
- internal InnerTextConfigurationElement LoginBackgroundImage => GetOptionalTextElement("loginBackgroundImage", string.Empty);
-
- string IContentSettings.NotificationEmailAddress => Notifications.NotificationEmailAddress;
-
- bool IContentSettings.DisableHtmlEmail => Notifications.DisableHtmlEmail;
-
- IEnumerable IContentSettings.ImageFileTypes => Imaging.ImageFileTypes;
-
- IEnumerable IContentSettings.ImageAutoFillProperties => Imaging.ImageAutoFillProperties;
-
- bool IContentSettings.ResolveUrlsFromTextString => ResolveUrlsFromTextString;
-
- string IContentSettings.PreviewBadge => PreviewBadge;
-
- MacroErrorBehaviour IContentSettings.MacroErrorBehaviour => MacroErrors;
-
- IEnumerable IContentSettings.DisallowedUploadFiles => DisallowedUploadFiles;
-
- IEnumerable IContentSettings.AllowedUploadFiles => AllowedUploadFiles;
-
- bool IContentSettings.ShowDeprecatedPropertyEditors => ShowDeprecatedPropertyEditors;
-
- string IContentSettings.LoginBackgroundImage => LoginBackgroundImage;
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/ContentError404Collection.cs b/src/Umbraco.Configuration/UmbracoSettings/ContentError404Collection.cs
deleted file mode 100644
index bdbcb27b4c..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/ContentError404Collection.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ContentError404Collection : ConfigurationElementCollection, IEnumerable
- {
- internal void Add(ContentErrorPageElement element)
- {
- BaseAdd(element);
- }
-
- protected override ConfigurationElement CreateNewElement()
- {
- return new ContentErrorPageElement();
- }
-
- protected override object GetElementKey(ConfigurationElement element)
- {
- return ((ContentErrorPageElement)element).Culture
- + ((ContentErrorPageElement)element).Value;
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- yield return BaseGet(i) as ContentErrorPageElement;
- }
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/ContentErrorPageElement.cs b/src/Umbraco.Configuration/UmbracoSettings/ContentErrorPageElement.cs
deleted file mode 100644
index 96cea71a8e..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/ContentErrorPageElement.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System;
-using System.Xml.Linq;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ContentErrorPageElement : InnerTextConfigurationElement, IContentErrorPage
- {
- public ContentErrorPageElement(XElement rawXml)
- : base(rawXml)
- {
- }
-
- public ContentErrorPageElement()
- {
-
- }
-
- public bool HasContentId => ContentId != int.MinValue;
-
- public bool HasContentKey => ContentKey != Guid.Empty;
-
- public int ContentId
- {
- get
- {
- int parsed;
- if (int.TryParse(Value, out parsed))
- {
- return parsed;
- }
- return int.MinValue;
- }
- }
-
- public Guid ContentKey
- {
- get
- {
- Guid parsed;
- if (Guid.TryParse(Value, out parsed))
- {
- return parsed;
- }
- return Guid.Empty;
- }
- }
-
- public string ContentXPath => Value;
-
- public string Culture
- {
- get => (string) RawXml.Attribute("culture");
- set => RawXml.Attribute("culture").Value = value;
- }
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/ContentErrorsElement.cs b/src/Umbraco.Configuration/UmbracoSettings/ContentErrorsElement.cs
deleted file mode 100644
index 5b5b54380d..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/ContentErrorsElement.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ContentErrorsElement : RawXmlConfigurationElement
- {
-
- public IEnumerable Error404Collection
- {
- get
- {
- var result = new ContentError404Collection();
- if (RawXml != null)
- {
- var e404 = RawXml.Elements("error404").First();
- var ePages = e404.Elements("errorPage").ToArray();
- if (ePages.Any())
- {
- //there are multiple
- foreach (var e in ePages)
- {
- result.Add(new ContentErrorPageElement(e)
- {
- Culture = (string)e.Attribute("culture"),
- RawValue = e.Value
- });
- }
- }
- else
- {
- //there's only one defined
- result.Add(new ContentErrorPageElement(e404)
- {
- RawValue = e404.Value
- });
- }
- }
- return result;
- }
- }
-
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/ContentImagingElement.cs b/src/Umbraco.Configuration/UmbracoSettings/ContentImagingElement.cs
deleted file mode 100644
index 9a5a9b2a59..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/ContentImagingElement.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ContentImagingElement : ConfigurationElement
- {
-
- [ConfigurationProperty("imageFileTypes")]
- internal CommaDelimitedConfigurationElement ImageFileTypes =>
- new OptionalCommaDelimitedConfigurationElement(
- (CommaDelimitedConfigurationElement)this["imageFileTypes"],
- //set the default
- GetDefaultImageFileTypes());
-
- public static string[] GetDefaultImageFileTypes()
- {
- return new[] {"jpeg", "jpg", "gif", "bmp", "png", "tiff", "tif"};
- }
-
- private ImagingAutoFillPropertiesCollection _defaultImageAutoFill;
-
- [ConfigurationCollection(typeof(ImagingAutoFillPropertiesCollection), AddItemName = "uploadField")]
- [ConfigurationProperty("autoFillImageProperties", IsDefaultCollection = true)]
- internal ImagingAutoFillPropertiesCollection ImageAutoFillProperties
- {
- get
- {
- if (_defaultImageAutoFill != null)
- {
- return _defaultImageAutoFill;
- }
-
- //here we need to check if this element is defined, if it is not then we'll setup the defaults
- var prop = Properties["autoFillImageProperties"];
- var autoFill = this[prop] as ConfigurationElement;
- if (autoFill != null && autoFill.ElementInformation.IsPresent == false)
- {
- _defaultImageAutoFill = new ImagingAutoFillPropertiesCollection
- {
- new ImagingAutoFillUploadFieldElement
- {
- Alias = "umbracoFile"
- }
- };
- return _defaultImageAutoFill;
- }
-
- return (ImagingAutoFillPropertiesCollection) base["autoFillImageProperties"];
- }
- }
-
- public static ImagingAutoFillPropertiesCollection GetDefaultImageAutoFillProperties()
- {
- return new ImagingAutoFillPropertiesCollection
- {
- new ImagingAutoFillUploadFieldElement
- {
- Alias = "umbracoFile"
- }
- };
- }
-
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/ImagingAutoFillPropertiesCollection.cs b/src/Umbraco.Configuration/UmbracoSettings/ImagingAutoFillPropertiesCollection.cs
deleted file mode 100644
index 0bac9721a3..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/ImagingAutoFillPropertiesCollection.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ImagingAutoFillPropertiesCollection : ConfigurationElementCollection, IEnumerable
- {
-
- protected override ConfigurationElement CreateNewElement()
- {
- return new ImagingAutoFillUploadFieldElement();
- }
-
- protected override object GetElementKey(ConfigurationElement element)
- {
- return ((ImagingAutoFillUploadFieldElement)element).Alias;
- }
-
- internal void Add(ImagingAutoFillUploadFieldElement item)
- {
- BaseAdd(item);
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- yield return BaseGet(i) as IImagingAutoFillUploadField;
- }
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/ImagingAutoFillUploadFieldElement.cs b/src/Umbraco.Configuration/UmbracoSettings/ImagingAutoFillUploadFieldElement.cs
deleted file mode 100644
index 9b4c45b5c6..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/ImagingAutoFillUploadFieldElement.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ImagingAutoFillUploadFieldElement : UmbracoConfigurationElement, IImagingAutoFillUploadField
- {
- ///
- /// Allow setting internally so we can create a default
- ///
- [ConfigurationProperty("alias", IsKey = true, IsRequired = true)]
- public string Alias
- {
- get => (string)this["alias"];
- set => this["alias"] = value;
- }
-
- [ConfigurationProperty("widthFieldAlias")]
- internal InnerTextConfigurationElement WidthFieldAlias => GetOptionalTextElement("widthFieldAlias", "umbracoWidth");
-
- [ConfigurationProperty("heightFieldAlias")]
- internal InnerTextConfigurationElement HeightFieldAlias => GetOptionalTextElement("heightFieldAlias", "umbracoHeight");
-
- [ConfigurationProperty("lengthFieldAlias")]
- internal InnerTextConfigurationElement LengthFieldAlias => GetOptionalTextElement("lengthFieldAlias", "umbracoBytes");
-
- [ConfigurationProperty("extensionFieldAlias")]
- internal InnerTextConfigurationElement ExtensionFieldAlias => GetOptionalTextElement("extensionFieldAlias", "umbracoExtension");
-
- string IImagingAutoFillUploadField.Alias => Alias;
-
- string IImagingAutoFillUploadField.WidthFieldAlias => WidthFieldAlias;
-
- string IImagingAutoFillUploadField.HeightFieldAlias => HeightFieldAlias;
-
- string IImagingAutoFillUploadField.LengthFieldAlias => LengthFieldAlias;
-
- string IImagingAutoFillUploadField.ExtensionFieldAlias => ExtensionFieldAlias;
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/KeepAliveElement.cs b/src/Umbraco.Configuration/UmbracoSettings/KeepAliveElement.cs
deleted file mode 100644
index 2297fb4e20..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/KeepAliveElement.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class KeepAliveElement : ConfigurationElement, IKeepAliveSettings
- {
- [ConfigurationProperty("disableKeepAliveTask", DefaultValue = "false")]
- public bool DisableKeepAliveTask => (bool)base["disableKeepAliveTask"];
-
- [ConfigurationProperty("keepAlivePingUrl", DefaultValue = "{umbracoApplicationUrl}/api/keepalive/ping")]
- public string KeepAlivePingUrl => (string)base["keepAlivePingUrl"];
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/LoggingElement.cs b/src/Umbraco.Configuration/UmbracoSettings/LoggingElement.cs
deleted file mode 100644
index 2fdd61e169..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/LoggingElement.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class LoggingElement : UmbracoConfigurationElement, ILoggingSettings
- {
-
- [ConfigurationProperty("maxLogAge")]
- internal InnerTextConfigurationElement MaxLogAge => GetOptionalTextElement("maxLogAge", -1);
-
- int ILoggingSettings.MaxLogAge => MaxLogAge;
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/MemberPasswordConfigurationElement.cs b/src/Umbraco.Configuration/UmbracoSettings/MemberPasswordConfigurationElement.cs
deleted file mode 100644
index 92cd112630..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/MemberPasswordConfigurationElement.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class MemberPasswordConfigurationElement : PasswordConfigurationElement, IMemberPasswordConfiguration
- {
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/NotificationsElement.cs b/src/Umbraco.Configuration/UmbracoSettings/NotificationsElement.cs
deleted file mode 100644
index afadff5654..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/NotificationsElement.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class NotificationsElement : UmbracoConfigurationElement
- {
- [ConfigurationProperty("email")]
- internal InnerTextConfigurationElement NotificationEmailAddress => (InnerTextConfigurationElement)this["email"];
-
- [ConfigurationProperty("disableHtmlEmail")]
- internal InnerTextConfigurationElement DisableHtmlEmail => GetOptionalTextElement("disableHtmlEmail", false);
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/PasswordConfigurationElement.cs b/src/Umbraco.Configuration/UmbracoSettings/PasswordConfigurationElement.cs
deleted file mode 100644
index 91b5cae7a4..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/PasswordConfigurationElement.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class PasswordConfigurationElement : UmbracoConfigurationElement
- {
- [ConfigurationProperty("requiredLength", DefaultValue = "12")]
- public int RequiredLength => (int)base["requiredLength"];
-
- [ConfigurationProperty("requireNonLetterOrDigit", DefaultValue = "false")]
- public bool RequireNonLetterOrDigit => (bool)base["requireNonLetterOrDigit"];
-
- [ConfigurationProperty("requireDigit", DefaultValue = "false")]
- public bool RequireDigit => (bool)base["requireDigit"];
-
- [ConfigurationProperty("requireLowercase", DefaultValue = "false")]
- public bool RequireLowercase => (bool)base["requireLowercase"];
-
- [ConfigurationProperty("requireUppercase", DefaultValue = "false")]
- public bool RequireUppercase => (bool)base["requireUppercase"];
-
- [ConfigurationProperty("useLegacyEncoding", DefaultValue = "false")]
- public bool UseLegacyEncoding => (bool)base["useLegacyEncoding"];
-
- [ConfigurationProperty("hashAlgorithmType", DefaultValue = Constants.Security.AspNetCoreV3PasswordHashAlgorithmName)]
- public string HashAlgorithmType => (string)base["hashAlgorithmType"];
-
- [ConfigurationProperty("maxFailedAccessAttemptsBeforeLockout", DefaultValue = "5")]
- public int MaxFailedAccessAttemptsBeforeLockout => (int)base["maxFailedAccessAttemptsBeforeLockout"];
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/RequestHandlerElement.cs b/src/Umbraco.Configuration/UmbracoSettings/RequestHandlerElement.cs
deleted file mode 100644
index f959a56e71..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/RequestHandlerElement.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-using System;
-using System.Configuration;
-using System.Globalization;
-using System.Collections.Generic;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class RequestHandlerElement : UmbracoConfigurationElement, IRequestHandlerSettings
- {
- [ConfigurationProperty("addTrailingSlash")]
- public InnerTextConfigurationElement AddTrailingSlash => GetOptionalTextElement("addTrailingSlash", true);
-
- private UrlReplacingElement _defaultUrlReplacing;
- [ConfigurationProperty("urlReplacing")]
- public UrlReplacingElement UrlReplacing
- {
- get
- {
- if (_defaultUrlReplacing != null)
- {
- return _defaultUrlReplacing;
- }
-
- //here we need to check if this element is defined, if it is not then we'll setup the defaults
- var prop = Properties["urlReplacing"];
- var urls = this[prop] as ConfigurationElement;
- if (urls != null && urls.ElementInformation.IsPresent == false)
- {
- _defaultUrlReplacing = new UrlReplacingElement()
- {
- CharCollection = GetDefaultCharReplacements()
- };
-
- return _defaultUrlReplacing;
- }
-
- return (UrlReplacingElement)this["urlReplacing"];
- }
- }
-
- public static CharCollection GetDefaultCharReplacements()
- {
- var dictionary = new Dictionary()
- {
- {' ',"-"},
- {'\"',""},
- {'\'',""},
- {'%',""},
- {'.',""},
- {';',""},
- {'/',""},
- {'\\',""},
- {':',""},
- {'#',""},
- {'+',"plus"},
- {'*',"star"},
- {'&',""},
- {'?',""},
- {'æ',"ae"},
- {'ø',"oe"},
- {'å',"aa"},
- {'ä',"ae"},
- {'ö',"oe"},
- {'ü',"ue"},
- {'ß',"ss"},
- {'Ä',"ae"},
- {'Ö',"oe"},
- {'|',"-"},
- {'<',""},
- {'>',""}
- };
-
- //const string chars = @" ,"",',%,.,;,/,\,:,#,+,*,&,?,æ,ø,å,ä,ö,ü,ß,Ä,Ö,|,<,>";
-
- var collection = new CharCollection();
- foreach (var c in dictionary)
- {
- collection.Add(new CharElement
- {
- Char = c.Key.ToString(CultureInfo.InvariantCulture),
- Replacement = c.Value.ToString(CultureInfo.InvariantCulture)
- });
- }
-
- return collection;
- }
-
- bool IRequestHandlerSettings.AddTrailingSlash => AddTrailingSlash;
-
- bool IRequestHandlerSettings.ConvertUrlsToAscii => UrlReplacing.ConvertUrlsToAscii.InvariantEquals("true");
-
- bool IRequestHandlerSettings.TryConvertUrlsToAscii => UrlReplacing.ConvertUrlsToAscii.InvariantEquals("try");
-
- IEnumerable IRequestHandlerSettings.CharCollection => UrlReplacing.CharCollection;
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/SecurityElement.cs b/src/Umbraco.Configuration/UmbracoSettings/SecurityElement.cs
deleted file mode 100644
index aec6809298..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/SecurityElement.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class SecurityElement : UmbracoConfigurationElement, ISecuritySettings
- {
- [ConfigurationProperty("keepUserLoggedIn")]
- internal InnerTextConfigurationElement KeepUserLoggedIn => GetOptionalTextElement("keepUserLoggedIn", true);
-
- [ConfigurationProperty("hideDisabledUsersInBackoffice")]
- internal InnerTextConfigurationElement HideDisabledUsersInBackoffice => GetOptionalTextElement("hideDisabledUsersInBackoffice", false);
-
- ///
- /// Used to enable/disable the forgot password functionality on the back office login screen
- ///
- [ConfigurationProperty("allowPasswordReset")]
- internal InnerTextConfigurationElement AllowPasswordReset => GetOptionalTextElement("allowPasswordReset", true);
-
- ///
- /// A boolean indicating that by default the email address will be the username
- ///
- ///
- /// Even if this is true and the username is different from the email in the database, the username field will still be shown.
- /// When this is false, the username and email fields will be shown in the user section.
- ///
- [ConfigurationProperty("usernameIsEmail")]
- internal InnerTextConfigurationElement UsernameIsEmail => GetOptionalTextElement("usernameIsEmail", true);
-
- [ConfigurationProperty("authCookieName")]
- internal InnerTextConfigurationElement AuthCookieName => GetOptionalTextElement("authCookieName", "UMB_UCONTEXT");
-
- [ConfigurationProperty("authCookieDomain")]
- internal InnerTextConfigurationElement AuthCookieDomain => GetOptionalTextElement("authCookieDomain", null);
-
- [ConfigurationProperty("userPasswordConfiguration")]
- public UserPasswordConfigurationElement UserPasswordConfiguration => (UserPasswordConfigurationElement)this["userPasswordConfiguration"];
-
- [ConfigurationProperty("memberPasswordConfiguration")]
- public MemberPasswordConfigurationElement MemberPasswordConfiguration => (MemberPasswordConfigurationElement)this["memberPasswordConfiguration"];
-
- bool ISecuritySettings.KeepUserLoggedIn => KeepUserLoggedIn;
-
- bool ISecuritySettings.HideDisabledUsersInBackoffice => HideDisabledUsersInBackoffice;
-
- ///
- /// Used to enable/disable the forgot password functionality on the back office login screen
- ///
- bool ISecuritySettings.AllowPasswordReset => AllowPasswordReset;
-
- ///
- /// A boolean indicating that by default the email address will be the username
- ///
- ///
- /// Even if this is true and the username is different from the email in the database, the username field will still be shown.
- /// When this is false, the username and email fields will be shown in the user section.
- ///
- bool ISecuritySettings.UsernameIsEmail => UsernameIsEmail;
-
- string ISecuritySettings.AuthCookieName => AuthCookieName;
-
- string ISecuritySettings.AuthCookieDomain => AuthCookieDomain;
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/TourConfigElement.cs b/src/Umbraco.Configuration/UmbracoSettings/TourConfigElement.cs
deleted file mode 100644
index f75b71fc57..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/TourConfigElement.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class TourConfigElement : UmbracoConfigurationElement, ITourSettings
- {
- //disabled by default so that upgraders don't get it enabled by default
- // TODO: we probably just want to disable the initial one from automatically loading ?
- [ConfigurationProperty("enable", DefaultValue = false)]
- public bool EnableTours => (bool)this["enable"];
-
- // TODO: We could have additional filters, etc... defined here
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/UmbracoConfigurationElement.cs b/src/Umbraco.Configuration/UmbracoSettings/UmbracoConfigurationElement.cs
deleted file mode 100644
index 670f620b15..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/UmbracoConfigurationElement.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Collections.Concurrent;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- ///
- /// Base class with shared helper methods
- ///
- internal class UmbracoConfigurationElement : ConfigurationElement
- {
- ///
- /// Used so the RawElement types are not re-created every time they are accessed
- ///
- private readonly ConcurrentDictionary _rawElements = new ConcurrentDictionary();
-
- protected OptionalInnerTextConfigurationElement GetOptionalTextElement(string name, T defaultVal)
- {
- return (OptionalInnerTextConfigurationElement) _rawElements.GetOrAdd(
- name,
- s => new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement) this[s],
- //set the default
- defaultVal));
- }
-
- protected OptionalCommaDelimitedConfigurationElement GetOptionalDelimitedElement(string name, string[] defaultVal)
- {
- return (OptionalCommaDelimitedConfigurationElement) _rawElements.GetOrAdd(
- name,
- s => new OptionalCommaDelimitedConfigurationElement(
- (CommaDelimitedConfigurationElement) this[name],
- //set the default
- defaultVal));
- }
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/UmbracoSettingsSection.cs b/src/Umbraco.Configuration/UmbracoSettings/UmbracoSettingsSection.cs
deleted file mode 100644
index 781d00b979..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/UmbracoSettingsSection.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class UmbracoSettingsSection : ConfigurationSection
- {
- [ConfigurationProperty("backOffice")]
- public BackOfficeElement BackOffice => (BackOfficeElement)this["backOffice"];
-
- [ConfigurationProperty("content")]
- public ContentElement Content => (ContentElement)this["content"];
-
- [ConfigurationProperty("security")]
- public SecurityElement Security => (SecurityElement)this["security"];
-
- [ConfigurationProperty("requestHandler")]
- public RequestHandlerElement RequestHandler => (RequestHandlerElement)this["requestHandler"];
-
- [ConfigurationProperty("logging")]
- public LoggingElement Logging => (LoggingElement)this["logging"];
-
- [ConfigurationProperty("web.routing")]
- public WebRoutingElement WebRouting => (WebRoutingElement)this["web.routing"];
-
- [ConfigurationProperty("keepAlive")]
- internal KeepAliveElement KeepAlive => (KeepAliveElement)this["keepAlive"];
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/UrlReplacingElement.cs b/src/Umbraco.Configuration/UmbracoSettings/UrlReplacingElement.cs
deleted file mode 100644
index 3e12d106ff..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/UrlReplacingElement.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class UrlReplacingElement : ConfigurationElement
- {
- [ConfigurationProperty("removeDoubleDashes", DefaultValue = true)]
- internal bool RemoveDoubleDashes => (bool) base["removeDoubleDashes"];
-
- [ConfigurationProperty("toAscii", DefaultValue = "false")]
- internal string ConvertUrlsToAscii => (string) base["toAscii"];
-
- [ConfigurationCollection(typeof(CharCollection), AddItemName = "char")]
- [ConfigurationProperty("", IsDefaultCollection = true)]
- internal CharCollection CharCollection
- {
- get => (CharCollection)base[""];
- set => base[""] = value;
- }
-
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/UserPasswordConfigurationElement.cs b/src/Umbraco.Configuration/UmbracoSettings/UserPasswordConfigurationElement.cs
deleted file mode 100644
index a1d2aa8842..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/UserPasswordConfigurationElement.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class UserPasswordConfigurationElement : PasswordConfigurationElement, IUserPasswordConfiguration
- {
- }
-}
diff --git a/src/Umbraco.Configuration/UmbracoSettings/WebRoutingElement.cs b/src/Umbraco.Configuration/UmbracoSettings/WebRoutingElement.cs
deleted file mode 100644
index 206fc213d2..0000000000
--- a/src/Umbraco.Configuration/UmbracoSettings/WebRoutingElement.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class WebRoutingElement : ConfigurationElement, IWebRoutingSettings
- {
- [ConfigurationProperty("trySkipIisCustomErrors", DefaultValue = "false")]
- public bool TrySkipIisCustomErrors => (bool) base["trySkipIisCustomErrors"];
-
- [ConfigurationProperty("internalRedirectPreservesTemplate", DefaultValue = "false")]
- public bool InternalRedirectPreservesTemplate => (bool) base["internalRedirectPreservesTemplate"];
-
- [ConfigurationProperty("disableAlternativeTemplates", DefaultValue = "false")]
- public bool DisableAlternativeTemplates => (bool) base["disableAlternativeTemplates"];
-
- [ConfigurationProperty("validateAlternativeTemplates", DefaultValue = "false")]
- public bool ValidateAlternativeTemplates => (bool) base["validateAlternativeTemplates"];
-
- [ConfigurationProperty("disableFindContentByIdPath", DefaultValue = "false")]
- public bool DisableFindContentByIdPath => (bool) base["disableFindContentByIdPath"];
-
- [ConfigurationProperty("disableRedirectUrlTracking", DefaultValue = "false")]
- public bool DisableRedirectUrlTracking => (bool) base["disableRedirectUrlTracking"];
-
- [ConfigurationProperty("urlProviderMode", DefaultValue = "Auto")]
- public string UrlProviderMode => (string) base["urlProviderMode"];
-
- [ConfigurationProperty("umbracoApplicationUrl", DefaultValue = null)]
- public string UmbracoApplicationUrl => (string)base["umbracoApplicationUrl"];
- }
-}
diff --git a/src/Umbraco.Core/BackOffice/BackOfficeIdentityUser.cs b/src/Umbraco.Core/BackOffice/BackOfficeIdentityUser.cs
index 8df253b296..bd04b44b18 100644
--- a/src/Umbraco.Core/BackOffice/BackOfficeIdentityUser.cs
+++ b/src/Umbraco.Core/BackOffice/BackOfficeIdentityUser.cs
@@ -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
/// This is allowed to be null (but would need to be filled in if trying to persist this instance)
///
///
- 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();
_startContentIds = Array.Empty();
@@ -78,7 +79,7 @@ namespace Umbraco.Core.BackOffice
///
///
///
- public BackOfficeIdentityUser(IGlobalSettings globalSettings, int userId, IEnumerable groups)
+ public BackOfficeIdentityUser(GlobalSettings globalSettings, int userId, IEnumerable groups)
: this(globalSettings, groups.ToArray())
{
// use the property setters - they do more than just setting a field
diff --git a/src/Umbraco.Core/BackOffice/IdentityMapDefinition.cs b/src/Umbraco.Core/BackOffice/IdentityMapDefinition.cs
index e8d16a7903..61fdf82d19 100644
--- a/src/Umbraco.Core/BackOffice/IdentityMapDefinition.cs
+++ b/src/Umbraco.Core/BackOffice/IdentityMapDefinition.cs
@@ -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, IOptions globalSettings)
{
_textService = textService;
_entityService = entityService;
- _globalSettings = globalSettings;
+ _globalSettings = globalSettings.Value;
}
public void DefineMaps(UmbracoMapper mapper)
diff --git a/src/Umbraco.Core/Composing/Composition.cs b/src/Umbraco.Core/Composing/Composition.cs
index f6e8655575..998f42a2dc 100644
--- a/src/Umbraco.Core/Composing/Composition.cs
+++ b/src/Umbraco.Core/Composing/Composition.cs
@@ -21,7 +21,6 @@ namespace Umbraco.Core.Composing
private readonly Dictionary> _uniques = new Dictionary>();
private readonly IRegister _register;
-
///
/// Initializes a new instance of the class.
///
@@ -32,13 +31,12 @@ namespace Umbraco.Core.Composing
/// Optional configs.
/// An IOHelper
///
- 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 +61,6 @@ namespace Umbraco.Core.Composing
///
public IRuntimeState RuntimeState { get; }
- ///
- /// Gets the configurations.
- ///
- public Configs Configs { get; }
-
#endregion
#region IRegister
@@ -136,8 +129,6 @@ namespace Umbraco.Core.Composing
IFactory factory = null;
- Configs.RegisterWith(_register);
-
// ReSharper disable once AccessToModifiedClosure -- on purpose
_register.Register(_ => factory, Lifetime.Singleton);
factory = _register.CreateFactory();
diff --git a/src/Umbraco.Core/Composing/Current.cs b/src/Umbraco.Core/Composing/Current.cs
index 055a29228a..856be9f414 100644
--- a/src/Umbraco.Core/Composing/Current.cs
+++ b/src/Umbraco.Core/Composing/Current.cs
@@ -1,7 +1,9 @@
using System;
using System.Runtime.CompilerServices;
+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;
@@ -11,18 +13,21 @@ namespace Umbraco.Composing
public static class Current
{
private static ILogger _logger = new NullLogger();
- private static Configs _configs;
private static IIOHelper _ioHelper;
private static IHostingEnvironment _hostingEnvironment;
private static IBackOfficeInfo _backOfficeInfo;
private static IProfiler _profiler;
+ private static SecuritySettings _securitySettings;
+ private static GlobalSettings _globalSettings;
public static ILogger Logger => EnsureInitialized(_logger);
- public static Configs Configs => EnsureInitialized(_configs);
+
public static IIOHelper IOHelper => EnsureInitialized(_ioHelper);
public static IHostingEnvironment HostingEnvironment => EnsureInitialized(_hostingEnvironment);
public static IBackOfficeInfo BackOfficeInfo => EnsureInitialized(_backOfficeInfo);
public static IProfiler Profiler => EnsureInitialized(_profiler);
+ public static SecuritySettings SecuritySettings => EnsureInitialized(_securitySettings);
+ public static GlobalSettings GlobalSettings => EnsureInitialized(_globalSettings);
public static bool IsInitialized { get; internal set; }
@@ -37,7 +42,8 @@ namespace Umbraco.Composing
public static void Initialize(
ILogger logger,
- Configs configs,
+ SecuritySettings securitySettings,
+ GlobalSettings globalSettings,
IIOHelper ioHelper,
IHostingEnvironment hostingEnvironment,
IBackOfficeInfo backOfficeInfo,
@@ -49,13 +55,15 @@ namespace Umbraco.Composing
}
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
- _configs = configs ?? throw new ArgumentNullException(nameof(configs));
_ioHelper = ioHelper ?? throw new ArgumentNullException(nameof(ioHelper));
_hostingEnvironment = hostingEnvironment ?? throw new ArgumentNullException(nameof(hostingEnvironment));
_backOfficeInfo = backOfficeInfo ?? throw new ArgumentNullException(nameof(backOfficeInfo));
_profiler = profiler ?? throw new ArgumentNullException(nameof(profiler));
+ _securitySettings = securitySettings ?? throw new ArgumentNullException(nameof(securitySettings));
+ _globalSettings = globalSettings ?? throw new ArgumentNullException(nameof(globalSettings));
IsInitialized = true;
}
+
}
}
diff --git a/src/Umbraco.Core/Composing/DefaultUmbracoAssemblyProvider.cs b/src/Umbraco.Core/Composing/DefaultUmbracoAssemblyProvider.cs
index c5d87abf91..3e0ea9c971 100644
--- a/src/Umbraco.Core/Composing/DefaultUmbracoAssemblyProvider.cs
+++ b/src/Umbraco.Core/Composing/DefaultUmbracoAssemblyProvider.cs
@@ -19,7 +19,7 @@ namespace Umbraco.Core.Composing
"Umbraco.Core",
"Umbraco.Infrastructure",
"Umbraco.PublishedCache.NuCache",
- // "Umbraco.ModelsBuilder.Embedded", TODO reintroduce when ModelsBuilder is migrated
+ "Umbraco.ModelsBuilder.Embedded",
"Umbraco.Examine.Lucene",
"Umbraco.Web.Common",
"Umbraco.Web.BackOffice",
diff --git a/src/Umbraco.Core/Composing/TypeFinder.cs b/src/Umbraco.Core/Composing/TypeFinder.cs
index 13c5e063be..3427c55731 100644
--- a/src/Umbraco.Core/Composing/TypeFinder.cs
+++ b/src/Umbraco.Core/Composing/TypeFinder.cs
@@ -156,6 +156,7 @@ namespace Umbraco.Core.Composing
"MiniProfiler.",
"Owin,",
"SQLite",
+ "ReSharperTestRunner32" // used by resharper testrunner
};
///
diff --git a/src/Umbraco.Core/Composing/TypeFinderConfig.cs b/src/Umbraco.Core/Composing/TypeFinderConfig.cs
index 9a3cd7072c..302d45b4e8 100644
--- a/src/Umbraco.Core/Composing/TypeFinderConfig.cs
+++ b/src/Umbraco.Core/Composing/TypeFinderConfig.cs
@@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Umbraco.Core.Configuration;
+using Microsoft.Extensions.Options;
+using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Configuration.UmbracoSettings;
namespace Umbraco.Core.Composing
@@ -11,12 +12,12 @@ namespace Umbraco.Core.Composing
///
public class TypeFinderConfig : ITypeFinderConfig
{
- private readonly ITypeFinderSettings _settings;
+ private readonly TypeFinderSettings _settings;
private IEnumerable _assembliesAcceptingLoadExceptions;
- public TypeFinderConfig(ITypeFinderSettings settings)
+ public TypeFinderConfig(IOptionsMonitor settings)
{
- _settings = settings;
+ _settings = settings.CurrentValue;
}
public IEnumerable AssembliesAcceptingLoadExceptions
diff --git a/src/Umbraco.Core/ConfigConnectionStringExtensions.cs b/src/Umbraco.Core/ConfigConnectionStringExtensions.cs
index 693b8a433e..8047af88c5 100644
--- a/src/Umbraco.Core/ConfigConnectionStringExtensions.cs
+++ b/src/Umbraco.Core/ConfigConnectionStringExtensions.cs
@@ -5,7 +5,6 @@ using Umbraco.Core.Configuration;
namespace Umbraco.Core
{
-
public static class ConfigConnectionStringExtensions
{
public static bool IsConnectionStringConfigured(this ConfigConnectionString databaseSettings)
diff --git a/src/Umbraco.Core/Configuration/ConfigConnectionString.cs b/src/Umbraco.Core/Configuration/ConfigConnectionString.cs
index e9ac944b85..3a540aa3e2 100644
--- a/src/Umbraco.Core/Configuration/ConfigConnectionString.cs
+++ b/src/Umbraco.Core/Configuration/ConfigConnectionString.cs
@@ -1,16 +1,61 @@
+using System;
+using System.Data.Common;
+
namespace Umbraco.Core.Configuration
{
public class ConfigConnectionString
{
- public ConfigConnectionString(string connectionString, string providerName, string name)
+ public ConfigConnectionString(string name, string connectionString, string providerName = null)
{
+ Name = name ?? throw new ArgumentNullException(nameof(name));
ConnectionString = connectionString;
- ProviderName = providerName;
- Name = name;
+
+ ProviderName = string.IsNullOrEmpty(providerName) ? ParseProvider(connectionString) : providerName;
}
public string ConnectionString { get; }
public string ProviderName { get; }
public string Name { get; }
+
+ private string ParseProvider(string connectionString)
+ {
+ if (string.IsNullOrEmpty(connectionString))
+ {
+ return null;
+ }
+
+ var builder = new DbConnectionStringBuilder
+ {
+ ConnectionString = connectionString
+ };
+
+ if (builder.TryGetValue("Data Source", out var ds) && ds is string dataSource)
+ {
+ if (dataSource.EndsWith(".sdf"))
+ {
+ return Constants.DbProviderNames.SqlCe;
+ }
+ }
+
+ if (builder.TryGetValue("Server", out var s) && s is string server && !string.IsNullOrEmpty(server))
+ {
+ if (builder.TryGetValue("Database", out var db) && db is string database && !string.IsNullOrEmpty(database))
+ {
+ return Constants.DbProviderNames.SqlServer;
+ }
+
+ if (builder.TryGetValue("AttachDbFileName", out var a) && a is string attachDbFileName && !string.IsNullOrEmpty(attachDbFileName))
+ {
+ return Constants.DbProviderNames.SqlServer;
+ }
+
+ if (builder.TryGetValue("Initial Catalog", out var i) && i is string initialCatalog && !string.IsNullOrEmpty(initialCatalog))
+ {
+ return Constants.DbProviderNames.SqlServer;
+ }
+ }
+
+ throw new ArgumentException("Cannot determine provider name from connection string", nameof(connectionString));
+ }
}
}
diff --git a/src/Umbraco.Core/Configuration/Configs.cs b/src/Umbraco.Core/Configuration/Configs.cs
deleted file mode 100644
index 821ee308f0..0000000000
--- a/src/Umbraco.Core/Configuration/Configs.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Umbraco.Core.Composing;
-
-namespace Umbraco.Core.Configuration
-{
- ///
- /// Represents Umbraco configurations.
- ///
- ///
- /// During composition, use composition.Configs. When running, either inject the required configuration,
- /// or use Current.Configs.
- ///
- public class Configs
- {
- private readonly Dictionary> _configs = new Dictionary>();
- private Dictionary> _registerings = new Dictionary>();
-
- ///
- /// Gets a configuration.
- ///
- public TConfig GetConfig()
- where TConfig : class
- {
- if (!_configs.TryGetValue(typeof(TConfig), out var configFactory))
- throw new InvalidOperationException($"No configuration of type {typeof(TConfig)} has been added.");
-
- return (TConfig) configFactory.Value;
- }
-
- ///
- /// Adds a configuration, provided by a factory.
- ///
- public void Add(Func configFactory)
- where TConfig : class
- {
- // make sure it is not too late
- if (_registerings == null)
- throw new InvalidOperationException("Configurations have already been registered.");
-
- var typeOfConfig = typeof(TConfig);
-
- var lazyConfigFactory = _configs[typeOfConfig] = new Lazy