diff --git a/src/Umbraco.Core/Auditing/IdentityAuditEventArgs.cs b/src/Umbraco.Core/Auditing/IdentityAuditEventArgs.cs index c58bb409b0..ff335434ab 100644 --- a/src/Umbraco.Core/Auditing/IdentityAuditEventArgs.cs +++ b/src/Umbraco.Core/Auditing/IdentityAuditEventArgs.cs @@ -46,19 +46,6 @@ namespace Umbraco.Core.Auditing /// public string Username { get; private set; } - [Obsolete("Use the method that has the affectedUser parameter instead")] - [EditorBrowsable(EditorBrowsableState.Never)] - public IdentityAuditEventArgs(AuditEvent action, string ipAddress, int performingUser = -1) - { - DateTimeUtc = DateTime.UtcNow; - Action = action; - - IpAddress = ipAddress; - - PerformingUser = performingUser == -1 - ? GetCurrentRequestBackofficeUserId() - : performingUser; - } /// /// Default constructor diff --git a/src/Umbraco.Core/Cache/CacheHelper.cs b/src/Umbraco.Core/Cache/CacheHelper.cs index a85285e427..f99b1e847b 100644 --- a/src/Umbraco.Core/Cache/CacheHelper.cs +++ b/src/Umbraco.Core/Cache/CacheHelper.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; using System.Web; -using System.Web.Caching; namespace Umbraco.Core.Cache { @@ -53,15 +50,6 @@ namespace Umbraco.Core.Cache { } - [Obsolete("Use the constructor the specifies all dependencies")] - [EditorBrowsable(EditorBrowsableState.Never)] - public CacheHelper( - IRuntimeCacheProvider httpCacheProvider, - ICacheProvider staticCacheProvider, - ICacheProvider requestCacheProvider) - : this(httpCacheProvider, staticCacheProvider, requestCacheProvider, new IsolatedRuntimeCache(t => new ObjectCacheRuntimeCacheProvider())) - { - } /// /// Initializes a new instance based on the provided providers @@ -106,317 +94,6 @@ namespace Umbraco.Core.Cache /// public IsolatedRuntimeCache IsolatedRuntimeCache { get; internal set; } - #region Legacy Runtime/Http Cache accessors - - /// - /// Clears the item in umbraco's runtime cache - /// - [Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")] - [EditorBrowsable(EditorBrowsableState.Never)] - public void ClearAllCache() - { - RuntimeCache.ClearAllCache(); - IsolatedRuntimeCache.ClearAllCaches(); - } - - /// - /// Clears the item in umbraco's runtime cache with the given key - /// - /// Key - [Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")] - [EditorBrowsable(EditorBrowsableState.Never)] - public void ClearCacheItem(string key) - { - RuntimeCache.ClearCacheItem(key); - } - - - /// - /// Clears all objects in the System.Web.Cache with the System.Type name as the - /// input parameter. (using [object].GetType()) - /// - /// The name of the System.Type which should be cleared from cache ex "System.Xml.XmlDocument" - [Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")] - public void ClearCacheObjectTypes(string typeName) - { - RuntimeCache.ClearCacheObjectTypes(typeName); - } - - /// - /// Clears all objects in the System.Web.Cache with the System.Type specified - /// - [Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")] - [EditorBrowsable(EditorBrowsableState.Never)] - public void ClearCacheObjectTypes() - { - RuntimeCache.ClearCacheObjectTypes(); - } - - /// - /// Clears all cache items that starts with the key passed. - /// - /// The start of the key - [Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")] - [EditorBrowsable(EditorBrowsableState.Never)] - public void ClearCacheByKeySearch(string keyStartsWith) - { - RuntimeCache.ClearCacheByKeySearch(keyStartsWith); - } - - /// - /// Clears all cache items that have a key that matches the regular expression - /// - /// - [Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")] - [EditorBrowsable(EditorBrowsableState.Never)] - public void ClearCacheByKeyExpression(string regexString) - { - RuntimeCache.ClearCacheByKeyExpression(regexString); - } - - [Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")] - [EditorBrowsable(EditorBrowsableState.Never)] - public IEnumerable GetCacheItemsByKeySearch(string keyStartsWith) - { - return RuntimeCache.GetCacheItemsByKeySearch(keyStartsWith); - } - - /// - /// Returns a cache item by key, does not update the cache if it isn't there. - /// - /// - /// - /// - [Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")] - [EditorBrowsable(EditorBrowsableState.Never)] - public TT GetCacheItem(string cacheKey) - { - return RuntimeCache.GetCacheItem(cacheKey); - } - - /// - /// Gets (and adds if necessary) an item from the cache with all of the default parameters - /// - /// - /// - /// - /// - [Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")] - [EditorBrowsable(EditorBrowsableState.Never)] - public TT GetCacheItem(string cacheKey, Func getCacheItem) - { - return RuntimeCache.GetCacheItem(cacheKey, getCacheItem); - - } - - /// - /// Gets (and adds if necessary) an item from the cache with the specified absolute expiration date (from NOW) - /// - /// - /// - /// This will set an absolute expiration from now until the timeout - /// - /// - [Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")] - [EditorBrowsable(EditorBrowsableState.Never)] - public TT GetCacheItem(string cacheKey, - TimeSpan timeout, Func getCacheItem) - { - return RuntimeCache.GetCacheItem(cacheKey, getCacheItem, timeout); - - } - - /// - /// Gets (and adds if necessary) an item from the cache with the specified absolute expiration date (from NOW) - /// - /// - /// - /// - /// This will set an absolute expiration from now until the timeout - /// - /// - [Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")] - [EditorBrowsable(EditorBrowsableState.Never)] - public TT GetCacheItem(string cacheKey, - CacheItemRemovedCallback refreshAction, TimeSpan timeout, - Func getCacheItem) - { - return RuntimeCache.GetCacheItem(cacheKey, getCacheItem, timeout, removedCallback: refreshAction); - - } - - /// - /// Gets (and adds if necessary) an item from the cache with the specified absolute expiration date (from NOW) - /// - /// - /// - /// - /// - /// This will set an absolute expiration from now until the timeout - /// - /// - [Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")] - [EditorBrowsable(EditorBrowsableState.Never)] - public TT GetCacheItem(string cacheKey, - CacheItemPriority priority, CacheItemRemovedCallback refreshAction, TimeSpan timeout, - Func getCacheItem) - { - return RuntimeCache.GetCacheItem(cacheKey, getCacheItem, timeout, false, priority, refreshAction); - - } - - /// - /// Gets (and adds if necessary) an item from the cache with the specified absolute expiration date (from NOW) - /// - /// - /// - /// - /// - /// - /// This will set an absolute expiration from now until the timeout - /// - /// - [Obsolete("Do not use this method, we no longer support the caching overloads with references to CacheDependency, use the overloads specifying a file collection instead")] - public TT GetCacheItem(string cacheKey, - CacheItemPriority priority, - CacheItemRemovedCallback refreshAction, - CacheDependency cacheDependency, - TimeSpan timeout, - Func getCacheItem) - { - var cache = GetHttpRuntimeCacheProvider(RuntimeCache); - if (cache != null) - { - var result = cache.GetCacheItem(cacheKey, () => getCacheItem(), timeout, false, priority, refreshAction, cacheDependency); - return result == null ? default(TT) : result.TryConvertTo().Result; - } - throw new InvalidOperationException("Cannot use this obsoleted overload when the current provider is not of type " + typeof(HttpRuntimeCacheProvider)); - } - - /// - /// Gets (and adds if necessary) an item from the cache - /// - /// - /// - /// - /// - /// - /// - [Obsolete("Do not use this method, we no longer support the caching overloads with references to CacheDependency, use the overloads specifying a file collection instead")] - public TT GetCacheItem(string cacheKey, - CacheItemPriority priority, - CacheDependency cacheDependency, - Func getCacheItem) - { - var cache = GetHttpRuntimeCacheProvider(RuntimeCache); - if (cache != null) - { - var result = cache.GetCacheItem(cacheKey, () => getCacheItem(), null, false, priority, null, cacheDependency); - return result == null ? default(TT) : result.TryConvertTo().Result; - } - throw new InvalidOperationException("Cannot use this obsoleted overload when the current provider is not of type " + typeof(HttpRuntimeCacheProvider)); - } - - /// - /// Inserts an item into the cache, if it already exists in the cache it will be replaced - /// - /// - /// - /// - /// - [Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")] - [EditorBrowsable(EditorBrowsableState.Never)] - public void InsertCacheItem(string cacheKey, - CacheItemPriority priority, - Func getCacheItem) - { - RuntimeCache.InsertCacheItem(cacheKey, getCacheItem, priority: priority); - - } - - /// - /// Inserts an item into the cache, if it already exists in the cache it will be replaced - /// - /// - /// - /// - /// This will set an absolute expiration from now until the timeout - /// - [Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")] - [EditorBrowsable(EditorBrowsableState.Never)] - public void InsertCacheItem(string cacheKey, - CacheItemPriority priority, - TimeSpan timeout, - Func getCacheItem) - { - RuntimeCache.InsertCacheItem(cacheKey, getCacheItem, timeout, priority: priority); - } - - /// - /// Inserts an item into the cache, if it already exists in the cache it will be replaced - /// - /// - /// - /// - /// - /// This will set an absolute expiration from now until the timeout - /// - [Obsolete("Do not use this method, we no longer support the caching overloads with references to CacheDependency, use the overloads specifying a file collection instead")] - public void InsertCacheItem(string cacheKey, - CacheItemPriority priority, - CacheDependency cacheDependency, - TimeSpan timeout, - Func getCacheItem) - { - var cache = GetHttpRuntimeCacheProvider(RuntimeCache); - if (cache != null) - { - cache.InsertCacheItem(cacheKey, () => getCacheItem(), timeout, false, priority, null, cacheDependency); - } - throw new InvalidOperationException("Cannot use this obsoleted overload when the current provider is not of type " + typeof(HttpRuntimeCacheProvider)); - } - - /// - /// Inserts an item into the cache, if it already exists in the cache it will be replaced - /// - /// - /// - /// - /// - /// - /// This will set an absolute expiration from now until the timeout - /// - [Obsolete("Do not use this method, we no longer support the caching overloads with references to CacheDependency, use the overloads specifying a file collection instead")] - public void InsertCacheItem(string cacheKey, - CacheItemPriority priority, - CacheItemRemovedCallback refreshAction, - CacheDependency cacheDependency, - TimeSpan? timeout, - Func getCacheItem) - { - var cache = GetHttpRuntimeCacheProvider(RuntimeCache); - if (cache != null) - { - cache.InsertCacheItem(cacheKey, () => getCacheItem(), timeout, false, priority, refreshAction, cacheDependency); - } - throw new InvalidOperationException("Cannot use this obsoleted overload when the current provider is not of type " + typeof(HttpRuntimeCacheProvider)); - } - #endregion - - private HttpRuntimeCacheProvider GetHttpRuntimeCacheProvider(IRuntimeCacheProvider runtimeCache) - { - HttpRuntimeCacheProvider cache; - var wrapper = RuntimeCache as IRuntimeCacheProviderWrapper; - if (wrapper != null) - { - cache = wrapper.InnerProvider as HttpRuntimeCacheProvider; - } - else - { - cache = RuntimeCache as HttpRuntimeCacheProvider; - } - return cache; - } } } diff --git a/src/Umbraco.Core/Cache/CacheKeys.cs b/src/Umbraco.Core/Cache/CacheKeys.cs index 1058fa6181..e7dcf7cd8c 100644 --- a/src/Umbraco.Core/Cache/CacheKeys.cs +++ b/src/Umbraco.Core/Cache/CacheKeys.cs @@ -1,6 +1,4 @@ -using System; -using System.ComponentModel; -using Umbraco.Core.CodeAnnotations; +using Umbraco.Core.CodeAnnotations; namespace Umbraco.Core.Cache { @@ -12,14 +10,6 @@ namespace Umbraco.Core.Cache public const string ApplicationTreeCacheKey = "ApplicationTreeCache"; public const string ApplicationsCacheKey = "ApplicationCache"; - [Obsolete("This is no longer used and will be removed from the codebase in the future")] - [EditorBrowsable(EditorBrowsableState.Never)] - public const string UserTypeCacheKey = "UserTypeCache"; - - [Obsolete("This is no longer used and will be removed from the codebase in the future - it is referenced but no cache is stored against this key")] - [EditorBrowsable(EditorBrowsableState.Never)] - public const string ContentItemCacheKey = "contentItem"; - [UmbracoWillObsolete("This cache key is only used for the legacy 'library' caching, remove in v8")] public const string MediaCacheKey = "UL_GetMedia"; diff --git a/src/Umbraco.Core/Constants-Conventions.cs b/src/Umbraco.Core/Constants-Conventions.cs index ed3e7d682c..524ae580a3 100644 --- a/src/Umbraco.Core/Constants-Conventions.cs +++ b/src/Umbraco.Core/Constants-Conventions.cs @@ -26,18 +26,8 @@ namespace Umbraco.Core [Obsolete("No longer supported, this is here for backwards compatibility only")] public const string MemberIdRuleType = "MemberId"; - [Obsolete("No longer supported, this is here for backwards compatibility only")] - public const string MemberGroupIdRuleType = "MemberGroupId"; } - public static class Localization - { - /// - /// The root id for all top level dictionary items - /// - [Obsolete("There is no dictionary root item id anymore, it is simply null")] - public const string DictionaryItemRootId = "41c7638d-f529-4bff-853e-59a0c2fb1bde"; - } public static class DataTypes { diff --git a/src/Umbraco.Core/Constants-ObjectTypes.cs b/src/Umbraco.Core/Constants-ObjectTypes.cs index fb629d382e..790c143bbf 100644 --- a/src/Umbraco.Core/Constants-ObjectTypes.cs +++ b/src/Umbraco.Core/Constants-ObjectTypes.cs @@ -127,11 +127,6 @@ namespace Umbraco.Core public static readonly Guid ContentItem = new Guid(Strings.ContentItem); - [Obsolete("This no longer exists in the database")] - internal static readonly Guid Stylesheet = new Guid(Strings.Stylesheet); - - [Obsolete("This no longer exists in the database")] - internal static readonly Guid StylesheetProperty = new Guid(Strings.StylesheetProperty); } } } diff --git a/src/Umbraco.Core/Events/MoveEventArgs.cs b/src/Umbraco.Core/Events/MoveEventArgs.cs index 29483e5e01..aaeddc6921 100644 --- a/src/Umbraco.Core/Events/MoveEventArgs.cs +++ b/src/Umbraco.Core/Events/MoveEventArgs.cs @@ -88,15 +88,6 @@ namespace Umbraco.Core.Events EventObject = moveInfo.First().Entity; } - [Obsolete("Use the overload that specifies the MoveEventInfo object")] - public MoveEventArgs(TEntity eventObject, bool canCancel, int parentId) - : base(eventObject, canCancel) - { } - - [Obsolete("Use the overload that specifies the MoveEventInfo object")] - public MoveEventArgs(TEntity eventObject, int parentId) - : base(eventObject) - { } /// /// Gets all MoveEventInfo objects used to create the object @@ -119,15 +110,6 @@ namespace Umbraco.Core.Events } } - /// - /// The entity being moved - /// - [Obsolete("Retrieve the entity object from the MoveInfoCollection property instead")] - public TEntity Entity - { - get { return EventObject; } - } - public bool Equals(MoveEventArgs other) { if (other is null) return false; diff --git a/src/Umbraco.Core/Models/ContentExtensions.cs b/src/Umbraco.Core/Models/ContentExtensions.cs index 2c013e9b90..d8eb900bb2 100644 --- a/src/Umbraco.Core/Models/ContentExtensions.cs +++ b/src/Umbraco.Core/Models/ContentExtensions.cs @@ -5,13 +5,10 @@ using System.IO; using System.Linq; using System.Web; using System.Xml.Linq; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using Umbraco.Core.Composing; using Umbraco.Core.IO; using Umbraco.Core.Models.Entities; using Umbraco.Core.Models.Membership; -using Umbraco.Core.PropertyEditors; using Umbraco.Core.Services; using Umbraco.Core.Services.Implement; @@ -98,12 +95,6 @@ namespace Umbraco.Core.Models return mediaService.GetAncestors(media); } - [Obsolete("Use the overload with the service reference instead")] - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Ancestors(this IMedia media) - { - return Current.Services.MediaService.GetAncestors(media); - } /// /// Returns a list of the current medias children. @@ -116,12 +107,6 @@ namespace Umbraco.Core.Models return mediaService.GetChildren(media.Id); } - [Obsolete("Use the overload with the service reference instead")] - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Children(this IMedia media) - { - return Current.Services.MediaService.GetChildren(media.Id); - } /// /// Returns a list of the current medias descendants, not including the media itself. @@ -134,12 +119,6 @@ namespace Umbraco.Core.Models return mediaService.GetDescendants(media); } - [Obsolete("Use the overload with the service reference instead")] - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Descendants(this IMedia media) - { - return Current.Services.MediaService.GetDescendants(media); - } /// /// Returns the parent of the current media. @@ -152,12 +131,6 @@ namespace Umbraco.Core.Models return mediaService.GetById(media.ParentId); } - [Obsolete("Use the overload with the service reference instead")] - [EditorBrowsable(EditorBrowsableState.Never)] - public static IMedia Parent(this IMedia media) - { - return Current.Services.MediaService.GetById(media.ParentId); - } #endregion /// @@ -339,14 +312,6 @@ namespace Umbraco.Core.Models #region User/Profile methods - - [Obsolete("Use the overload that declares the IUserService to use")] - [EditorBrowsable(EditorBrowsableState.Never)] - public static IProfile GetCreatorProfile(this IMedia media) - { - return Current.Services.UserService.GetProfileById(media.CreatorId); - } - /// /// Gets the for the Creator of this media item. /// @@ -454,13 +419,6 @@ namespace Umbraco.Core.Models return packagingService.Export(media, true, raiseEvents: false); } - [Obsolete("Use the overload that declares the IPackagingService to use")] - public static XElement ToXml(this IContent content, bool isPreview) - { - //TODO Do a proper implementation of this - //If current IContent is published we should get latest unpublished version - return content.ToXml(); - } /// /// Creates the xml representation for the object @@ -476,11 +434,6 @@ namespace Umbraco.Core.Models return content.ToXml(packagingService); } - [Obsolete("Use the overload that declares the IPackagingService to use")] - public static XElement ToXml(this IMember member) - { - return ((PackagingService)(Current.Services.PackagingService)).Export(member); - } /// /// Creates the xml representation for the object diff --git a/src/Umbraco.Core/Models/ContentType.cs b/src/Umbraco.Core/Models/ContentType.cs index 4a39166dc8..196c68b23c 100644 --- a/src/Umbraco.Core/Models/ContentType.cs +++ b/src/Umbraco.Core/Models/ContentType.cs @@ -29,15 +29,6 @@ namespace Umbraco.Core.Models _allowedTemplates = new List(); } - /// - /// Constuctor for creating a ContentType with the parent as an inherited type. - /// - /// Use this to ensure inheritance from parent. - /// - [Obsolete("This method is obsolete, use ContentType(IContentType parent, string alias) instead.", false)] - public ContentType(IContentType parent) : this(parent, null) - { - } /// /// Constuctor for creating a ContentType with the parent as an inherited type. diff --git a/src/Umbraco.Core/Models/ContentTypeSort.cs b/src/Umbraco.Core/Models/ContentTypeSort.cs index 000d80777c..9afcfbab37 100644 --- a/src/Umbraco.Core/Models/ContentTypeSort.cs +++ b/src/Umbraco.Core/Models/ContentTypeSort.cs @@ -8,11 +8,6 @@ namespace Umbraco.Core.Models /// public class ContentTypeSort : IValueObject, IDeepCloneable { - [Obsolete("This parameterless constructor should never be used")] - public ContentTypeSort() - { - } - /// /// Initializes a new instance of the class. /// diff --git a/src/Umbraco.Core/Models/PartialView.cs b/src/Umbraco.Core/Models/PartialView.cs index 73ae8d83dd..a0b32baecf 100644 --- a/src/Umbraco.Core/Models/PartialView.cs +++ b/src/Umbraco.Core/Models/PartialView.cs @@ -10,11 +10,6 @@ namespace Umbraco.Core.Models [DataContract(IsReference = true)] public class PartialView : File, IPartialView { - [Obsolete("Use the ctor that explicitely sets the view type.")] - public PartialView(string path) - : this(PartialViewType.PartialView, path, null) - { } - public PartialView(PartialViewType viewType, string path) : this(viewType, path, null) { } diff --git a/src/Umbraco.Core/Security/EmailService.cs b/src/Umbraco.Core/Security/EmailService.cs index f6e32409cf..e6454544ab 100644 --- a/src/Umbraco.Core/Security/EmailService.cs +++ b/src/Umbraco.Core/Security/EmailService.cs @@ -21,12 +21,6 @@ namespace Umbraco.Core.Security _defaultEmailSender = defaultEmailSender; } - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use the constructor specifying all dependencies")] - public EmailService() - : this(UmbracoConfig.For.UmbracoSettings().Content.NotificationEmailAddress, new EmailSender()) - { - } public async Task SendAsync(IdentityMessage message) { diff --git a/src/Umbraco.Core/Services/Implement/UserService.cs b/src/Umbraco.Core/Services/Implement/UserService.cs index 96cac1d814..c791b56b56 100644 --- a/src/Umbraco.Core/Services/Implement/UserService.cs +++ b/src/Umbraco.Core/Services/Implement/UserService.cs @@ -227,8 +227,6 @@ namespace Umbraco.Core.Services.Implement Save(membershipUser); } - [Obsolete("ASP.NET Identity APIs like the BackOfficeUserManager should be used to manage passwords, this will not work with correct security practices because you would need the existing password")] - [EditorBrowsable(EditorBrowsableState.Never)] public void SavePassword(IUser user, string password) { if (user == null) throw new ArgumentNullException(nameof(user)); diff --git a/src/Umbraco.Core/StringExtensions.cs b/src/Umbraco.Core/StringExtensions.cs index a2f5727ae4..e4fce625dc 100644 --- a/src/Umbraco.Core/StringExtensions.cs +++ b/src/Umbraco.Core/StringExtensions.cs @@ -693,13 +693,6 @@ namespace Umbraco.Core return s.LastIndexOf(value, StringComparison.OrdinalIgnoreCase); } - [Obsolete("Use Guid.TryParse instead")] - [EditorBrowsable(EditorBrowsableState.Never)] - public static bool IsGuid(this string str, bool withHyphens) - { - Guid g; - return Guid.TryParse(str, out g); - } /// /// Tries to parse a string into the supplied type by finding and using the Type's "Parse" method