Merge pull request #2744 from ed-parry/hackathon-remove-obsolete-methods

V8 Hackathon: remove obsolete methods
This commit is contained in:
Sebastiaan Janssen
2018-06-29 14:51:18 +02:00
committed by GitHub
5 changed files with 0 additions and 100 deletions

View File

@@ -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);
}
/// <summary>
/// Gets the current profiler.
/// </summary>

View File

@@ -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);
}
/// <summary>
/// Returns permissions for all nodes passed in for the current user
/// TODO: This should be moved to the CurrentUserController?

View File

@@ -391,17 +391,6 @@ namespace Umbraco.Web.Editors
}
#endregion
[Obsolete("Use GetyByIds instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public IEnumerable<EntityBasic> GetByKeys([FromUri]Guid[] ids, UmbracoEntityTypes type)
{
if (ids == null)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
return GetResultForKeys(ids, type);
}
public IEnumerable<EntityBasic> GetChildren(int id, UmbracoEntityTypes type)
{
return GetResultForChildren(id, type);

View File

@@ -175,20 +175,6 @@ namespace Umbraco.Web.Editors
return foundMedia.Select(media => ContextMapper.Map<IMedia, MediaItemDisplay>(media, UmbracoContext));
}
/// <summary>
/// Returns media items known to be of a "Folder" type
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[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<ContentItemBasic<ContentPropertyBasic, IMedia>>))]
public IEnumerable<ContentItemBasic<ContentPropertyBasic, IMedia>> 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;
}
/// <summary>
/// Returns a paged result of media items known to be of a "Folder" type
/// </summary>

View File

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