Last cleanup of unused umbraco settings

This commit is contained in:
Shannon
2019-01-31 01:37:38 +11:00
parent 6b2831c606
commit f8fd255239
16 changed files with 48 additions and 226 deletions

View File

@@ -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;
}
}
}

View File

@@ -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()
{

View File

@@ -1,21 +0,0 @@
using System.Xml.Linq;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class FileExtensionElement : InnerTextConfigurationElement<string>, IFileExtension
{
public FileExtensionElement()
{
}
internal FileExtensionElement(XElement rawXml)
: base(rawXml)
{
}
string IFileExtension.Extension
{
get { return Value; }
}
}
}

View File

@@ -1,7 +0,0 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IFileExtension
{
string Extension { get; }
}
}

View File

@@ -1,7 +0,0 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ILogType
{
string LogTypeAlias { get; }
}
}

View File

@@ -6,8 +6,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{
bool AddTrailingSlash { get; }
bool RemoveDoubleDashes { get; }
bool ConvertUrlsToAscii { get; }
bool TryConvertUrlsToAscii { get; }

View File

@@ -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<string> WidthFieldAlias
{
get { return GetOptionalTextElement("widthFieldAlias", "umbracoWidth"); }
}
internal InnerTextConfigurationElement<string> WidthFieldAlias => GetOptionalTextElement("widthFieldAlias", "umbracoWidth");
[ConfigurationProperty("heightFieldAlias")]
internal InnerTextConfigurationElement<string> HeightFieldAlias
{
get { return GetOptionalTextElement("heightFieldAlias", "umbracoHeight"); }
}
internal InnerTextConfigurationElement<string> HeightFieldAlias => GetOptionalTextElement("heightFieldAlias", "umbracoHeight");
[ConfigurationProperty("lengthFieldAlias")]
internal InnerTextConfigurationElement<string> LengthFieldAlias
{
get { return GetOptionalTextElement("lengthFieldAlias", "umbracoBytes"); }
}
internal InnerTextConfigurationElement<string> LengthFieldAlias => GetOptionalTextElement("lengthFieldAlias", "umbracoBytes");
[ConfigurationProperty("extensionFieldAlias")]
internal InnerTextConfigurationElement<string> ExtensionFieldAlias
{
get { return GetOptionalTextElement("extensionFieldAlias", "umbracoExtension"); }
}
internal InnerTextConfigurationElement<string> 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;
}
}

View File

@@ -1,11 +0,0 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class LogTypeElement : InnerTextConfigurationElement<string>, ILogType
{
string ILogType.LogTypeAlias
{
get { return Value; }
}
}
}

View File

@@ -7,15 +7,8 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{
[ConfigurationProperty("maxLogAge")]
internal InnerTextConfigurationElement<int> MaxLogAge
{
get { return GetOptionalTextElement("maxLogAge", -1); }
}
int ILoggingSection.MaxLogAge
{
get { return MaxLogAge; }
}
internal InnerTextConfigurationElement<int> MaxLogAge => GetOptionalTextElement("maxLogAge", -1);
int ILoggingSection.MaxLogAge => MaxLogAge;
}
}

View File

@@ -5,16 +5,9 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
internal class NotificationsElement : UmbracoConfigurationElement
{
[ConfigurationProperty("email")]
internal InnerTextConfigurationElement<string> NotificationEmailAddress
{
get { return (InnerTextConfigurationElement<string>)this["email"]; }
}
internal InnerTextConfigurationElement<string> NotificationEmailAddress => (InnerTextConfigurationElement<string>)this["email"];
[ConfigurationProperty("disableHtmlEmail")]
internal InnerTextConfigurationElement<bool> DisableHtmlEmail
{
get { return GetOptionalTextElement("disableHtmlEmail", false); }
}
internal InnerTextConfigurationElement<bool> DisableHtmlEmail => GetOptionalTextElement("disableHtmlEmail", false);
}
}

View File

@@ -8,10 +8,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
internal class RequestHandlerElement : UmbracoConfigurationElement, IRequestHandlerSection
{
[ConfigurationProperty("addTrailingSlash")]
public InnerTextConfigurationElement<bool> AddTrailingSlash
{
get { return GetOptionalTextElement("addTrailingSlash", true); }
}
public InnerTextConfigurationElement<bool> 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<IChar> IRequestHandlerSection.CharCollection
{
get { return UrlReplacing.CharCollection; }
}
IEnumerable<IChar> IRequestHandlerSection.CharCollection => UrlReplacing.CharCollection;
}
}

View File

@@ -5,25 +5,16 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
internal class SecurityElement : UmbracoConfigurationElement, ISecuritySection
{
[ConfigurationProperty("keepUserLoggedIn")]
internal InnerTextConfigurationElement<bool> KeepUserLoggedIn
{
get { return GetOptionalTextElement("keepUserLoggedIn", true); }
}
internal InnerTextConfigurationElement<bool> KeepUserLoggedIn => GetOptionalTextElement("keepUserLoggedIn", true);
[ConfigurationProperty("hideDisabledUsersInBackoffice")]
internal InnerTextConfigurationElement<bool> HideDisabledUsersInBackoffice
{
get { return GetOptionalTextElement("hideDisabledUsersInBackoffice", false); }
}
internal InnerTextConfigurationElement<bool> HideDisabledUsersInBackoffice => GetOptionalTextElement("hideDisabledUsersInBackoffice", false);
/// <summary>
/// Used to enable/disable the forgot password functionality on the back office login screen
/// </summary>
[ConfigurationProperty("allowPasswordReset")]
internal InnerTextConfigurationElement<bool> AllowPasswordReset
{
get { return GetOptionalTextElement("allowPasswordReset", true); }
}
internal InnerTextConfigurationElement<bool> AllowPasswordReset => GetOptionalTextElement("allowPasswordReset", true);
/// <summary>
/// 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.
/// </remarks>
[ConfigurationProperty("usernameIsEmail")]
internal InnerTextConfigurationElement<bool> UsernameIsEmail
{
get { return GetOptionalTextElement("usernameIsEmail", true); }
}
internal InnerTextConfigurationElement<bool> UsernameIsEmail => GetOptionalTextElement("usernameIsEmail", true);
[ConfigurationProperty("authCookieName")]
internal InnerTextConfigurationElement<string> AuthCookieName
{
get { return GetOptionalTextElement("authCookieName", "UMB_UCONTEXT"); }
}
internal InnerTextConfigurationElement<string> AuthCookieName => GetOptionalTextElement("authCookieName", "UMB_UCONTEXT");
[ConfigurationProperty("authCookieDomain")]
internal InnerTextConfigurationElement<string> AuthCookieDomain
{
get { return GetOptionalTextElement<string>("authCookieDomain", null); }
}
internal InnerTextConfigurationElement<string> AuthCookieDomain => GetOptionalTextElement<string>("authCookieDomain", null);
bool ISecuritySection.KeepUserLoggedIn
{
get { return KeepUserLoggedIn; }
}
bool ISecuritySection.KeepUserLoggedIn => KeepUserLoggedIn;
bool ISecuritySection.HideDisabledUsersInBackoffice
{
get { return HideDisabledUsersInBackoffice; }
}
bool ISecuritySection.HideDisabledUsersInBackoffice => HideDisabledUsersInBackoffice;
/// <summary>
/// Used to enable/disable the forgot password functionality on the back office login screen
/// </summary>
bool ISecuritySection.AllowPasswordReset
{
get { return AllowPasswordReset; }
}
bool ISecuritySection.AllowPasswordReset => AllowPasswordReset;
/// <summary>
/// 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.
/// </remarks>
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;
}
}

View File

@@ -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
}
}
}

View File

@@ -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;
}
}

View File

@@ -248,15 +248,12 @@
<Compile Include="Configuration\UmbracoSettings\ContentErrorsElement.cs" />
<Compile Include="Configuration\UmbracoSettings\ContentImagingElement.cs" />
<Compile Include="Configuration\UmbracoSettings\ContentSectionExtensions.cs" />
<Compile Include="Configuration\UmbracoSettings\FileExtensionElement.cs" />
<Compile Include="Configuration\UmbracoSettings\IBackOfficeSection.cs" />
<Compile Include="Configuration\UmbracoSettings\IChar.cs" />
<Compile Include="Configuration\UmbracoSettings\IContentErrorPage.cs" />
<Compile Include="Configuration\UmbracoSettings\IContentSection.cs" />
<Compile Include="Configuration\UmbracoSettings\IFileExtension.cs" />
<Compile Include="Configuration\UmbracoSettings\IImagingAutoFillUploadField.cs" />
<Compile Include="Configuration\UmbracoSettings\ILoggingSection.cs" />
<Compile Include="Configuration\UmbracoSettings\ILogType.cs" />
<Compile Include="Configuration\UmbracoSettings\ImagingAutoFillPropertiesCollection.cs" />
<Compile Include="Configuration\UmbracoSettings\ImagingAutoFillUploadFieldElement.cs" />
<Compile Include="Configuration\UmbracoSettings\IRequestHandlerSection.cs" />
@@ -265,7 +262,6 @@
<Compile Include="Configuration\UmbracoSettings\IUmbracoSettingsSection.cs" />
<Compile Include="Configuration\UmbracoSettings\IWebRoutingSection.cs" />
<Compile Include="Configuration\UmbracoSettings\LoggingElement.cs" />
<Compile Include="Configuration\UmbracoSettings\LogTypeElement.cs" />
<Compile Include="Configuration\UmbracoSettings\NotificationsElement.cs" />
<Compile Include="Configuration\UmbracoSettings\RequestHandlerElement.cs" />
<Compile Include="Configuration\UmbracoSettings\SecurityElement.cs" />

View File

@@ -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()
{