From f8fd255239a0fe68296a5a454ffb671d894e245d Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 31 Jan 2019 01:37:38 +1100 Subject: [PATCH] Last cleanup of unused umbraco settings --- .../ContentErrorPageElement.cs | 19 ++---- .../UmbracoSettings/ContentImagingElement.cs | 15 ++--- .../UmbracoSettings/FileExtensionElement.cs | 21 ------- .../UmbracoSettings/IFileExtension.cs | 7 --- .../Configuration/UmbracoSettings/ILogType.cs | 7 --- .../UmbracoSettings/IRequestHandlerSection.cs | 2 - .../ImagingAutoFillUploadFieldElement.cs | 50 ++++------------ .../UmbracoSettings/LogTypeElement.cs | 11 ---- .../UmbracoSettings/LoggingElement.cs | 11 +--- .../UmbracoSettings/NotificationsElement.cs | 11 +--- .../UmbracoSettings/RequestHandlerElement.cs | 30 ++-------- .../UmbracoSettings/SecurityElement.cs | 60 ++++--------------- .../UmbracoSettings/TourConfigElement.cs | 7 +-- .../UmbracoSettings/UrlReplacingElement.cs | 14 ++--- src/Umbraco.Core/Umbraco.Core.csproj | 4 -- .../RequestHandlerElementTests.cs | 5 -- 16 files changed, 48 insertions(+), 226 deletions(-) delete mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/FileExtensionElement.cs delete mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/IFileExtension.cs delete mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ILogType.cs delete mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/LogTypeElement.cs diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorPageElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorPageElement.cs index c12dbdddd4..96cea71a8e 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorPageElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorPageElement.cs @@ -15,15 +15,9 @@ namespace Umbraco.Core.Configuration.UmbracoSettings } - public bool HasContentId - { - get { return ContentId != int.MinValue; } - } + public bool HasContentId => ContentId != int.MinValue; - public bool HasContentKey - { - get { return ContentKey != Guid.Empty; } - } + public bool HasContentKey => ContentKey != Guid.Empty; public int ContentId { @@ -51,15 +45,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings } } - public string ContentXPath - { - get { return Value; } - } + public string ContentXPath => Value; public string Culture { - get { return (string) RawXml.Attribute("culture"); } - set { RawXml.Attribute("culture").Value = value; } + get => (string) RawXml.Attribute("culture"); + set => RawXml.Attribute("culture").Value = value; } } } diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs index 1814ef23e8..67562c411a 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs @@ -6,16 +6,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { [ConfigurationProperty("imageFileTypes")] - internal CommaDelimitedConfigurationElement ImageFileTypes - { - get - { - return new OptionalCommaDelimitedConfigurationElement( - (CommaDelimitedConfigurationElement)this["imageFileTypes"], - //set the default - GetDefaultImageFileTypes()); - } - } + internal CommaDelimitedConfigurationElement ImageFileTypes => + new OptionalCommaDelimitedConfigurationElement( + (CommaDelimitedConfigurationElement)this["imageFileTypes"], + //set the default + GetDefaultImageFileTypes()); internal static string[] GetDefaultImageFileTypes() { diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/FileExtensionElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/FileExtensionElement.cs deleted file mode 100644 index 225a7d7aed..0000000000 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/FileExtensionElement.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Xml.Linq; - -namespace Umbraco.Core.Configuration.UmbracoSettings -{ - internal class FileExtensionElement : InnerTextConfigurationElement, IFileExtension - { - public FileExtensionElement() - { - } - - internal FileExtensionElement(XElement rawXml) - : base(rawXml) - { - } - - string IFileExtension.Extension - { - get { return Value; } - } - } -} diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/IFileExtension.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/IFileExtension.cs deleted file mode 100644 index 0431fcc205..0000000000 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/IFileExtension.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Umbraco.Core.Configuration.UmbracoSettings -{ - public interface IFileExtension - { - string Extension { get; } - } -} diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ILogType.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ILogType.cs deleted file mode 100644 index f3624736fe..0000000000 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/ILogType.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Umbraco.Core.Configuration.UmbracoSettings -{ - public interface ILogType - { - string LogTypeAlias { get; } - } -} diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/IRequestHandlerSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/IRequestHandlerSection.cs index 075c347b68..2393c5af63 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/IRequestHandlerSection.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/IRequestHandlerSection.cs @@ -6,8 +6,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { bool AddTrailingSlash { get; } - bool RemoveDoubleDashes { get; } - bool ConvertUrlsToAscii { get; } bool TryConvertUrlsToAscii { get; } diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ImagingAutoFillUploadFieldElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ImagingAutoFillUploadFieldElement.cs index 0573cb4efe..9b4c45b5c6 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/ImagingAutoFillUploadFieldElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ImagingAutoFillUploadFieldElement.cs @@ -10,58 +10,30 @@ namespace Umbraco.Core.Configuration.UmbracoSettings [ConfigurationProperty("alias", IsKey = true, IsRequired = true)] public string Alias { - get { return (string)this["alias"]; } - set { this["alias"] = value; } + get => (string)this["alias"]; + set => this["alias"] = value; } [ConfigurationProperty("widthFieldAlias")] - internal InnerTextConfigurationElement WidthFieldAlias - { - get { return GetOptionalTextElement("widthFieldAlias", "umbracoWidth"); } - } + internal InnerTextConfigurationElement WidthFieldAlias => GetOptionalTextElement("widthFieldAlias", "umbracoWidth"); [ConfigurationProperty("heightFieldAlias")] - internal InnerTextConfigurationElement HeightFieldAlias - { - get { return GetOptionalTextElement("heightFieldAlias", "umbracoHeight"); } - } + internal InnerTextConfigurationElement HeightFieldAlias => GetOptionalTextElement("heightFieldAlias", "umbracoHeight"); [ConfigurationProperty("lengthFieldAlias")] - internal InnerTextConfigurationElement LengthFieldAlias - { - get { return GetOptionalTextElement("lengthFieldAlias", "umbracoBytes"); } - } + internal InnerTextConfigurationElement LengthFieldAlias => GetOptionalTextElement("lengthFieldAlias", "umbracoBytes"); [ConfigurationProperty("extensionFieldAlias")] - internal InnerTextConfigurationElement ExtensionFieldAlias - { - get { return GetOptionalTextElement("extensionFieldAlias", "umbracoExtension"); } - } + internal InnerTextConfigurationElement ExtensionFieldAlias => GetOptionalTextElement("extensionFieldAlias", "umbracoExtension"); - string IImagingAutoFillUploadField.Alias - { - get { return Alias; } + string IImagingAutoFillUploadField.Alias => Alias; - } + string IImagingAutoFillUploadField.WidthFieldAlias => WidthFieldAlias; - string IImagingAutoFillUploadField.WidthFieldAlias - { - get { return WidthFieldAlias; } - } + string IImagingAutoFillUploadField.HeightFieldAlias => HeightFieldAlias; - string IImagingAutoFillUploadField.HeightFieldAlias - { - get { return HeightFieldAlias; } - } + string IImagingAutoFillUploadField.LengthFieldAlias => LengthFieldAlias; - string IImagingAutoFillUploadField.LengthFieldAlias - { - get { return LengthFieldAlias; } - } - - string IImagingAutoFillUploadField.ExtensionFieldAlias - { - get { return ExtensionFieldAlias; } - } + string IImagingAutoFillUploadField.ExtensionFieldAlias => ExtensionFieldAlias; } } diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/LogTypeElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/LogTypeElement.cs deleted file mode 100644 index 772391da90..0000000000 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/LogTypeElement.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Umbraco.Core.Configuration.UmbracoSettings -{ - internal class LogTypeElement : InnerTextConfigurationElement, ILogType - { - - string ILogType.LogTypeAlias - { - get { return Value; } - } - } -} diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/LoggingElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/LoggingElement.cs index abe10d830e..106b6cc134 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/LoggingElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/LoggingElement.cs @@ -7,15 +7,8 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { [ConfigurationProperty("maxLogAge")] - internal InnerTextConfigurationElement MaxLogAge - { - get { return GetOptionalTextElement("maxLogAge", -1); } - } - - int ILoggingSection.MaxLogAge - { - get { return MaxLogAge; } - } + internal InnerTextConfigurationElement MaxLogAge => GetOptionalTextElement("maxLogAge", -1); + int ILoggingSection.MaxLogAge => MaxLogAge; } } diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/NotificationsElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/NotificationsElement.cs index 534e4012ff..afadff5654 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/NotificationsElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/NotificationsElement.cs @@ -5,16 +5,9 @@ namespace Umbraco.Core.Configuration.UmbracoSettings internal class NotificationsElement : UmbracoConfigurationElement { [ConfigurationProperty("email")] - internal InnerTextConfigurationElement NotificationEmailAddress - { - get { return (InnerTextConfigurationElement)this["email"]; } - } + internal InnerTextConfigurationElement NotificationEmailAddress => (InnerTextConfigurationElement)this["email"]; [ConfigurationProperty("disableHtmlEmail")] - internal InnerTextConfigurationElement DisableHtmlEmail - { - get { return GetOptionalTextElement("disableHtmlEmail", false); } - } - + internal InnerTextConfigurationElement DisableHtmlEmail => GetOptionalTextElement("disableHtmlEmail", false); } } diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs index a5383dba87..263a822381 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs @@ -8,10 +8,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings internal class RequestHandlerElement : UmbracoConfigurationElement, IRequestHandlerSection { [ConfigurationProperty("addTrailingSlash")] - public InnerTextConfigurationElement AddTrailingSlash - { - get { return GetOptionalTextElement("addTrailingSlash", true); } - } + public InnerTextConfigurationElement AddTrailingSlash => GetOptionalTextElement("addTrailingSlash", true); private UrlReplacingElement _defaultUrlReplacing; [ConfigurationProperty("urlReplacing")] @@ -88,29 +85,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings return collection; } - bool IRequestHandlerSection.AddTrailingSlash - { - get { return AddTrailingSlash; } - } + bool IRequestHandlerSection.AddTrailingSlash => AddTrailingSlash; - bool IRequestHandlerSection.RemoveDoubleDashes - { - get { return UrlReplacing.RemoveDoubleDashes; } - } + bool IRequestHandlerSection.ConvertUrlsToAscii => UrlReplacing.ConvertUrlsToAscii.InvariantEquals("true"); - bool IRequestHandlerSection.ConvertUrlsToAscii - { - get { return UrlReplacing.ConvertUrlsToAscii.InvariantEquals("true"); } - } + bool IRequestHandlerSection.TryConvertUrlsToAscii => UrlReplacing.ConvertUrlsToAscii.InvariantEquals("try"); - bool IRequestHandlerSection.TryConvertUrlsToAscii - { - get { return UrlReplacing.ConvertUrlsToAscii.InvariantEquals("try"); } - } - - IEnumerable IRequestHandlerSection.CharCollection - { - get { return UrlReplacing.CharCollection; } - } + IEnumerable IRequestHandlerSection.CharCollection => UrlReplacing.CharCollection; } } diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs index 6bd5be3824..d45a3e7d85 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs @@ -5,25 +5,16 @@ namespace Umbraco.Core.Configuration.UmbracoSettings internal class SecurityElement : UmbracoConfigurationElement, ISecuritySection { [ConfigurationProperty("keepUserLoggedIn")] - internal InnerTextConfigurationElement KeepUserLoggedIn - { - get { return GetOptionalTextElement("keepUserLoggedIn", true); } - } + internal InnerTextConfigurationElement KeepUserLoggedIn => GetOptionalTextElement("keepUserLoggedIn", true); [ConfigurationProperty("hideDisabledUsersInBackoffice")] - internal InnerTextConfigurationElement HideDisabledUsersInBackoffice - { - get { return GetOptionalTextElement("hideDisabledUsersInBackoffice", false); } - } + 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 - { - get { return GetOptionalTextElement("allowPasswordReset", true); } - } + internal InnerTextConfigurationElement AllowPasswordReset => GetOptionalTextElement("allowPasswordReset", true); /// /// A boolean indicating that by default the email address will be the username @@ -33,40 +24,22 @@ namespace Umbraco.Core.Configuration.UmbracoSettings /// When this is false, the username and email fields will be shown in the user section. /// [ConfigurationProperty("usernameIsEmail")] - internal InnerTextConfigurationElement UsernameIsEmail - { - get { return GetOptionalTextElement("usernameIsEmail", true); } - } + internal InnerTextConfigurationElement UsernameIsEmail => GetOptionalTextElement("usernameIsEmail", true); [ConfigurationProperty("authCookieName")] - internal InnerTextConfigurationElement AuthCookieName - { - get { return GetOptionalTextElement("authCookieName", "UMB_UCONTEXT"); } - } + internal InnerTextConfigurationElement AuthCookieName => GetOptionalTextElement("authCookieName", "UMB_UCONTEXT"); [ConfigurationProperty("authCookieDomain")] - internal InnerTextConfigurationElement AuthCookieDomain - { - get { return GetOptionalTextElement("authCookieDomain", null); } - } + internal InnerTextConfigurationElement AuthCookieDomain => GetOptionalTextElement("authCookieDomain", null); - bool ISecuritySection.KeepUserLoggedIn - { - get { return KeepUserLoggedIn; } - } + bool ISecuritySection.KeepUserLoggedIn => KeepUserLoggedIn; - bool ISecuritySection.HideDisabledUsersInBackoffice - { - get { return HideDisabledUsersInBackoffice; } - } + bool ISecuritySection.HideDisabledUsersInBackoffice => HideDisabledUsersInBackoffice; /// /// Used to enable/disable the forgot password functionality on the back office login screen /// - bool ISecuritySection.AllowPasswordReset - { - get { return AllowPasswordReset; } - } + bool ISecuritySection.AllowPasswordReset => AllowPasswordReset; /// /// A boolean indicating that by default the email address will be the username @@ -75,19 +48,10 @@ namespace Umbraco.Core.Configuration.UmbracoSettings /// 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 ISecuritySection.UsernameIsEmail - { - get { return UsernameIsEmail; } - } + bool ISecuritySection.UsernameIsEmail => UsernameIsEmail; - string ISecuritySection.AuthCookieName - { - get { return AuthCookieName; } - } + string ISecuritySection.AuthCookieName => AuthCookieName; - string ISecuritySection.AuthCookieDomain - { - get { return AuthCookieDomain; } - } + string ISecuritySection.AuthCookieDomain => AuthCookieDomain; } } diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/TourConfigElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/TourConfigElement.cs index fb231ec0cf..dab69f3da0 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/TourConfigElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/TourConfigElement.cs @@ -7,11 +7,8 @@ namespace Umbraco.Core.Configuration.UmbracoSettings //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 - { - get { return (bool)this["enable"]; } - } + public bool EnableTours => (bool)this["enable"]; // TODO: We could have additional filters, etc... defined here } -} \ No newline at end of file +} diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/UrlReplacingElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/UrlReplacingElement.cs index cdfa95e780..3e12d106ff 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/UrlReplacingElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/UrlReplacingElement.cs @@ -6,23 +6,17 @@ namespace Umbraco.Core.Configuration.UmbracoSettings internal class UrlReplacingElement : ConfigurationElement { [ConfigurationProperty("removeDoubleDashes", DefaultValue = true)] - internal bool RemoveDoubleDashes - { - get { return (bool) base["removeDoubleDashes"]; } - } + internal bool RemoveDoubleDashes => (bool) base["removeDoubleDashes"]; [ConfigurationProperty("toAscii", DefaultValue = "false")] - internal string ConvertUrlsToAscii - { - get { return (string) base["toAscii"]; } - } + internal string ConvertUrlsToAscii => (string) base["toAscii"]; [ConfigurationCollection(typeof(CharCollection), AddItemName = "char")] [ConfigurationProperty("", IsDefaultCollection = true)] internal CharCollection CharCollection { - get { return (CharCollection)base[""]; } - set { base[""] = value; } + get => (CharCollection)base[""]; + set => base[""] = value; } } diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 241459c433..4e6e832294 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -248,15 +248,12 @@ - - - @@ -265,7 +262,6 @@ - diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs index 2d4d24f3de..b085c4104c 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs @@ -12,12 +12,7 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings { Assert.IsTrue(SettingsSection.RequestHandler.AddTrailingSlash == true); } - [Test] - public void RemoveDoubleDashes() - { - Assert.IsTrue(SettingsSection.RequestHandler.RemoveDoubleDashes == true); - } [Test] public void CharCollection() {