From 1ab324ebb9a3be9360654fcd0463378893a0abfc Mon Sep 17 00:00:00 2001 From: Anthony Date: Thu, 20 Sep 2018 13:14:16 +0100 Subject: [PATCH] umbPLfest hackathon - Remove obsolete methods --- src/Umbraco.Core/EnumerableExtensions.cs | 13 +------------ .../CoreThings/EnumerableExtensionsTests.cs | 18 +++++++++++++----- .../Cache/DistributedCacheExtensions.cs | 19 ------------------- src/Umbraco.Web/Editors/EntityController.cs | 8 +------- src/Umbraco.Web/Umbraco.Web.csproj | 1 - src/Umbraco.Web/_Legacy/Packager/Installer.cs | 8 +------- 6 files changed, 16 insertions(+), 51 deletions(-) diff --git a/src/Umbraco.Core/EnumerableExtensions.cs b/src/Umbraco.Core/EnumerableExtensions.cs index 0d199d1d0d..c455fadad7 100644 --- a/src/Umbraco.Core/EnumerableExtensions.cs +++ b/src/Umbraco.Core/EnumerableExtensions.cs @@ -92,18 +92,7 @@ namespace Umbraco.Core } } - /// The flatten list. - /// The items. - /// The select child. - /// Item type - /// list of TItem - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Do not use, use SelectRecursive instead which has far less potential of re-iterating an iterator which may cause significantly more SQL queries")] - public static IEnumerable FlattenList(this IEnumerable e, Func> f) - { - return e.SelectMany(c => f(c).FlattenList(f)).Concat(e); - } - + /// /// Returns true if all items in the other collection exist in this collection /// diff --git a/src/Umbraco.Tests/CoreThings/EnumerableExtensionsTests.cs b/src/Umbraco.Tests/CoreThings/EnumerableExtensionsTests.cs index 7d7dcaea71..01b3adb383 100644 --- a/src/Umbraco.Tests/CoreThings/EnumerableExtensionsTests.cs +++ b/src/Umbraco.Tests/CoreThings/EnumerableExtensionsTests.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using NUnit.Framework; using Umbraco.Core; @@ -38,7 +39,7 @@ namespace Umbraco.Tests.CoreThings } [Test] - public void Flatten_List_2() + public void SelectRecursive_2() { var hierarchy = new TestItem("1") { @@ -51,7 +52,7 @@ namespace Umbraco.Tests.CoreThings }; #pragma warning disable CS0618 // Type or member is obsolete - var flattened = hierarchy.Children.FlattenList(x => x.Children); + var flattened = FlattenList(hierarchy.Children, x => x.Children); #pragma warning restore CS0618 // Type or member is obsolete var selectRecursive = hierarchy.Children.SelectRecursive(x => x.Children); @@ -62,7 +63,7 @@ namespace Umbraco.Tests.CoreThings } [Test] - public void Flatten_List() + public void SelectRecursive() { var hierarchy = new TestItem("1") { @@ -118,7 +119,7 @@ namespace Umbraco.Tests.CoreThings }; #pragma warning disable CS0618 // Type or member is obsolete - var flattened = hierarchy.Children.FlattenList(x => x.Children); + var flattened = FlattenList(hierarchy.Children, x => x.Children); #pragma warning restore CS0618 // Type or member is obsolete var selectRecursive = hierarchy.Children.SelectRecursive(x => x.Children); @@ -141,6 +142,13 @@ namespace Umbraco.Tests.CoreThings public IEnumerable Children { get; set; } } + + + private IEnumerable FlattenList(IEnumerable e, Func> f) + { + return e.SelectMany(c => FlattenList(f(c), f)).Concat(e); + } + [Test] public void InGroupsOf_ReturnsAllElements() { diff --git a/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs b/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs index 0696595ef4..68ac339a46 100644 --- a/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs +++ b/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs @@ -74,25 +74,6 @@ namespace Umbraco.Web.Cache #endregion - #region User group permissions cache - - public static void RemoveUserGroupPermissionsCache(this DistributedCache dc, int groupId) - { - dc.Remove(UserGroupPermissionsCacheRefresher.UniqueId, groupId); - } - - public static void RefreshUserGroupPermissionsCache(this DistributedCache dc, int groupId) - { - //TODO: Not sure if we need this yet depends if we start caching permissions - //dc.Refresh(UserGroupPermissionsCacheRefresher.UniqueId, groupId); - } - - public static void RefreshAllUserGroupPermissionsCache(this DistributedCache dc) - { - dc.RefreshAll(UserGroupPermissionsCacheRefresher.UniqueId); - } - - #endregion #region TemplateCache diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs index 313693c08c..b273d94691 100644 --- a/src/Umbraco.Web/Editors/EntityController.cs +++ b/src/Umbraco.Web/Editors/EntityController.cs @@ -226,13 +226,7 @@ namespace Umbraco.Web.Editors }; } - [Obsolete("Use GetyById instead")] - [EditorBrowsable(EditorBrowsableState.Never)] - public EntityBasic GetByKey(Guid id, UmbracoEntityTypes type) - { - return GetResultForKey(id, type); - } - + /// /// Gets an entity by a xpath query /// diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 0a7eecb4c8..888c9c8fd4 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -109,7 +109,6 @@ - diff --git a/src/Umbraco.Web/_Legacy/Packager/Installer.cs b/src/Umbraco.Web/_Legacy/Packager/Installer.cs index 952f1987a4..3613fc7f87 100644 --- a/src/Umbraco.Web/_Legacy/Packager/Installer.cs +++ b/src/Umbraco.Web/_Legacy/Packager/Installer.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Globalization; using System.IO; using System.Xml; @@ -14,7 +13,6 @@ using Umbraco.Core.Models; using Umbraco.Core.Composing; using Umbraco.Core.Events; using Umbraco.Core.Models.Packaging; -using Umbraco.Core.Services; using Umbraco.Core.Services.Implement; using Umbraco.Core.Xml; using File = System.IO.File; @@ -115,11 +113,7 @@ namespace umbraco.cms.businesslogic.packager ContainsStyleSheeConflicts = false; } - [Obsolete("Use the ctor with all parameters")] - [EditorBrowsable(EditorBrowsableState.Never)] - public Installer(string name, string version, string url, string license, string licenseUrl, string author, string authorUrl, int requirementsMajor, int requirementsMinor, int requirementsPatch, string readme, string control) - { - } + /// /// Constructor