umbPLfest hackathon - Removed obsolete methods and properties.

This commit is contained in:
Anthony
2018-09-20 13:56:02 +01:00
parent 8649062500
commit 8cd0bc5f50
6 changed files with 4 additions and 120 deletions

View File

@@ -23,9 +23,6 @@ namespace Umbraco.Core
{
public const string MemberUsernameRuleType = "MemberUsername";
public const string MemberRoleRuleType = "MemberRole";
[Obsolete("No longer supported, this is here for backwards compatibility only")]
public const string MemberIdRuleType = "MemberId";
}

View File

@@ -71,9 +71,6 @@ namespace Umbraco.Core
[Obsolete("This no longer exists in the database")]
internal const string Stylesheet = "9F68DA4F-A3A8-44C2-8226-DCBD125E4840";
[Obsolete("This no longer exists in the database")]
internal const string StylesheetProperty = "5555da4f-a123-42b2-4488-dcdfb25e4111";
// ReSharper restore MemberHidesStaticFromOuterClass
}

View File

@@ -18,25 +18,6 @@ namespace Umbraco.Core.Persistence.Repositories
IEnumerable<ITemplate> GetDescendants(int masterTemplateId);
IEnumerable<ITemplate> GetDescendants(string alias);
/// <summary>
/// Returns a template as a template node which can be traversed (parent, children)
/// </summary>
/// <param name="alias"></param>
/// <returns></returns>
[Obsolete("Use GetDescendants instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
TemplateNode GetTemplateNode(string alias);
/// <summary>
/// Given a template node in a tree, this will find the template node with the given alias if it is found in the hierarchy, otherwise null
/// </summary>
/// <param name="anyNode"></param>
/// <param name="alias"></param>
/// <returns></returns>
[Obsolete("Use GetDescendants instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
TemplateNode FindTemplateInTree(TemplateNode anyNode, string alias);
/// <summary>
/// This checks what the default rendering engine is set in config but then also ensures that there isn't already
/// a template that exists in the opposite rendering engine's template folder, then returns the appropriate

View File

@@ -632,72 +632,6 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
}
}
/// <summary>
/// Returns a template as a template node which can be traversed (parent, children)
/// </summary>
/// <param name="alias"></param>
/// <returns></returns>
[Obsolete("Use GetDescendants instead")]
public TemplateNode GetTemplateNode(string alias)
{
//first get all template objects
var allTemplates = base.GetMany().ToArray();
var selfTemplate = allTemplates.SingleOrDefault(x => x.Alias.InvariantEquals(alias));
if (selfTemplate == null)
{
return null;
}
var top = selfTemplate;
while (top.MasterTemplateAlias.IsNullOrWhiteSpace() == false)
{
top = allTemplates.Single(x => x.Alias.InvariantEquals(top.MasterTemplateAlias));
}
var topNode = new TemplateNode(allTemplates.Single(x => x.Id == top.Id));
var childTemplates = allTemplates.Where(x => x.MasterTemplateAlias.InvariantEquals(top.Alias));
//This now creates the hierarchy recursively
topNode.Children = CreateChildren(topNode, childTemplates, allTemplates);
//now we'll return the TemplateNode requested
return FindTemplateInTree(topNode, alias);
}
[Obsolete("Only used by obsolete code")]
private static TemplateNode WalkTree(TemplateNode current, string alias)
{
//now walk the tree to find the node
if (current.Template.Alias.InvariantEquals(alias))
{
return current;
}
foreach (var c in current.Children)
{
var found = WalkTree(c, alias);
if (found != null) return found;
}
return null;
}
/// <summary>
/// Given a template node in a tree, this will find the template node with the given alias if it is found in the hierarchy, otherwise null
/// </summary>
/// <param name="anyNode"></param>
/// <param name="alias"></param>
/// <returns></returns>
[Obsolete("Use GetDescendants instead")]
public TemplateNode FindTemplateInTree(TemplateNode anyNode, string alias)
{
//first get the root
var top = anyNode;
while (top.Parent != null)
{
top = top.Parent;
}
return WalkTree(top, alias);
}
/// <summary>
/// This checks what the default rendering engine is set in config but then also ensures that there isn't already
/// a template that exists in the opposite rendering engine's template folder, then returns the appropriate

View File

@@ -478,33 +478,6 @@ namespace Umbraco.Tests.Persistence.Repositories
}
}
[Test]
public void Can_Get_Template_Tree()
{
// Arrange
var provider = TestObjects.GetScopeProvider(Logger);
using (var scope = ScopeProvider.CreateScope())
{
var repository = CreateRepository(provider);
CreateHierarchy(repository);
// Act
var rootNode = repository.GetTemplateNode("parent");
// Assert
Assert.IsNotNull(repository.FindTemplateInTree(rootNode, "parent"));
Assert.IsNotNull(repository.FindTemplateInTree(rootNode, "child1"));
Assert.IsNotNull(repository.FindTemplateInTree(rootNode, "child2"));
Assert.IsNotNull(repository.FindTemplateInTree(rootNode, "toddler1"));
Assert.IsNotNull(repository.FindTemplateInTree(rootNode, "toddler2"));
Assert.IsNotNull(repository.FindTemplateInTree(rootNode, "toddler3"));
Assert.IsNotNull(repository.FindTemplateInTree(rootNode, "toddler4"));
Assert.IsNotNull(repository.FindTemplateInTree(rootNode, "baby1"));
Assert.IsNotNull(repository.FindTemplateInTree(rootNode, "baby2"));
}
}
[Test]
public void Can_Get_All()
{

View File

@@ -25,7 +25,6 @@ namespace umbraco.presentation.umbraco.dialogs
public protectPage()
{
CurrentApp = Constants.Applications.Content.ToString();
}
protected Literal jsShowWindow;
@@ -33,6 +32,9 @@ namespace umbraco.presentation.umbraco.dialogs
protected ContentPicker loginPagePicker = new ContentPicker();
protected ContentPicker errorPagePicker = new ContentPicker();
const string MemberIdRuleType = "MemberId"; // moved from Constants-Conventions.cs
override protected void OnInit(EventArgs e)
{
base.OnInit(e);
@@ -66,7 +68,7 @@ namespace umbraco.presentation.umbraco.dialogs
if (entry == null) return ProtectionType.NotProtected;
//legacy states that if it is protected by a member id then it is 'simple'
return entry.Rules.Any(x => x.RuleType == Constants.Conventions.PublicAccess.MemberIdRuleType)
return entry.Rules.Any(x => x.RuleType == MemberIdRuleType)
? ProtectionType.Simple
: ProtectionType.Advanced;
}