From 66e32148b2090b34651239c3b271bd4a3d36faaa Mon Sep 17 00:00:00 2001 From: Benjamin Carleski Date: Mon, 20 Jan 2020 10:44:04 -0800 Subject: [PATCH] Remove unused obsoletes from Umbraco.Abstractions --- .../Composing/Composers.cs | 22 -------- .../Constants-AppSettings.cs | 4 -- .../ArgumentNullOrEmptyException.cs | 55 ------------------- .../Exceptions/WontImplementException.cs | 52 ------------------ .../IO/FileSecurityException.cs | 46 ---------------- .../PublishedModelFactoryExtensions.cs | 19 ------- .../Services/IContentService.cs | 7 --- .../Services/IMediaService.cs | 7 --- src/Umbraco.Configuration/GlobalSettings.cs | 17 ------ .../Services/Implement/ContentService.cs | 7 --- .../Services/Implement/MediaService.cs | 7 --- 11 files changed, 243 deletions(-) delete mode 100644 src/Umbraco.Abstractions/Exceptions/ArgumentNullOrEmptyException.cs delete mode 100644 src/Umbraco.Abstractions/Exceptions/WontImplementException.cs delete mode 100644 src/Umbraco.Abstractions/IO/FileSecurityException.cs diff --git a/src/Umbraco.Abstractions/Composing/Composers.cs b/src/Umbraco.Abstractions/Composing/Composers.cs index b2e6c9d068..004c2527e6 100644 --- a/src/Umbraco.Abstractions/Composing/Composers.cs +++ b/src/Umbraco.Abstractions/Composing/Composers.cs @@ -22,28 +22,6 @@ namespace Umbraco.Core.Composing private const int LogThresholdMilliseconds = 100; - /// - /// Initializes a new instance of the class. - /// - /// The composition. - /// The types. - /// The profiling logger. - [Obsolete("This overload only gets the EnableComposer/DisableComposer attributes from the composerTypes assemblies.")] - public Composers(Composition composition, IEnumerable composerTypes, IProfilingLogger logger) - : this(composition, composerTypes, Enumerable.Empty(), logger) - { - var enableDisableAttributes = new List(); - - var assemblies = composerTypes.Select(t => t.Assembly).Distinct(); - foreach (var assembly in assemblies) - { - enableDisableAttributes.AddRange(assembly.GetCustomAttributes(typeof(EnableComposerAttribute))); - enableDisableAttributes.AddRange(assembly.GetCustomAttributes(typeof(DisableComposerAttribute))); - } - - _enableDisableAttributes = enableDisableAttributes; - } - /// /// Initializes a new instance of the class. /// diff --git a/src/Umbraco.Abstractions/Constants-AppSettings.cs b/src/Umbraco.Abstractions/Constants-AppSettings.cs index beaffef5b4..2217863122 100644 --- a/src/Umbraco.Abstractions/Constants-AppSettings.cs +++ b/src/Umbraco.Abstractions/Constants-AppSettings.cs @@ -9,10 +9,6 @@ namespace Umbraco.Core /// public static class AppSettings { - // TODO: Kill me - still used in Umbraco.Core.IO.SystemFiles:27 - [Obsolete("We need to kill this appsetting as we do not use XML content cache umbraco.config anymore due to NuCache")] - public const string ContentXML = "Umbraco.Core.ContentXML"; //umbracoContentXML - /// /// TODO: FILL ME IN /// diff --git a/src/Umbraco.Abstractions/Exceptions/ArgumentNullOrEmptyException.cs b/src/Umbraco.Abstractions/Exceptions/ArgumentNullOrEmptyException.cs deleted file mode 100644 index 037d35d0ee..0000000000 --- a/src/Umbraco.Abstractions/Exceptions/ArgumentNullOrEmptyException.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace Umbraco.Core.Exceptions -{ - /// - /// The exception that is thrown when a null reference, or an empty argument, is passed to a method that does not accept it as a valid argument. - /// - /// - [Obsolete("Throw an ArgumentNullException when the parameter is null or an ArgumentException when its empty instead.")] - [Serializable] - public class ArgumentNullOrEmptyException : ArgumentNullException - { - /// - /// Initializes a new instance of the class. - /// - public ArgumentNullOrEmptyException() - { } - - /// - /// Initializes a new instance of the class with the name of the parameter that caused this exception. - /// - /// The named of the parameter that caused the exception. - public ArgumentNullOrEmptyException(string paramName) - : base(paramName) - { } - - /// - /// Initializes a new instance of the class with a specified error message and the name of the parameter that caused this exception. - /// - /// The named of the parameter that caused the exception. - /// A message that describes the error. - public ArgumentNullOrEmptyException(string paramName, string message) - : base(paramName, message) - { } - - /// - /// Initializes a new instance of the class. - /// - /// The error message that explains the reason for this exception. - /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified. - public ArgumentNullOrEmptyException(string message, Exception innerException) - : base(message, innerException) - { } - - /// - /// Initializes a new instance of the class. - /// - /// The object that holds the serialized object data. - /// An object that describes the source or destination of the serialized data. - protected ArgumentNullOrEmptyException(SerializationInfo info, StreamingContext context) - : base(info, context) - { } - } -} diff --git a/src/Umbraco.Abstractions/Exceptions/WontImplementException.cs b/src/Umbraco.Abstractions/Exceptions/WontImplementException.cs deleted file mode 100644 index e354bc4c3d..0000000000 --- a/src/Umbraco.Abstractions/Exceptions/WontImplementException.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace Umbraco.Core.Exceptions -{ - /// - /// The exception that is thrown when a requested method or operation is not, and will not be, implemented. - /// - /// - /// The is to be used when some code is not implemented, - /// but should eventually be implemented (i.e. work in progress) and is reported by tools such as ReSharper. - /// This exception is to be used when some code is not implemented, and is not meant to be, for whatever - /// reason. - /// - /// - [Serializable] - [Obsolete("If a method or operation is not, and will not be, implemented, it is invalid or not supported, so we should throw either an InvalidOperationException or NotSupportedException instead.")] - public class WontImplementException : NotImplementedException - { - /// - /// Initializes a new instance of the class. - /// - public WontImplementException() - { } - - /// - /// Initializes a new instance of the class with a specified reason message. - /// - /// The error message that explains the reason for the exception. - public WontImplementException(string message) - : base(message) - { } - - /// - /// Initializes a new instance of the class. - /// - /// The error message that explains the reason for the exception. - /// The exception that is the cause of the current exception. If the parameter is not , the current exception is raised in a block that handles the inner exception. - public WontImplementException(string message, Exception inner) - : base(message, inner) - { } - - /// - /// Initializes a new instance of the class. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected WontImplementException(SerializationInfo info, StreamingContext context) - : base(info, context) - { } - } -} diff --git a/src/Umbraco.Abstractions/IO/FileSecurityException.cs b/src/Umbraco.Abstractions/IO/FileSecurityException.cs deleted file mode 100644 index 8ce9ab34a5..0000000000 --- a/src/Umbraco.Abstractions/IO/FileSecurityException.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace Umbraco.Core.IO -{ - /// - /// The exception that is thrown when the caller does not have the required permission to access a file. - /// - /// - [Obsolete("Throw an UnauthorizedAccessException instead.")] - [Serializable] - public class FileSecurityException : Exception - { - /// - /// Initializes a new instance of the class. - /// - public FileSecurityException() - { } - - /// - /// Initializes a new instance of the class. - /// - /// The message that describes the error. - public FileSecurityException(string message) - : base(message) - { } - - /// - /// Initializes a new instance of the class. - /// - /// The error message that explains the reason for the exception. - /// The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified. - public FileSecurityException(string message, Exception innerException) - : base(message, innerException) - { } - - /// - /// Initializes a new instance of the class. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected FileSecurityException(SerializationInfo info, StreamingContext context) - : base(info, context) - { } - } -} diff --git a/src/Umbraco.Abstractions/PublishedModelFactoryExtensions.cs b/src/Umbraco.Abstractions/PublishedModelFactoryExtensions.cs index ac8c9f1be7..29ffee8ed4 100644 --- a/src/Umbraco.Abstractions/PublishedModelFactoryExtensions.cs +++ b/src/Umbraco.Abstractions/PublishedModelFactoryExtensions.cs @@ -17,25 +17,6 @@ namespace Umbraco.Core /// public static bool IsLiveFactory(this IPublishedModelFactory factory) => factory is ILivePublishedModelFactory; - [Obsolete("This method is no longer used or necessary and will be removed from future")] - [EditorBrowsable(EditorBrowsableState.Never)] - public static void WithSafeLiveFactory(this IPublishedModelFactory factory, Action action) - { - if (factory is ILivePublishedModelFactory liveFactory) - { - lock (liveFactory.SyncRoot) - { - //Call refresh on the live factory to re-compile the models - liveFactory.Refresh(); - action(); - } - } - else - { - action(); - } - } - /// /// Sets a flag to reset the ModelsBuilder models if the is /// diff --git a/src/Umbraco.Abstractions/Services/IContentService.cs b/src/Umbraco.Abstractions/Services/IContentService.cs index 2a34fcb898..25428f420b 100644 --- a/src/Umbraco.Abstractions/Services/IContentService.cs +++ b/src/Umbraco.Abstractions/Services/IContentService.cs @@ -312,13 +312,6 @@ namespace Umbraco.Core.Services /// OperationResult MoveToRecycleBin(IContent content, int userId = Constants.Security.SuperUserId); - /// - /// Empties the recycle bin. - /// - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use EmptyRecycleBin with explicit indication of user ID instead")] - OperationResult EmptyRecycleBin(); - /// /// Empties the Recycle Bin by deleting all that resides in the bin /// diff --git a/src/Umbraco.Abstractions/Services/IMediaService.cs b/src/Umbraco.Abstractions/Services/IMediaService.cs index 6de2765644..c1537adbc8 100644 --- a/src/Umbraco.Abstractions/Services/IMediaService.cs +++ b/src/Umbraco.Abstractions/Services/IMediaService.cs @@ -156,13 +156,6 @@ namespace Umbraco.Core.Services /// Id of the User deleting the Media Attempt MoveToRecycleBin(IMedia media, int userId = Constants.Security.SuperUserId); - /// - /// Empties the Recycle Bin by deleting all that resides in the bin - /// - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use EmptyRecycleBin with explicit indication of user ID instead")] - OperationResult EmptyRecycleBin(); - /// /// Empties the Recycle Bin by deleting all that resides in the bin /// diff --git a/src/Umbraco.Configuration/GlobalSettings.cs b/src/Umbraco.Configuration/GlobalSettings.cs index 499ff787a8..8376082c2a 100644 --- a/src/Umbraco.Configuration/GlobalSettings.cs +++ b/src/Umbraco.Configuration/GlobalSettings.cs @@ -185,23 +185,6 @@ namespace Umbraco.Core.Configuration } } - /// - /// Gets the name of the content XML file. - /// - /// The content XML. - /// - /// Defaults to ~/App_Data/umbraco.config - /// - public string ContentXmlFile - { - get - { - return ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.ContentXML) - ? ConfigurationManager.AppSettings[Constants.AppSettings.ContentXML] - : "~/App_Data/umbraco.config"; - } - } - /// /// Gets the path to umbraco's root directory (/umbraco by default). /// diff --git a/src/Umbraco.Infrastructure/Services/Implement/ContentService.cs b/src/Umbraco.Infrastructure/Services/Implement/ContentService.cs index f386f22f39..d02f84d294 100644 --- a/src/Umbraco.Infrastructure/Services/Implement/ContentService.cs +++ b/src/Umbraco.Infrastructure/Services/Implement/ContentService.cs @@ -2030,13 +2030,6 @@ namespace Umbraco.Core.Services.Implement _documentRepository.Save(content); } - /// - /// Empties the Recycle Bin by deleting all that resides in the bin - /// - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use EmptyRecycleBin with explicit indication of user ID instead")] - public OperationResult EmptyRecycleBin() => EmptyRecycleBin(Constants.Security.SuperUserId); - /// /// Empties the Recycle Bin by deleting all that resides in the bin /// diff --git a/src/Umbraco.Infrastructure/Services/Implement/MediaService.cs b/src/Umbraco.Infrastructure/Services/Implement/MediaService.cs index 27e428d1d6..14bebc4eb8 100644 --- a/src/Umbraco.Infrastructure/Services/Implement/MediaService.cs +++ b/src/Umbraco.Infrastructure/Services/Implement/MediaService.cs @@ -1029,13 +1029,6 @@ namespace Umbraco.Core.Services.Implement _mediaRepository.Save(media); } - /// - /// Empties the Recycle Bin by deleting all that resides in the bin - /// - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use EmptyRecycleBin with explicit indication of user ID instead")] - public OperationResult EmptyRecycleBin() => EmptyRecycleBin(Constants.Security.SuperUserId); - /// /// Empties the Recycle Bin by deleting all that resides in the bin ///