From 5d3309dbf1b5c27a89538cbe546f8a2fe2fa36fc Mon Sep 17 00:00:00 2001 From: Ed Parry Date: Fri, 29 Jun 2018 12:31:28 +0100 Subject: [PATCH 1/2] Removed obsolete method from WebProfileProvider --- src/Umbraco.Core/Logging/WebProfilerProvider.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/Umbraco.Core/Logging/WebProfilerProvider.cs b/src/Umbraco.Core/Logging/WebProfilerProvider.cs index 35ecd002c8..75fa55ea3c 100644 --- a/src/Umbraco.Core/Logging/WebProfilerProvider.cs +++ b/src/Umbraco.Core/Logging/WebProfilerProvider.cs @@ -91,13 +91,6 @@ namespace Umbraco.Core.Logging return _startupProfiler; } - // obsolete but that's the one that's called ;-( - [Obsolete] - public override MiniProfiler Start(ProfileLevel level, string sessionName = null) - { - return Start(sessionName); - } - /// /// Gets the current profiler. /// From 7f7cceb90f678e3e64983fc83568e054bf03cd25 Mon Sep 17 00:00:00 2001 From: Ed Parry Date: Fri, 29 Jun 2018 13:12:08 +0100 Subject: [PATCH 2/2] Removed obsolete methods in editors and the grid template. --- src/Umbraco.Web/Editors/ContentController.cs | 6 -- src/Umbraco.Web/Editors/EntityController.cs | 11 ---- src/Umbraco.Web/Editors/MediaController.cs | 14 ----- src/Umbraco.Web/GridTemplateExtensions.cs | 62 -------------------- 4 files changed, 93 deletions(-) diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index a3949fcf70..ecac4a64d7 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -459,12 +459,6 @@ namespace Umbraco.Web.Editors return pagedResult; } - [Obsolete("Dont use this, it is incorrectly named, use HasPermission instead")] - public bool GetHasPermission(string permissionToCheck, int nodeId) - { - return HasPermission(permissionToCheck, nodeId); - } - /// /// Returns permissions for all nodes passed in for the current user /// TODO: This should be moved to the CurrentUserController? diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs index 53689c9052..d19237fb2a 100644 --- a/src/Umbraco.Web/Editors/EntityController.cs +++ b/src/Umbraco.Web/Editors/EntityController.cs @@ -391,17 +391,6 @@ namespace Umbraco.Web.Editors } #endregion - [Obsolete("Use GetyByIds instead")] - [EditorBrowsable(EditorBrowsableState.Never)] - public IEnumerable GetByKeys([FromUri]Guid[] ids, UmbracoEntityTypes type) - { - if (ids == null) - { - throw new HttpResponseException(HttpStatusCode.NotFound); - } - return GetResultForKeys(ids, type); - } - public IEnumerable GetChildren(int id, UmbracoEntityTypes type) { return GetResultForChildren(id, type); diff --git a/src/Umbraco.Web/Editors/MediaController.cs b/src/Umbraco.Web/Editors/MediaController.cs index 5458070260..bdeaf06805 100644 --- a/src/Umbraco.Web/Editors/MediaController.cs +++ b/src/Umbraco.Web/Editors/MediaController.cs @@ -175,20 +175,6 @@ namespace Umbraco.Web.Editors return foundMedia.Select(media => ContextMapper.Map(media, UmbracoContext)); } - /// - /// Returns media items known to be of a "Folder" type - /// - /// - /// - [Obsolete("This is no longer used and shouldn't be because it performs poorly when there are a lot of media items")] - [FilterAllowedOutgoingMedia(typeof(IEnumerable>))] - public IEnumerable> GetChildFolders(int id = -1) - { - //we are only allowing a max of 500 to be returned here, if more is required it needs to be paged - var result = GetChildFolders(id, 1, 500); - return result.Items; - } - /// /// Returns a paged result of media items known to be of a "Folder" type /// diff --git a/src/Umbraco.Web/GridTemplateExtensions.cs b/src/Umbraco.Web/GridTemplateExtensions.cs index 174ac3fc1f..2c6e66c68b 100644 --- a/src/Umbraco.Web/GridTemplateExtensions.cs +++ b/src/Umbraco.Web/GridTemplateExtensions.cs @@ -1,18 +1,9 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Web.Mvc.Html; -using Umbraco.Core; -using Umbraco.Core.Models; using System.Web.Mvc; -using Umbraco.Web.Templates; using System.IO; -using System.Web.Routing; using Umbraco.Core.Exceptions; using Umbraco.Core.Models.PublishedContent; -using Umbraco.Web.Mvc; namespace Umbraco.Web { @@ -88,59 +79,6 @@ namespace Umbraco.Web return html.Partial(view, model); } - - [Obsolete("This should not be used, GetGridHtml methods accepting HtmlHelper as a parameter or GetGridHtml extensions on HtmlHelper should be used instead")] - public static MvcHtmlString GetGridHtml(this IPublishedProperty property, string framework = "bootstrap3") - { - var asString = property.GetValue() as string; - if (asString != null && string.IsNullOrEmpty(asString)) return new MvcHtmlString(string.Empty); - - var htmlHelper = CreateHtmlHelper(property.GetValue()); - return htmlHelper.GetGridHtml(property, framework); - } - - [Obsolete("This should not be used, GetGridHtml methods accepting HtmlHelper as a parameter or GetGridHtml extensions on HtmlHelper should be used instead")] - public static MvcHtmlString GetGridHtml(this IPublishedContent contentItem) - { - return GetGridHtml(contentItem, "bodyText", "bootstrap3"); - } - - [Obsolete("This should not be used, GetGridHtml methods accepting HtmlHelper as a parameter or GetGridHtml extensions on HtmlHelper should be used instead")] - public static MvcHtmlString GetGridHtml(this IPublishedContent contentItem, string propertyAlias) - { - if (string.IsNullOrWhiteSpace(propertyAlias)) throw new ArgumentNullOrEmptyException(nameof(propertyAlias)); - - return GetGridHtml(contentItem, propertyAlias, "bootstrap3"); - } - - [Obsolete("This should not be used, GetGridHtml methods accepting HtmlHelper as a parameter or GetGridHtml extensions on HtmlHelper should be used instead")] - public static MvcHtmlString GetGridHtml(this IPublishedContent contentItem, string propertyAlias, string framework) - { - if (string.IsNullOrWhiteSpace(propertyAlias)) throw new ArgumentNullOrEmptyException(nameof(propertyAlias)); - - var prop = contentItem.GetProperty(propertyAlias); - if (prop == null) throw new NullReferenceException("No property type found with alias " + propertyAlias); - var model = prop.GetValue(); - - var asString = model as string; - if (asString != null && string.IsNullOrEmpty(asString)) return new MvcHtmlString(string.Empty); - - var htmlHelper = CreateHtmlHelper(model); - return htmlHelper.GetGridHtml(contentItem, propertyAlias, framework); - } - - [Obsolete("This shouldn't need to be used but because the obsolete extension methods above don't have access to the current HtmlHelper, we need to create a fake one, unfortunately however this will not pertain the current views viewdata, tempdata or model state so should not be used")] - private static HtmlHelper CreateHtmlHelper(object model) - { - var cc = new ControllerContext - { - RequestContext = UmbracoContext.Current.HttpContext.Request.RequestContext - }; - var viewContext = new ViewContext(cc, new FakeView(), new ViewDataDictionary(model), new TempDataDictionary(), new StringWriter()); - var htmlHelper = new HtmlHelper(viewContext, new ViewPage()); - return htmlHelper; - } - private class FakeView : IView { public void Render(ViewContext viewContext, TextWriter writer)