Merge branch 'temp8' into temp8-member-search-and-tags
# Conflicts: # src/Umbraco.Web/Editors/MemberController.cs
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
{
|
||||
public const string ApplicationsCacheKey = "ApplicationCache"; // used by SectionService
|
||||
|
||||
// TODO this one can probably be removed
|
||||
// TODO: this one can probably be removed
|
||||
public const string TemplateFrontEndCacheKey = "template";
|
||||
|
||||
public const string MacroContentCacheKey = "macroContent_"; // used in MacroRenderers
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Umbraco.Core.Cache
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>Will use HttpContext.Current.</para>
|
||||
/// fixme/task: use IHttpContextAccessor NOT HttpContext.Current
|
||||
/// TODO: https://github.com/umbraco/Umbraco-CMS/issues/4239 - use IHttpContextAccessor NOT HttpContext.Current
|
||||
/// </remarks>
|
||||
public HttpRequestAppCache()
|
||||
{ }
|
||||
|
||||
@@ -9,7 +9,8 @@ using Umbraco.Core.Persistence.Mappers;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Core.Sync;
|
||||
using Umbraco.Core._Legacy.PackageActions;
|
||||
using Umbraco.Core.Logging.Viewer;
|
||||
using Umbraco.Core.PackageActions;
|
||||
|
||||
namespace Umbraco.Core.Components
|
||||
{
|
||||
@@ -297,6 +298,37 @@ namespace Umbraco.Core.Components
|
||||
public static void SetMediaFileSystem(this Composition composition, Func<IFileSystem> filesystemFactory)
|
||||
=> composition.RegisterUniqueFor<IFileSystem, IMediaFileSystem>(_ => filesystemFactory());
|
||||
|
||||
/// <summary>
|
||||
/// Sets the log viewer.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the log viewer.</typeparam>
|
||||
/// <param name="composition">The composition.</param>
|
||||
public static void SetLogViewer<T>(this Composition composition)
|
||||
where T : ILogViewer
|
||||
{
|
||||
composition.RegisterUnique<ILogViewer, T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the log viewer.
|
||||
/// </summary>
|
||||
/// <param name="composition">The composition.</param>
|
||||
/// <param name="factory">A function creating a log viewer.</param>
|
||||
public static void SetLogViewer(this Composition composition, Func<IFactory, ILogViewer> factory)
|
||||
{
|
||||
composition.RegisterUnique(factory);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the log viewer.
|
||||
/// </summary>
|
||||
/// <param name="composition">A composition.</param>
|
||||
/// <param name="helper">A log viewer.</param>
|
||||
public static void SetLogViewer(this Composition composition, ILogViewer viewer)
|
||||
{
|
||||
composition.RegisterUnique(_ => viewer);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ using Umbraco.Core.Services.Implement;
|
||||
|
||||
namespace Umbraco.Core.Components
|
||||
{
|
||||
//TODO: This should just exist in the content service/repo!
|
||||
// TODO: This should just exist in the content service/repo!
|
||||
public sealed class RelateOnCopyComponent : IComponent
|
||||
{
|
||||
public void Initialize()
|
||||
|
||||
@@ -5,6 +5,7 @@ using Umbraco.Core.Dictionary;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.PackageActions;
|
||||
using Umbraco.Core.Packaging;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
@@ -12,7 +13,6 @@ using Umbraco.Core.Scoping;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Core.Sync;
|
||||
using Umbraco.Core._Legacy.PackageActions;
|
||||
|
||||
namespace Umbraco.Core.Composing
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
/// <summary>
|
||||
/// One unique instance per request.
|
||||
/// </summary>
|
||||
// TODO - review lifetimes for LightInject vs other containers
|
||||
// TODO: review lifetimes for LightInject vs other containers
|
||||
// currently, corresponds to 'Request' in LightInject which is 'Transient + disposed by Scope'
|
||||
// but NOT (in LightInject) a per-web-request lifetime, more a TransientScoped
|
||||
//
|
||||
|
||||
@@ -614,7 +614,7 @@ namespace Umbraco.Core.Composing
|
||||
var type = BuildManager.GetType(typeName, false);
|
||||
if (type != null) return type;
|
||||
|
||||
//TODO: This isn't very elegant, and will have issues since the AppDomain.CurrentDomain
|
||||
// TODO: This isn't very elegant, and will have issues since the AppDomain.CurrentDomain
|
||||
// doesn't actualy load in all assemblies, only the types that have been referenced so far.
|
||||
// However, in a web context, the BuildManager will have executed which will force all assemblies
|
||||
// to be loaded so it's fine for now.
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace Umbraco.Core.Composing
|
||||
|
||||
#region Match Type
|
||||
|
||||
//TODO: Need to determine if these methods should replace/combine/merge etc with IsTypeAssignableFrom, IsAssignableFromGeneric
|
||||
// TODO: Need to determine if these methods should replace/combine/merge etc with IsTypeAssignableFrom, IsAssignableFromGeneric
|
||||
|
||||
// readings:
|
||||
// http://stackoverflow.com/questions/2033912/c-sharp-variance-problem-assigning-listderived-as-listbase
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.PackageActions;
|
||||
using Umbraco.Core.Persistence.Mappers;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core._Legacy.PackageActions;
|
||||
|
||||
namespace Umbraco.Core.Composing
|
||||
{
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Umbraco.Core.Composing
|
||||
return list;
|
||||
}
|
||||
|
||||
protected virtual int DefaultWeight { get; set; } = 10;
|
||||
public virtual int DefaultWeight { get; set; } = 100;
|
||||
|
||||
protected virtual int GetWeight(Type type)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Dashboard;
|
||||
using Umbraco.Core.Configuration.Grid;
|
||||
using Umbraco.Core.Configuration.HealthChecks;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
@@ -22,9 +21,6 @@ namespace Umbraco.Core
|
||||
public static IUmbracoSettingsSection Settings(this Configs configs)
|
||||
=> configs.GetConfig<IUmbracoSettingsSection>();
|
||||
|
||||
public static IDashboardSection Dashboards(this Configs configs)
|
||||
=> configs.GetConfig<IDashboardSection>();
|
||||
|
||||
public static IHealthChecks HealthChecks(this Configs configs)
|
||||
=> configs.GetConfig<IHealthChecks>();
|
||||
|
||||
@@ -40,7 +36,6 @@ namespace Umbraco.Core
|
||||
|
||||
configs.Add<IGlobalSettings>(() => new GlobalSettings());
|
||||
configs.Add<IUmbracoSettingsSection>("umbracoConfiguration/settings");
|
||||
configs.Add<IDashboardSection>("umbracoConfiguration/dashBoard");
|
||||
configs.Add<IHealthChecks>("umbracoConfiguration/HealthChecks");
|
||||
|
||||
configs.Add(() => new CoreDebug());
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
internal class AccessElement : RawXmlConfigurationElement, IAccess
|
||||
{
|
||||
public AccessElement()
|
||||
{ }
|
||||
|
||||
public AccessElement(XElement rawXml)
|
||||
: base(rawXml)
|
||||
{ }
|
||||
|
||||
public IEnumerable<IAccessRule> Rules
|
||||
{
|
||||
get
|
||||
{
|
||||
var result = new List<AccessRule>();
|
||||
if (RawXml == null) return result;
|
||||
|
||||
result.AddRange(RawXml.Elements("deny").Select(x => new AccessRule {Type = AccessRuleType.Deny, Value = x.Value }));
|
||||
result.AddRange(RawXml.Elements("grant").Select(x => new AccessRule { Type = AccessRuleType.Grant, Value = x.Value }));
|
||||
result.AddRange(RawXml.Elements("grantBySection").Select(x => new AccessRule { Type = AccessRuleType.GrantBySection, Value = x.Value }));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
internal class AreaCollection : ConfigurationElementCollection, IEnumerable<IArea>
|
||||
{
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new AreaElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((AreaElement) element).Value;
|
||||
}
|
||||
|
||||
IEnumerator<IArea> IEnumerable<IArea>.GetEnumerator()
|
||||
{
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
yield return BaseGet(i) as IArea;
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
internal class AreaElement : InnerTextConfigurationElement<string>, IArea
|
||||
{
|
||||
string IArea.AreaName
|
||||
{
|
||||
get { return Value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
internal class AreasElement : ConfigurationElement
|
||||
{
|
||||
[ConfigurationCollection(typeof(SectionCollection), AddItemName = "area")]
|
||||
[ConfigurationProperty("", IsDefaultCollection = true)]
|
||||
public AreaCollection AreaCollection
|
||||
{
|
||||
get { return (AreaCollection)base[""]; }
|
||||
set { base[""] = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
internal class ControlCollection : ConfigurationElementCollection, IEnumerable<IDashboardControl>
|
||||
{
|
||||
internal void Add(ControlElement c)
|
||||
{
|
||||
BaseAdd(c);
|
||||
}
|
||||
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new ControlElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((ControlElement)element).ControlPath;
|
||||
}
|
||||
|
||||
IEnumerator<IDashboardControl> IEnumerable<IDashboardControl>.GetEnumerator()
|
||||
{
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
yield return BaseGet(i) as IDashboardControl;
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
|
||||
internal class ControlElement : RawXmlConfigurationElement, IDashboardControl
|
||||
{
|
||||
public string PanelCaption
|
||||
{
|
||||
get
|
||||
{
|
||||
var panelCaption = RawXml.Attribute("panelCaption");
|
||||
return panelCaption == null ? "" : panelCaption.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public AccessElement Access
|
||||
{
|
||||
get
|
||||
{
|
||||
var access = RawXml.Element("access");
|
||||
return access == null ? new AccessElement() : new AccessElement(access);
|
||||
}
|
||||
}
|
||||
|
||||
public string ControlPath
|
||||
{
|
||||
get
|
||||
{
|
||||
//we need to return the first (and only) text element of the children (wtf... who designed this configuration ! :P )
|
||||
var txt = RawXml.Nodes().OfType<XText>().FirstOrDefault();
|
||||
if (txt == null)
|
||||
{
|
||||
throw new ConfigurationErrorsException("The control element must contain a text node indicating the control path");
|
||||
}
|
||||
return txt.Value.Trim();
|
||||
}
|
||||
}
|
||||
|
||||
IAccess IDashboardControl.AccessRights => Access;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
internal class DashboardSection : ConfigurationSection, IDashboardSection
|
||||
{
|
||||
[ConfigurationCollection(typeof(SectionCollection), AddItemName = "section")]
|
||||
[ConfigurationProperty("", IsDefaultCollection = true)]
|
||||
public SectionCollection SectionCollection
|
||||
{
|
||||
get { return (SectionCollection)base[""]; }
|
||||
set { base[""] = value; }
|
||||
}
|
||||
|
||||
IEnumerable<ISection> IDashboardSection.Sections
|
||||
{
|
||||
get { return SectionCollection; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
public interface IAccess
|
||||
{
|
||||
IEnumerable<IAccessRule> Rules { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
public interface IArea
|
||||
{
|
||||
string AreaName { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
public interface IDashboardControl
|
||||
{
|
||||
string PanelCaption { get; }
|
||||
|
||||
string ControlPath { get; }
|
||||
|
||||
IAccess AccessRights { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
public interface IDashboardSection
|
||||
{
|
||||
IEnumerable<ISection> Sections { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
public interface IDashboardTab
|
||||
{
|
||||
string Caption { get; }
|
||||
|
||||
IEnumerable<IDashboardControl> Controls { get; }
|
||||
|
||||
IAccess AccessRights { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
public interface ISection
|
||||
{
|
||||
string Alias { get; }
|
||||
|
||||
IEnumerable<string> Areas { get; }
|
||||
|
||||
IEnumerable<IDashboardTab> Tabs { get; }
|
||||
|
||||
IAccess AccessRights { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
internal class SectionCollection : ConfigurationElementCollection, IEnumerable<ISection>
|
||||
{
|
||||
internal void Add(SectionElement c)
|
||||
{
|
||||
BaseAdd(c);
|
||||
}
|
||||
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new SectionElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((SectionElement)element).Alias;
|
||||
}
|
||||
|
||||
IEnumerator<ISection> IEnumerable<ISection>.GetEnumerator()
|
||||
{
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
yield return BaseGet(i) as ISection;
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
internal class SectionElement : ConfigurationElement, ISection
|
||||
{
|
||||
[ConfigurationProperty("alias", IsRequired = true)]
|
||||
public string Alias
|
||||
{
|
||||
get { return (string) this["alias"]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("areas", IsRequired = true)]
|
||||
public AreasElement Areas
|
||||
{
|
||||
get { return (AreasElement)this["areas"]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("access")]
|
||||
public AccessElement Access
|
||||
{
|
||||
get { return (AccessElement)this["access"]; }
|
||||
}
|
||||
|
||||
[ConfigurationCollection(typeof(SectionCollection), AddItemName = "tab")]
|
||||
[ConfigurationProperty("", IsDefaultCollection = true)]
|
||||
public TabCollection TabCollection
|
||||
{
|
||||
get { return (TabCollection)base[""]; }
|
||||
set { base[""] = value; }
|
||||
}
|
||||
|
||||
IEnumerable<IDashboardTab> ISection.Tabs
|
||||
{
|
||||
get { return TabCollection; }
|
||||
}
|
||||
|
||||
IEnumerable<string> ISection.Areas
|
||||
{
|
||||
get { return Areas.AreaCollection.Cast<AreaElement>().Select(x => x.Value); }
|
||||
}
|
||||
|
||||
IAccess ISection.AccessRights
|
||||
{
|
||||
get { return Access; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
internal class TabCollection : ConfigurationElementCollection, IEnumerable<IDashboardTab>
|
||||
{
|
||||
internal void Add(TabElement c)
|
||||
{
|
||||
BaseAdd(c);
|
||||
}
|
||||
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new TabElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((TabElement)element).Caption;
|
||||
}
|
||||
|
||||
IEnumerator<IDashboardTab> IEnumerable<IDashboardTab>.GetEnumerator()
|
||||
{
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
yield return BaseGet(i) as IDashboardTab;
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
internal class TabElement : ConfigurationElement, IDashboardTab
|
||||
{
|
||||
[ConfigurationProperty("caption", IsRequired = true)]
|
||||
public string Caption
|
||||
{
|
||||
get { return (string)this["caption"]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("access")]
|
||||
public AccessElement Access
|
||||
{
|
||||
get { return (AccessElement)this["access"]; }
|
||||
}
|
||||
|
||||
[ConfigurationCollection(typeof(ControlCollection), AddItemName = "control")]
|
||||
[ConfigurationProperty("", IsDefaultCollection = true)]
|
||||
public ControlCollection ControlCollection
|
||||
{
|
||||
get { return (ControlCollection)base[""]; }
|
||||
set { base[""] = value; }
|
||||
}
|
||||
|
||||
IEnumerable<IDashboardControl> IDashboardTab.Controls
|
||||
{
|
||||
get { return ControlCollection; }
|
||||
}
|
||||
|
||||
IAccess IDashboardTab.AccessRights
|
||||
{
|
||||
get { return Access; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Umbraco.Core.Configuration
|
||||
{
|
||||
public class FileSystemProviderElement : ConfigurationElement, IFileSystemProviderElement
|
||||
{
|
||||
private const string ALIAS_KEY = "alias";
|
||||
private const string TYPE_KEY = "type";
|
||||
private const string PARAMETERS_KEY = "Parameters";
|
||||
|
||||
[ConfigurationProperty(ALIAS_KEY, IsKey = true, IsRequired = true)]
|
||||
public string Alias
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((string)(base[ALIAS_KEY]));
|
||||
}
|
||||
}
|
||||
|
||||
[ConfigurationProperty(TYPE_KEY, IsKey = false, IsRequired = true)]
|
||||
public string Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((string)(base[TYPE_KEY]));
|
||||
}
|
||||
}
|
||||
|
||||
[ConfigurationProperty(PARAMETERS_KEY, IsDefaultCollection = true, IsRequired = false)]
|
||||
public KeyValueConfigurationCollection Parameters
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((KeyValueConfigurationCollection)(base[PARAMETERS_KEY]));
|
||||
}
|
||||
}
|
||||
|
||||
string IFileSystemProviderElement.Alias
|
||||
{
|
||||
get { return Alias; }
|
||||
}
|
||||
|
||||
string IFileSystemProviderElement.Type
|
||||
{
|
||||
get { return Type; }
|
||||
}
|
||||
|
||||
private IDictionary<string, string> _params;
|
||||
IDictionary<string, string> IFileSystemProviderElement.Parameters
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_params != null) return _params;
|
||||
_params = new Dictionary<string, string>();
|
||||
foreach (KeyValueConfigurationElement element in Parameters)
|
||||
{
|
||||
_params.Add(element.Key, element.Value);
|
||||
}
|
||||
return _params;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Umbraco.Core.Configuration
|
||||
{
|
||||
[ConfigurationCollection(typeof(FileSystemProviderElement), AddItemName = "Provider")]
|
||||
public class FileSystemProviderElementCollection : ConfigurationElementCollection, IEnumerable<IFileSystemProviderElement>
|
||||
{
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new FileSystemProviderElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((FileSystemProviderElement)(element)).Alias;
|
||||
}
|
||||
|
||||
public new FileSystemProviderElement this[string key]
|
||||
{
|
||||
get
|
||||
{
|
||||
return (FileSystemProviderElement)BaseGet(key);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator<IFileSystemProviderElement> IEnumerable<IFileSystemProviderElement>.GetEnumerator()
|
||||
{
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
yield return BaseGet(i) as IFileSystemProviderElement;
|
||||
}
|
||||
}
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Umbraco.Core.Configuration
|
||||
{
|
||||
public class FileSystemProvidersSection : ConfigurationSection, IFileSystemProvidersSection
|
||||
{
|
||||
|
||||
[ConfigurationProperty("", IsDefaultCollection = true, IsRequired = true)]
|
||||
public FileSystemProviderElementCollection Providers
|
||||
{
|
||||
get { return ((FileSystemProviderElementCollection)(base[""])); }
|
||||
}
|
||||
|
||||
private IDictionary<string, IFileSystemProviderElement> _providers;
|
||||
|
||||
IDictionary<string, IFileSystemProviderElement> IFileSystemProvidersSection.Providers
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_providers != null) return _providers;
|
||||
_providers = Providers.ToDictionary(x => x.Alias, x => x);
|
||||
return _providers;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,8 +31,8 @@ namespace Umbraco.Core.Configuration
|
||||
private static string _reservedPaths;
|
||||
private static string _reservedUrls;
|
||||
//ensure the built on (non-changeable) reserved paths are there at all times
|
||||
internal const string StaticReservedPaths = "~/app_plugins/,~/install/,";
|
||||
internal const string StaticReservedUrls = "~/config/splashes/booting.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd,";
|
||||
internal const string StaticReservedPaths = "~/app_plugins/,~/install/,"; //must end with a comma!
|
||||
internal const string StaticReservedUrls = "~/config/splashes/noNodes.aspx,~/.well-known,"; //must end with a comma!
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
@@ -82,19 +82,18 @@ namespace Umbraco.Core.Configuration
|
||||
public string ReservedUrls
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_reservedUrls == null)
|
||||
{
|
||||
var urls = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedUrls")
|
||||
? ConfigurationManager.AppSettings["umbracoReservedUrls"]
|
||||
: string.Empty;
|
||||
{
|
||||
if (_reservedUrls != null) return _reservedUrls;
|
||||
|
||||
//ensure the built on (non-changeable) reserved paths are there at all times
|
||||
_reservedUrls = StaticReservedUrls + urls;
|
||||
}
|
||||
var urls = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedUrls")
|
||||
? ConfigurationManager.AppSettings["umbracoReservedUrls"]
|
||||
: string.Empty;
|
||||
|
||||
//ensure the built on (non-changeable) reserved paths are there at all times
|
||||
_reservedUrls = StaticReservedUrls + urls;
|
||||
return _reservedUrls;
|
||||
}
|
||||
internal set { _reservedUrls = value; }
|
||||
internal set => _reservedUrls = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -105,22 +104,20 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_reservedPaths == null)
|
||||
{
|
||||
var reservedPaths = StaticReservedPaths;
|
||||
//always add the umbraco path to the list
|
||||
if (ConfigurationManager.AppSettings.ContainsKey("umbracoPath")
|
||||
&& !ConfigurationManager.AppSettings["umbracoPath"].IsNullOrWhiteSpace())
|
||||
{
|
||||
reservedPaths += ConfigurationManager.AppSettings["umbracoPath"].EnsureEndsWith(',');
|
||||
}
|
||||
if (_reservedPaths != null) return _reservedPaths;
|
||||
|
||||
var allPaths = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedPaths")
|
||||
? ConfigurationManager.AppSettings["umbracoReservedPaths"]
|
||||
: string.Empty;
|
||||
var reservedPaths = StaticReservedPaths;
|
||||
var umbPath = ConfigurationManager.AppSettings.ContainsKey("umbracoPath") && !ConfigurationManager.AppSettings["umbracoPath"].IsNullOrWhiteSpace()
|
||||
? ConfigurationManager.AppSettings["umbracoPath"]
|
||||
: "~/umbraco";
|
||||
//always add the umbraco path to the list
|
||||
reservedPaths += umbPath.EnsureEndsWith(',');
|
||||
|
||||
_reservedPaths = reservedPaths + allPaths;
|
||||
}
|
||||
var allPaths = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedPaths")
|
||||
? ConfigurationManager.AppSettings["umbracoReservedPaths"]
|
||||
: string.Empty;
|
||||
|
||||
_reservedPaths = reservedPaths + allPaths;
|
||||
return _reservedPaths;
|
||||
}
|
||||
}
|
||||
@@ -260,26 +257,7 @@ namespace Umbraco.Core.Configuration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether umbraco uses directory urls.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if umbraco uses directory urls; otherwise, <c>false</c>.</value>
|
||||
public bool UseDirectoryUrls
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return bool.Parse(ConfigurationManager.AppSettings["umbracoUseDirectoryUrls"]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of days that should take place between version checks.
|
||||
/// </summary>
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Umbraco.Core.Configuration.Grid
|
||||
{
|
||||
List<GridEditor> GetResult()
|
||||
{
|
||||
// TODO should use the common one somehow! + ignoring _appPlugins here!
|
||||
// TODO: should use the common one somehow! + ignoring _appPlugins here!
|
||||
var parser = new ManifestParser(_appCaches, Current.ManifestValidators, _logger);
|
||||
|
||||
var editors = new List<GridEditor>();
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Configuration
|
||||
{
|
||||
public interface IFileSystemProviderElement
|
||||
{
|
||||
string Alias { get; }
|
||||
string Type { get; }
|
||||
IDictionary<string, string> Parameters { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Configuration
|
||||
{
|
||||
public interface IFileSystemProvidersSection
|
||||
{
|
||||
IDictionary<string, IFileSystemProviderElement> Providers { get; }
|
||||
}
|
||||
}
|
||||
@@ -34,12 +34,6 @@ namespace Umbraco.Core.Configuration
|
||||
/// </summary>
|
||||
int TimeOutInMinutes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether umbraco uses directory urls.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if umbraco uses directory urls; otherwise, <c>false</c>.</value>
|
||||
bool UseDirectoryUrls { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default UI language.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class AppCodeFileExtensionsCollection : ConfigurationElementCollection, IEnumerable<IFileExtension>
|
||||
{
|
||||
internal void Add(FileExtensionElement element)
|
||||
{
|
||||
base.BaseAdd(element);
|
||||
}
|
||||
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new FileExtensionElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((FileExtensionElement)element).Value;
|
||||
}
|
||||
|
||||
IEnumerator<IFileExtension> IEnumerable<IFileExtension>.GetEnumerator()
|
||||
{
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
yield return BaseGet(i) as IFileExtension;
|
||||
}
|
||||
}
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class AppCodeFileExtensionsElement : ConfigurationElement
|
||||
{
|
||||
[ConfigurationCollection(typeof(AppCodeFileExtensionsCollection), AddItemName = "ext")]
|
||||
[ConfigurationProperty("", IsDefaultCollection = true)]
|
||||
internal AppCodeFileExtensionsCollection AppCodeFileExtensionsCollection
|
||||
{
|
||||
get { return (AppCodeFileExtensionsCollection)base[""]; }
|
||||
set { base[""] = value; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,8 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
internal class BackOfficeElement : UmbracoConfigurationElement, IBackOfficeSection
|
||||
{
|
||||
[ConfigurationProperty("tours")]
|
||||
internal TourConfigElement Tours
|
||||
{
|
||||
get { return (TourConfigElement)this["tours"]; }
|
||||
}
|
||||
internal TourConfigElement Tours => (TourConfigElement)this["tours"];
|
||||
|
||||
ITourSection IBackOfficeSection.Tours
|
||||
{
|
||||
get { return Tours; }
|
||||
}
|
||||
ITourSection IBackOfficeSection.Tours => Tours;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,26 +7,18 @@
|
||||
|
||||
internal string Char
|
||||
{
|
||||
get { return _char ?? (_char = (string)RawXml.Attribute("org")); }
|
||||
set { _char = value; }
|
||||
get => _char ?? (_char = (string)RawXml.Attribute("org"));
|
||||
set => _char = value;
|
||||
}
|
||||
|
||||
internal string Replacement
|
||||
{
|
||||
get { return _replacement ?? (_replacement = Value); }
|
||||
set { _replacement = value; }
|
||||
get => _replacement ?? (_replacement = Value);
|
||||
set => _replacement = value;
|
||||
}
|
||||
|
||||
string IChar.Char
|
||||
{
|
||||
get { return Char; }
|
||||
string IChar.Char => Char;
|
||||
|
||||
}
|
||||
|
||||
string IChar.Replacement
|
||||
{
|
||||
get { return Replacement; }
|
||||
|
||||
}
|
||||
string IChar.Replacement => Replacement;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,15 +11,9 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
[ConfigurationProperty("imaging")]
|
||||
internal ContentImagingElement Imaging => (ContentImagingElement) this["imaging"];
|
||||
|
||||
[ConfigurationProperty("scripteditor")]
|
||||
internal ContentScriptEditorElement ScriptEditor => (ContentScriptEditorElement) this["scripteditor"];
|
||||
|
||||
[ConfigurationProperty("ResolveUrlsFromTextString")]
|
||||
internal InnerTextConfigurationElement<bool> ResolveUrlsFromTextString => GetOptionalTextElement("ResolveUrlsFromTextString", false);
|
||||
|
||||
[ConfigurationProperty("UploadAllowDirectories")]
|
||||
internal InnerTextConfigurationElement<bool> UploadAllowDirectories => GetOptionalTextElement("UploadAllowDirectories", true);
|
||||
|
||||
public IEnumerable<IContentErrorPage> Error404Collection => Errors.Error404Collection;
|
||||
|
||||
[ConfigurationProperty("errors", IsRequired = true)]
|
||||
@@ -28,27 +22,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
[ConfigurationProperty("notifications", IsRequired = true)]
|
||||
internal NotificationsElement Notifications => (NotificationsElement) base["notifications"];
|
||||
|
||||
[ConfigurationProperty("ensureUniqueNaming")]
|
||||
internal InnerTextConfigurationElement<bool> EnsureUniqueNaming => GetOptionalTextElement("ensureUniqueNaming", true);
|
||||
|
||||
[ConfigurationProperty("XmlCacheEnabled")]
|
||||
internal InnerTextConfigurationElement<bool> XmlCacheEnabled => GetOptionalTextElement("XmlCacheEnabled", true);
|
||||
|
||||
[ConfigurationProperty("ContinouslyUpdateXmlDiskCache")]
|
||||
internal InnerTextConfigurationElement<bool> ContinouslyUpdateXmlDiskCache => GetOptionalTextElement("ContinouslyUpdateXmlDiskCache", true);
|
||||
|
||||
[ConfigurationProperty("XmlContentCheckForDiskChanges")]
|
||||
internal InnerTextConfigurationElement<bool> XmlContentCheckForDiskChanges => GetOptionalTextElement("XmlContentCheckForDiskChanges", false);
|
||||
|
||||
[ConfigurationProperty("EnableSplashWhileLoading")]
|
||||
internal InnerTextConfigurationElement<bool> EnableSplashWhileLoading => GetOptionalTextElement("EnableSplashWhileLoading", false);
|
||||
|
||||
[ConfigurationProperty("PropertyContextHelpOption")]
|
||||
internal InnerTextConfigurationElement<string> PropertyContextHelpOption => GetOptionalTextElement("PropertyContextHelpOption", "text");
|
||||
|
||||
[ConfigurationProperty("ForceSafeAliases")]
|
||||
internal InnerTextConfigurationElement<bool> ForceSafeAliases => GetOptionalTextElement("ForceSafeAliases", true);
|
||||
|
||||
[ConfigurationProperty("PreviewBadge")]
|
||||
internal InnerTextConfigurationElement<string> PreviewBadge => GetOptionalTextElement("PreviewBadge", DefaultPreviewBadge);
|
||||
|
||||
@@ -60,25 +33,10 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
|
||||
[ConfigurationProperty("allowedUploadFiles")]
|
||||
internal CommaDelimitedConfigurationElement AllowedUploadFiles => GetOptionalDelimitedElement("allowedUploadFiles", new string[0]);
|
||||
|
||||
[ConfigurationProperty("cloneXmlContent")]
|
||||
internal InnerTextConfigurationElement<bool> CloneXmlContent => GetOptionalTextElement("cloneXmlContent", true);
|
||||
|
||||
[ConfigurationProperty("GlobalPreviewStorageEnabled")]
|
||||
internal InnerTextConfigurationElement<bool> GlobalPreviewStorageEnabled => GetOptionalTextElement("GlobalPreviewStorageEnabled", false);
|
||||
|
||||
[ConfigurationProperty("defaultDocumentTypeProperty")]
|
||||
internal InnerTextConfigurationElement<string> DefaultDocumentTypeProperty => GetOptionalTextElement("defaultDocumentTypeProperty", "Textstring");
|
||||
|
||||
|
||||
[ConfigurationProperty("showDeprecatedPropertyEditors")]
|
||||
internal InnerTextConfigurationElement<bool> ShowDeprecatedPropertyEditors => GetOptionalTextElement("showDeprecatedPropertyEditors", false);
|
||||
|
||||
[ConfigurationProperty("EnableInheritedDocumentTypes")]
|
||||
internal InnerTextConfigurationElement<bool> EnableInheritedDocumentTypes => GetOptionalTextElement("EnableInheritedDocumentTypes", true);
|
||||
|
||||
[ConfigurationProperty("EnableInheritedMediaTypes")]
|
||||
internal InnerTextConfigurationElement<bool> EnableInheritedMediaTypes => GetOptionalTextElement("EnableInheritedMediaTypes", true);
|
||||
|
||||
[ConfigurationProperty("loginBackgroundImage")]
|
||||
internal InnerTextConfigurationElement<string> LoginBackgroundImage => GetOptionalTextElement("loginBackgroundImage", string.Empty);
|
||||
|
||||
@@ -88,34 +46,10 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
|
||||
IEnumerable<string> IContentSection.ImageFileTypes => Imaging.ImageFileTypes;
|
||||
|
||||
IEnumerable<string> IContentSection.ImageTagAllowedAttributes => Imaging.ImageTagAllowedAttributes;
|
||||
|
||||
IEnumerable<IImagingAutoFillUploadField> IContentSection.ImageAutoFillProperties => Imaging.ImageAutoFillProperties;
|
||||
|
||||
bool IContentSection.ScriptEditorDisable => ScriptEditor.ScriptEditorDisable;
|
||||
|
||||
string IContentSection.ScriptFolderPath => ScriptEditor.ScriptFolderPath;
|
||||
|
||||
IEnumerable<string> IContentSection.ScriptFileTypes => ScriptEditor.ScriptFileTypes;
|
||||
|
||||
bool IContentSection.ResolveUrlsFromTextString => ResolveUrlsFromTextString;
|
||||
|
||||
bool IContentSection.UploadAllowDirectories => UploadAllowDirectories;
|
||||
|
||||
bool IContentSection.EnsureUniqueNaming => EnsureUniqueNaming;
|
||||
|
||||
bool IContentSection.XmlCacheEnabled => XmlCacheEnabled;
|
||||
|
||||
bool IContentSection.ContinouslyUpdateXmlDiskCache => ContinouslyUpdateXmlDiskCache;
|
||||
|
||||
bool IContentSection.XmlContentCheckForDiskChanges => XmlContentCheckForDiskChanges;
|
||||
|
||||
bool IContentSection.EnableSplashWhileLoading => EnableSplashWhileLoading;
|
||||
|
||||
string IContentSection.PropertyContextHelpOption => PropertyContextHelpOption;
|
||||
|
||||
bool IContentSection.ForceSafeAliases => ForceSafeAliases;
|
||||
|
||||
string IContentSection.PreviewBadge => PreviewBadge;
|
||||
|
||||
MacroErrorBehaviour IContentSection.MacroErrorBehaviour => MacroErrors;
|
||||
@@ -124,19 +58,8 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
|
||||
IEnumerable<string> IContentSection.AllowedUploadFiles => AllowedUploadFiles;
|
||||
|
||||
bool IContentSection.CloneXmlContent => CloneXmlContent;
|
||||
|
||||
bool IContentSection.GlobalPreviewStorageEnabled => GlobalPreviewStorageEnabled;
|
||||
|
||||
string IContentSection.DefaultDocumentTypeProperty => DefaultDocumentTypeProperty;
|
||||
|
||||
bool IContentSection.ShowDeprecatedPropertyEditors => ShowDeprecatedPropertyEditors;
|
||||
|
||||
bool IContentSection.EnableInheritedDocumentTypes => EnableInheritedDocumentTypes;
|
||||
|
||||
bool IContentSection.EnableInheritedMediaTypes => EnableInheritedMediaTypes;
|
||||
|
||||
|
||||
string IContentSection.LoginBackgroundImage => LoginBackgroundImage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,15 +15,9 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
|
||||
}
|
||||
|
||||
public bool HasContentId
|
||||
{
|
||||
get { return ContentId != int.MinValue; }
|
||||
}
|
||||
public bool HasContentId => ContentId != int.MinValue;
|
||||
|
||||
public bool HasContentKey
|
||||
{
|
||||
get { return ContentKey != Guid.Empty; }
|
||||
}
|
||||
public bool HasContentKey => ContentKey != Guid.Empty;
|
||||
|
||||
public int ContentId
|
||||
{
|
||||
@@ -51,15 +45,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
}
|
||||
}
|
||||
|
||||
public string ContentXPath
|
||||
{
|
||||
get { return Value; }
|
||||
}
|
||||
public string ContentXPath => Value;
|
||||
|
||||
public string Culture
|
||||
{
|
||||
get { return (string) RawXml.Attribute("culture"); }
|
||||
set { RawXml.Attribute("culture").Value = value; }
|
||||
get => (string) RawXml.Attribute("culture");
|
||||
set => RawXml.Attribute("culture").Value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,34 +6,17 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
|
||||
[ConfigurationProperty("imageFileTypes")]
|
||||
internal CommaDelimitedConfigurationElement ImageFileTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return new OptionalCommaDelimitedConfigurationElement(
|
||||
(CommaDelimitedConfigurationElement)this["imageFileTypes"],
|
||||
//set the default
|
||||
GetDefaultImageFileTypes());
|
||||
}
|
||||
}
|
||||
internal CommaDelimitedConfigurationElement ImageFileTypes =>
|
||||
new OptionalCommaDelimitedConfigurationElement(
|
||||
(CommaDelimitedConfigurationElement)this["imageFileTypes"],
|
||||
//set the default
|
||||
GetDefaultImageFileTypes());
|
||||
|
||||
internal static string[] GetDefaultImageFileTypes()
|
||||
{
|
||||
return new[] {"jpeg", "jpg", "gif", "bmp", "png", "tiff", "tif"};
|
||||
}
|
||||
|
||||
[ConfigurationProperty("allowedAttributes")]
|
||||
internal CommaDelimitedConfigurationElement ImageTagAllowedAttributes
|
||||
{
|
||||
get
|
||||
{
|
||||
return new OptionalCommaDelimitedConfigurationElement(
|
||||
(CommaDelimitedConfigurationElement)this["allowedAttributes"],
|
||||
//set the default
|
||||
new[] { "src", "alt", "border", "class", "style", "align", "id", "name", "onclick", "usemap" });
|
||||
}
|
||||
}
|
||||
|
||||
private ImagingAutoFillPropertiesCollection _defaultImageAutoFill;
|
||||
|
||||
[ConfigurationCollection(typeof(ImagingAutoFillPropertiesCollection), AddItemName = "uploadField")]
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class ContentScriptEditorElement : UmbracoConfigurationElement
|
||||
{
|
||||
[ConfigurationProperty("scriptFolderPath")]
|
||||
internal InnerTextConfigurationElement<string> ScriptFolderPath
|
||||
{
|
||||
get { return GetOptionalTextElement("scriptFolderPath", "/scripts"); }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("scriptFileTypes")]
|
||||
internal OptionalCommaDelimitedConfigurationElement ScriptFileTypes
|
||||
{
|
||||
get { return GetOptionalDelimitedElement("scriptFileTypes", new[] {"js", "xml"}); }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("scriptDisableEditor")]
|
||||
internal InnerTextConfigurationElement<bool> ScriptEditorDisable
|
||||
{
|
||||
get { return GetOptionalTextElement("scriptDisableEditor", false); }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class DisabledLogTypesCollection : ConfigurationElementCollection, IEnumerable<ILogType>
|
||||
{
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new LogTypeElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((LogTypeElement)element).Value;
|
||||
}
|
||||
|
||||
IEnumerator<ILogType> IEnumerable<ILogType>.GetEnumerator()
|
||||
{
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
yield return BaseGet(i) as ILogType;
|
||||
}
|
||||
}
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class ExternalLoggerElement : ConfigurationElement
|
||||
{
|
||||
[ConfigurationProperty("assembly")]
|
||||
internal string Assembly
|
||||
{
|
||||
get { return (string)base["assembly"]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("type")]
|
||||
internal string Type
|
||||
{
|
||||
get { return (string)base["type"]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("logAuditTrail")]
|
||||
internal bool LogAuditTrail
|
||||
{
|
||||
get { return (bool)base["logAuditTrail"]; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class FileExtensionElement : InnerTextConfigurationElement<string>, IFileExtension
|
||||
{
|
||||
public FileExtensionElement()
|
||||
{
|
||||
}
|
||||
|
||||
internal FileExtensionElement(XElement rawXml)
|
||||
: base(rawXml)
|
||||
{
|
||||
}
|
||||
|
||||
string IFileExtension.Extension
|
||||
{
|
||||
get { return Value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,36 +11,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
|
||||
IEnumerable<string> ImageFileTypes { get; }
|
||||
|
||||
IEnumerable<string> ImageTagAllowedAttributes { get; }
|
||||
|
||||
IEnumerable<IImagingAutoFillUploadField> ImageAutoFillProperties { get; }
|
||||
|
||||
string ScriptFolderPath { get; }
|
||||
|
||||
IEnumerable<string> ScriptFileTypes { get; }
|
||||
|
||||
bool ScriptEditorDisable { get; }
|
||||
|
||||
bool ResolveUrlsFromTextString { get; }
|
||||
|
||||
bool UploadAllowDirectories { get; }
|
||||
|
||||
IEnumerable<IContentErrorPage> Error404Collection { get; }
|
||||
|
||||
bool EnsureUniqueNaming { get; }
|
||||
|
||||
bool XmlCacheEnabled { get; }
|
||||
|
||||
bool ContinouslyUpdateXmlDiskCache { get; }
|
||||
|
||||
bool XmlContentCheckForDiskChanges { get; }
|
||||
|
||||
bool EnableSplashWhileLoading { get; }
|
||||
|
||||
string PropertyContextHelpOption { get; }
|
||||
|
||||
bool ForceSafeAliases { get; }
|
||||
|
||||
|
||||
string PreviewBadge { get; }
|
||||
|
||||
MacroErrorBehaviour MacroErrorBehaviour { get; }
|
||||
@@ -49,22 +25,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
|
||||
IEnumerable<string> AllowedUploadFiles { get; }
|
||||
|
||||
bool CloneXmlContent { get; }
|
||||
|
||||
bool GlobalPreviewStorageEnabled { get; }
|
||||
|
||||
string DefaultDocumentTypeProperty { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether to show deprecated property editors in
|
||||
/// a datatype list of available editors.
|
||||
/// </summary>
|
||||
bool ShowDeprecatedPropertyEditors { get; }
|
||||
|
||||
bool EnableInheritedDocumentTypes { get; }
|
||||
|
||||
bool EnableInheritedMediaTypes { get; }
|
||||
|
||||
string LoginBackgroundImage { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public interface IFileExtension
|
||||
{
|
||||
string Extension { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public interface ILogType
|
||||
{
|
||||
string LogTypeAlias { get; }
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public interface ILoggingSection : IUmbracoConfigurationSection
|
||||
{
|
||||
bool AutoCleanLogs { get; }
|
||||
|
||||
bool EnableLogging { get; }
|
||||
|
||||
int CleaningMiliseconds { get; }
|
||||
|
||||
int MaxLogAge { get; }
|
||||
|
||||
IEnumerable<ILogType> DisabledLogTypes { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public interface IProvidersSection : IUmbracoConfigurationSection
|
||||
{
|
||||
string DefaultBackOfficeUserProvider { get; }
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,8 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public interface IRequestHandlerSection : IUmbracoConfigurationSection
|
||||
{
|
||||
bool UseDomainPrefixes { get; }
|
||||
|
||||
bool AddTrailingSlash { get; }
|
||||
|
||||
bool RemoveDoubleDashes { get; }
|
||||
|
||||
bool ConvertUrlsToAscii { get; }
|
||||
|
||||
bool TryConvertUrlsToAscii { get; }
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public interface IScheduledTask
|
||||
{
|
||||
string Alias { get; }
|
||||
|
||||
bool Log { get; }
|
||||
|
||||
int Interval { get; }
|
||||
|
||||
string Url { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public interface IScheduledTasksSection : IUmbracoConfigurationSection
|
||||
{
|
||||
IEnumerable<IScheduledTask> Tasks { get; }
|
||||
|
||||
string BaseUrl { get; }
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
|
||||
ILoggingSection Logging { get; }
|
||||
|
||||
IScheduledTasksSection ScheduledTasks { get; }
|
||||
|
||||
IProvidersSection Providers { get; }
|
||||
|
||||
IWebRoutingSection WebRouting { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,58 +10,30 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
[ConfigurationProperty("alias", IsKey = true, IsRequired = true)]
|
||||
public string Alias
|
||||
{
|
||||
get { return (string)this["alias"]; }
|
||||
set { this["alias"] = value; }
|
||||
get => (string)this["alias"];
|
||||
set => this["alias"] = value;
|
||||
}
|
||||
|
||||
[ConfigurationProperty("widthFieldAlias")]
|
||||
internal InnerTextConfigurationElement<string> WidthFieldAlias
|
||||
{
|
||||
get { return GetOptionalTextElement("widthFieldAlias", "umbracoWidth"); }
|
||||
}
|
||||
internal InnerTextConfigurationElement<string> WidthFieldAlias => GetOptionalTextElement("widthFieldAlias", "umbracoWidth");
|
||||
|
||||
[ConfigurationProperty("heightFieldAlias")]
|
||||
internal InnerTextConfigurationElement<string> HeightFieldAlias
|
||||
{
|
||||
get { return GetOptionalTextElement("heightFieldAlias", "umbracoHeight"); }
|
||||
}
|
||||
internal InnerTextConfigurationElement<string> HeightFieldAlias => GetOptionalTextElement("heightFieldAlias", "umbracoHeight");
|
||||
|
||||
[ConfigurationProperty("lengthFieldAlias")]
|
||||
internal InnerTextConfigurationElement<string> LengthFieldAlias
|
||||
{
|
||||
get { return GetOptionalTextElement("lengthFieldAlias", "umbracoBytes"); }
|
||||
}
|
||||
internal InnerTextConfigurationElement<string> LengthFieldAlias => GetOptionalTextElement("lengthFieldAlias", "umbracoBytes");
|
||||
|
||||
[ConfigurationProperty("extensionFieldAlias")]
|
||||
internal InnerTextConfigurationElement<string> ExtensionFieldAlias
|
||||
{
|
||||
get { return GetOptionalTextElement("extensionFieldAlias", "umbracoExtension"); }
|
||||
}
|
||||
internal InnerTextConfigurationElement<string> ExtensionFieldAlias => GetOptionalTextElement("extensionFieldAlias", "umbracoExtension");
|
||||
|
||||
string IImagingAutoFillUploadField.Alias
|
||||
{
|
||||
get { return Alias; }
|
||||
string IImagingAutoFillUploadField.Alias => Alias;
|
||||
|
||||
}
|
||||
string IImagingAutoFillUploadField.WidthFieldAlias => WidthFieldAlias;
|
||||
|
||||
string IImagingAutoFillUploadField.WidthFieldAlias
|
||||
{
|
||||
get { return WidthFieldAlias; }
|
||||
}
|
||||
string IImagingAutoFillUploadField.HeightFieldAlias => HeightFieldAlias;
|
||||
|
||||
string IImagingAutoFillUploadField.HeightFieldAlias
|
||||
{
|
||||
get { return HeightFieldAlias; }
|
||||
}
|
||||
string IImagingAutoFillUploadField.LengthFieldAlias => LengthFieldAlias;
|
||||
|
||||
string IImagingAutoFillUploadField.LengthFieldAlias
|
||||
{
|
||||
get { return LengthFieldAlias; }
|
||||
}
|
||||
|
||||
string IImagingAutoFillUploadField.ExtensionFieldAlias
|
||||
{
|
||||
get { return ExtensionFieldAlias; }
|
||||
}
|
||||
string IImagingAutoFillUploadField.ExtensionFieldAlias => ExtensionFieldAlias;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class LogTypeElement : InnerTextConfigurationElement<string>, ILogType
|
||||
{
|
||||
|
||||
string ILogType.LogTypeAlias
|
||||
{
|
||||
get { return Value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,87 +6,9 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
internal class LoggingElement : UmbracoConfigurationElement, ILoggingSection
|
||||
{
|
||||
|
||||
[ConfigurationProperty("autoCleanLogs")]
|
||||
internal InnerTextConfigurationElement<bool> AutoCleanLogs
|
||||
{
|
||||
get { return GetOptionalTextElement("autoCleanLogs", false); }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("enableLogging")]
|
||||
internal InnerTextConfigurationElement<bool> EnableLogging
|
||||
{
|
||||
get { return GetOptionalTextElement("enableLogging", true); }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("enableAsyncLogging")]
|
||||
internal InnerTextConfigurationElement<bool> EnableAsyncLogging
|
||||
{
|
||||
get { return GetOptionalTextElement("enableAsyncLogging", true); }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("cleaningMiliseconds")]
|
||||
internal InnerTextConfigurationElement<int> CleaningMiliseconds
|
||||
{
|
||||
get { return GetOptionalTextElement("cleaningMiliseconds", -1); }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("maxLogAge")]
|
||||
internal InnerTextConfigurationElement<int> MaxLogAge
|
||||
{
|
||||
get { return GetOptionalTextElement("maxLogAge", -1); }
|
||||
}
|
||||
|
||||
[ConfigurationCollection(typeof(DisabledLogTypesCollection), AddItemName = "logTypeAlias")]
|
||||
[ConfigurationProperty("disabledLogTypes", IsDefaultCollection = true)]
|
||||
internal DisabledLogTypesCollection DisabledLogTypes
|
||||
{
|
||||
get { return (DisabledLogTypesCollection)base["disabledLogTypes"]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("externalLogger", IsRequired = false)]
|
||||
internal ExternalLoggerElement ExternalLogger
|
||||
{
|
||||
get { return (ExternalLoggerElement) base["externalLogger"]; }
|
||||
}
|
||||
|
||||
public bool ExternalLoggerIsConfigured
|
||||
{
|
||||
get
|
||||
{
|
||||
var externalLoggerProperty = Properties["externalLogger"];
|
||||
var externalLogger = this[externalLoggerProperty] as ConfigurationElement;
|
||||
if (externalLogger != null && externalLogger.ElementInformation.IsPresent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ILoggingSection.AutoCleanLogs
|
||||
{
|
||||
get { return AutoCleanLogs; }
|
||||
}
|
||||
|
||||
bool ILoggingSection.EnableLogging
|
||||
{
|
||||
get { return EnableLogging; }
|
||||
}
|
||||
|
||||
int ILoggingSection.CleaningMiliseconds
|
||||
{
|
||||
get { return CleaningMiliseconds; }
|
||||
}
|
||||
|
||||
int ILoggingSection.MaxLogAge
|
||||
{
|
||||
get { return MaxLogAge; }
|
||||
}
|
||||
|
||||
IEnumerable<ILogType> ILoggingSection.DisabledLogTypes
|
||||
{
|
||||
get { return DisabledLogTypes; }
|
||||
}
|
||||
internal InnerTextConfigurationElement<int> MaxLogAge => GetOptionalTextElement("maxLogAge", -1);
|
||||
|
||||
int ILoggingSection.MaxLogAge => MaxLogAge;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,16 +5,9 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
internal class NotificationsElement : UmbracoConfigurationElement
|
||||
{
|
||||
[ConfigurationProperty("email")]
|
||||
internal InnerTextConfigurationElement<string> NotificationEmailAddress
|
||||
{
|
||||
get { return (InnerTextConfigurationElement<string>)this["email"]; }
|
||||
}
|
||||
internal InnerTextConfigurationElement<string> NotificationEmailAddress => (InnerTextConfigurationElement<string>)this["email"];
|
||||
|
||||
[ConfigurationProperty("disableHtmlEmail")]
|
||||
internal InnerTextConfigurationElement<bool> DisableHtmlEmail
|
||||
{
|
||||
get { return GetOptionalTextElement("disableHtmlEmail", false); }
|
||||
}
|
||||
|
||||
internal InnerTextConfigurationElement<bool> DisableHtmlEmail => GetOptionalTextElement("disableHtmlEmail", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class ProvidersElement : ConfigurationElement, IProvidersSection
|
||||
{
|
||||
[ConfigurationProperty("users")]
|
||||
public UserProviderElement Users
|
||||
{
|
||||
get { return (UserProviderElement)base["users"]; }
|
||||
}
|
||||
|
||||
public string DefaultBackOfficeUserProvider
|
||||
{
|
||||
get { return Users.DefaultBackOfficeProvider; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,17 +7,8 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class RequestHandlerElement : UmbracoConfigurationElement, IRequestHandlerSection
|
||||
{
|
||||
[ConfigurationProperty("useDomainPrefixes")]
|
||||
public InnerTextConfigurationElement<bool> UseDomainPrefixes
|
||||
{
|
||||
get { return GetOptionalTextElement("useDomainPrefixes", false); }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("addTrailingSlash")]
|
||||
public InnerTextConfigurationElement<bool> AddTrailingSlash
|
||||
{
|
||||
get { return GetOptionalTextElement("addTrailingSlash", true); }
|
||||
}
|
||||
public InnerTextConfigurationElement<bool> AddTrailingSlash => GetOptionalTextElement("addTrailingSlash", true);
|
||||
|
||||
private UrlReplacingElement _defaultUrlReplacing;
|
||||
[ConfigurationProperty("urlReplacing")]
|
||||
@@ -94,34 +85,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
return collection;
|
||||
}
|
||||
|
||||
bool IRequestHandlerSection.UseDomainPrefixes
|
||||
{
|
||||
get { return UseDomainPrefixes; }
|
||||
}
|
||||
bool IRequestHandlerSection.AddTrailingSlash => AddTrailingSlash;
|
||||
|
||||
bool IRequestHandlerSection.AddTrailingSlash
|
||||
{
|
||||
get { return AddTrailingSlash; }
|
||||
}
|
||||
bool IRequestHandlerSection.ConvertUrlsToAscii => UrlReplacing.ConvertUrlsToAscii.InvariantEquals("true");
|
||||
|
||||
bool IRequestHandlerSection.RemoveDoubleDashes
|
||||
{
|
||||
get { return UrlReplacing.RemoveDoubleDashes; }
|
||||
}
|
||||
bool IRequestHandlerSection.TryConvertUrlsToAscii => UrlReplacing.ConvertUrlsToAscii.InvariantEquals("try");
|
||||
|
||||
bool IRequestHandlerSection.ConvertUrlsToAscii
|
||||
{
|
||||
get { return UrlReplacing.ConvertUrlsToAscii.InvariantEquals("true"); }
|
||||
}
|
||||
|
||||
bool IRequestHandlerSection.TryConvertUrlsToAscii
|
||||
{
|
||||
get { return UrlReplacing.ConvertUrlsToAscii.InvariantEquals("try"); }
|
||||
}
|
||||
|
||||
IEnumerable<IChar> IRequestHandlerSection.CharCollection
|
||||
{
|
||||
get { return UrlReplacing.CharCollection; }
|
||||
}
|
||||
IEnumerable<IChar> IRequestHandlerSection.CharCollection => UrlReplacing.CharCollection;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class ScheduledTaskElement : ConfigurationElement, IScheduledTask
|
||||
{
|
||||
[ConfigurationProperty("alias")]
|
||||
public string Alias
|
||||
{
|
||||
get { return (string)base["alias"]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("log")]
|
||||
public bool Log
|
||||
{
|
||||
get { return (bool)base["log"]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("interval")]
|
||||
public int Interval
|
||||
{
|
||||
get { return (int)base["interval"]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("url")]
|
||||
public string Url
|
||||
{
|
||||
get { return (string)base["url"]; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class ScheduledTasksCollection : ConfigurationElementCollection, IEnumerable<IScheduledTask>
|
||||
{
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new ScheduledTaskElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((ScheduledTaskElement)element).Alias;
|
||||
}
|
||||
|
||||
IEnumerator<IScheduledTask> IEnumerable<IScheduledTask>.GetEnumerator()
|
||||
{
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
yield return BaseGet(i) as IScheduledTask;
|
||||
}
|
||||
}
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class ScheduledTasksElement : ConfigurationElement, IScheduledTasksSection
|
||||
{
|
||||
[ConfigurationCollection(typeof(ScheduledTasksCollection), AddItemName = "task")]
|
||||
[ConfigurationProperty("", IsDefaultCollection = true)]
|
||||
internal ScheduledTasksCollection Tasks
|
||||
{
|
||||
get { return (ScheduledTasksCollection)base[""]; }
|
||||
}
|
||||
|
||||
IEnumerable<IScheduledTask> IScheduledTasksSection.Tasks
|
||||
{
|
||||
get { return Tasks; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("baseUrl", IsRequired = false, DefaultValue = null)]
|
||||
public string BaseUrl
|
||||
{
|
||||
get { return (string)base["baseUrl"]; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,25 +5,16 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
internal class SecurityElement : UmbracoConfigurationElement, ISecuritySection
|
||||
{
|
||||
[ConfigurationProperty("keepUserLoggedIn")]
|
||||
internal InnerTextConfigurationElement<bool> KeepUserLoggedIn
|
||||
{
|
||||
get { return GetOptionalTextElement("keepUserLoggedIn", true); }
|
||||
}
|
||||
internal InnerTextConfigurationElement<bool> KeepUserLoggedIn => GetOptionalTextElement("keepUserLoggedIn", true);
|
||||
|
||||
[ConfigurationProperty("hideDisabledUsersInBackoffice")]
|
||||
internal InnerTextConfigurationElement<bool> HideDisabledUsersInBackoffice
|
||||
{
|
||||
get { return GetOptionalTextElement("hideDisabledUsersInBackoffice", false); }
|
||||
}
|
||||
internal InnerTextConfigurationElement<bool> HideDisabledUsersInBackoffice => GetOptionalTextElement("hideDisabledUsersInBackoffice", false);
|
||||
|
||||
/// <summary>
|
||||
/// Used to enable/disable the forgot password functionality on the back office login screen
|
||||
/// </summary>
|
||||
[ConfigurationProperty("allowPasswordReset")]
|
||||
internal InnerTextConfigurationElement<bool> AllowPasswordReset
|
||||
{
|
||||
get { return GetOptionalTextElement("allowPasswordReset", true); }
|
||||
}
|
||||
internal InnerTextConfigurationElement<bool> AllowPasswordReset => GetOptionalTextElement("allowPasswordReset", true);
|
||||
|
||||
/// <summary>
|
||||
/// A boolean indicating that by default the email address will be the username
|
||||
@@ -33,40 +24,22 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
/// When this is false, the username and email fields will be shown in the user section.
|
||||
/// </remarks>
|
||||
[ConfigurationProperty("usernameIsEmail")]
|
||||
internal InnerTextConfigurationElement<bool> UsernameIsEmail
|
||||
{
|
||||
get { return GetOptionalTextElement("usernameIsEmail", true); }
|
||||
}
|
||||
internal InnerTextConfigurationElement<bool> UsernameIsEmail => GetOptionalTextElement("usernameIsEmail", true);
|
||||
|
||||
[ConfigurationProperty("authCookieName")]
|
||||
internal InnerTextConfigurationElement<string> AuthCookieName
|
||||
{
|
||||
get { return GetOptionalTextElement("authCookieName", "UMB_UCONTEXT"); }
|
||||
}
|
||||
internal InnerTextConfigurationElement<string> AuthCookieName => GetOptionalTextElement("authCookieName", "UMB_UCONTEXT");
|
||||
|
||||
[ConfigurationProperty("authCookieDomain")]
|
||||
internal InnerTextConfigurationElement<string> AuthCookieDomain
|
||||
{
|
||||
get { return GetOptionalTextElement<string>("authCookieDomain", null); }
|
||||
}
|
||||
internal InnerTextConfigurationElement<string> AuthCookieDomain => GetOptionalTextElement<string>("authCookieDomain", null);
|
||||
|
||||
bool ISecuritySection.KeepUserLoggedIn
|
||||
{
|
||||
get { return KeepUserLoggedIn; }
|
||||
}
|
||||
bool ISecuritySection.KeepUserLoggedIn => KeepUserLoggedIn;
|
||||
|
||||
bool ISecuritySection.HideDisabledUsersInBackoffice
|
||||
{
|
||||
get { return HideDisabledUsersInBackoffice; }
|
||||
}
|
||||
bool ISecuritySection.HideDisabledUsersInBackoffice => HideDisabledUsersInBackoffice;
|
||||
|
||||
/// <summary>
|
||||
/// Used to enable/disable the forgot password functionality on the back office login screen
|
||||
/// </summary>
|
||||
bool ISecuritySection.AllowPasswordReset
|
||||
{
|
||||
get { return AllowPasswordReset; }
|
||||
}
|
||||
bool ISecuritySection.AllowPasswordReset => AllowPasswordReset;
|
||||
|
||||
/// <summary>
|
||||
/// A boolean indicating that by default the email address will be the username
|
||||
@@ -75,19 +48,10 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
/// Even if this is true and the username is different from the email in the database, the username field will still be shown.
|
||||
/// When this is false, the username and email fields will be shown in the user section.
|
||||
/// </remarks>
|
||||
bool ISecuritySection.UsernameIsEmail
|
||||
{
|
||||
get { return UsernameIsEmail; }
|
||||
}
|
||||
bool ISecuritySection.UsernameIsEmail => UsernameIsEmail;
|
||||
|
||||
string ISecuritySection.AuthCookieName
|
||||
{
|
||||
get { return AuthCookieName; }
|
||||
}
|
||||
string ISecuritySection.AuthCookieName => AuthCookieName;
|
||||
|
||||
string ISecuritySection.AuthCookieDomain
|
||||
{
|
||||
get { return AuthCookieDomain; }
|
||||
}
|
||||
string ISecuritySection.AuthCookieDomain => AuthCookieDomain;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,10 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
internal class TourConfigElement : UmbracoConfigurationElement, ITourSection
|
||||
{
|
||||
//disabled by default so that upgraders don't get it enabled by default
|
||||
//TODO: we probably just want to disable the initial one from automatically loading ?
|
||||
// TODO: we probably just want to disable the initial one from automatically loading ?
|
||||
[ConfigurationProperty("enable", DefaultValue = false)]
|
||||
public bool EnableTours
|
||||
{
|
||||
get { return (bool)this["enable"]; }
|
||||
}
|
||||
public bool EnableTours => (bool)this["enable"];
|
||||
|
||||
//TODO: We could have additional filters, etc... defined here
|
||||
// TODO: We could have additional filters, etc... defined here
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,91 +5,34 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
public class UmbracoSettingsSection : ConfigurationSection, IUmbracoSettingsSection
|
||||
{
|
||||
[ConfigurationProperty("backOffice")]
|
||||
internal BackOfficeElement BackOffice
|
||||
{
|
||||
get { return (BackOfficeElement)this["backOffice"]; }
|
||||
}
|
||||
internal BackOfficeElement BackOffice => (BackOfficeElement)this["backOffice"];
|
||||
|
||||
[ConfigurationProperty("content")]
|
||||
internal ContentElement Content
|
||||
{
|
||||
get { return (ContentElement)this["content"]; }
|
||||
}
|
||||
internal ContentElement Content => (ContentElement)this["content"];
|
||||
|
||||
[ConfigurationProperty("security")]
|
||||
internal SecurityElement Security
|
||||
{
|
||||
get { return (SecurityElement)this["security"]; }
|
||||
}
|
||||
internal SecurityElement Security => (SecurityElement)this["security"];
|
||||
|
||||
[ConfigurationProperty("requestHandler")]
|
||||
internal RequestHandlerElement RequestHandler
|
||||
{
|
||||
get { return (RequestHandlerElement)this["requestHandler"]; }
|
||||
}
|
||||
internal RequestHandlerElement RequestHandler => (RequestHandlerElement)this["requestHandler"];
|
||||
|
||||
[ConfigurationProperty("logging")]
|
||||
internal LoggingElement Logging
|
||||
{
|
||||
get { return (LoggingElement)this["logging"]; }
|
||||
}
|
||||
internal LoggingElement Logging => (LoggingElement)this["logging"];
|
||||
|
||||
[ConfigurationProperty("scheduledTasks")]
|
||||
internal ScheduledTasksElement ScheduledTasks
|
||||
{
|
||||
get { return (ScheduledTasksElement)this["scheduledTasks"]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("providers")]
|
||||
internal ProvidersElement Providers
|
||||
{
|
||||
get { return (ProvidersElement)this["providers"]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("web.routing")]
|
||||
internal WebRoutingElement WebRouting
|
||||
{
|
||||
get { return (WebRoutingElement)this["web.routing"]; }
|
||||
}
|
||||
internal WebRoutingElement WebRouting => (WebRoutingElement)this["web.routing"];
|
||||
|
||||
IContentSection IUmbracoSettingsSection.Content
|
||||
{
|
||||
get { return Content; }
|
||||
}
|
||||
IContentSection IUmbracoSettingsSection.Content => Content;
|
||||
|
||||
ISecuritySection IUmbracoSettingsSection.Security
|
||||
{
|
||||
get { return Security; }
|
||||
}
|
||||
ISecuritySection IUmbracoSettingsSection.Security => Security;
|
||||
|
||||
IRequestHandlerSection IUmbracoSettingsSection.RequestHandler
|
||||
{
|
||||
get { return RequestHandler; }
|
||||
}
|
||||
IRequestHandlerSection IUmbracoSettingsSection.RequestHandler => RequestHandler;
|
||||
|
||||
IBackOfficeSection IUmbracoSettingsSection.BackOffice
|
||||
{
|
||||
get { return BackOffice; }
|
||||
}
|
||||
IBackOfficeSection IUmbracoSettingsSection.BackOffice => BackOffice;
|
||||
|
||||
ILoggingSection IUmbracoSettingsSection.Logging
|
||||
{
|
||||
get { return Logging; }
|
||||
}
|
||||
ILoggingSection IUmbracoSettingsSection.Logging => Logging;
|
||||
|
||||
IScheduledTasksSection IUmbracoSettingsSection.ScheduledTasks
|
||||
{
|
||||
get { return ScheduledTasks; }
|
||||
}
|
||||
|
||||
IProvidersSection IUmbracoSettingsSection.Providers
|
||||
{
|
||||
get { return Providers; }
|
||||
}
|
||||
|
||||
IWebRoutingSection IUmbracoSettingsSection.WebRouting
|
||||
{
|
||||
get { return WebRouting; }
|
||||
}
|
||||
IWebRoutingSection IUmbracoSettingsSection.WebRouting => WebRouting;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,23 +6,17 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
internal class UrlReplacingElement : ConfigurationElement
|
||||
{
|
||||
[ConfigurationProperty("removeDoubleDashes", DefaultValue = true)]
|
||||
internal bool RemoveDoubleDashes
|
||||
{
|
||||
get { return (bool) base["removeDoubleDashes"]; }
|
||||
}
|
||||
internal bool RemoveDoubleDashes => (bool) base["removeDoubleDashes"];
|
||||
|
||||
[ConfigurationProperty("toAscii", DefaultValue = "false")]
|
||||
internal string ConvertUrlsToAscii
|
||||
{
|
||||
get { return (string) base["toAscii"]; }
|
||||
}
|
||||
internal string ConvertUrlsToAscii => (string) base["toAscii"];
|
||||
|
||||
[ConfigurationCollection(typeof(CharCollection), AddItemName = "char")]
|
||||
[ConfigurationProperty("", IsDefaultCollection = true)]
|
||||
internal CharCollection CharCollection
|
||||
{
|
||||
get { return (CharCollection)base[""]; }
|
||||
set { base[""] = value; }
|
||||
get => (CharCollection)base[""];
|
||||
set => base[""] = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class UserProviderElement : ConfigurationElement
|
||||
{
|
||||
[ConfigurationProperty("DefaultBackofficeProvider")]
|
||||
internal InnerTextConfigurationElement<string> DefaultBackOfficeProvider
|
||||
{
|
||||
get
|
||||
{
|
||||
return new OptionalInnerTextConfigurationElement<string>(
|
||||
(InnerTextConfigurationElement<string>)this["DefaultBackofficeProvider"],
|
||||
//set the default
|
||||
"UsersMembershipProvider");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
[ConfigurationProperty("disableRedirectUrlTracking", DefaultValue = "false")]
|
||||
public bool DisableRedirectUrlTracking => (bool) base["disableRedirectUrlTracking"];
|
||||
|
||||
[ConfigurationProperty("urlProviderMode", DefaultValue = "AutoLegacy")]
|
||||
[ConfigurationProperty("urlProviderMode", DefaultValue = "Auto")]
|
||||
public string UrlProviderMode => (string) base["urlProviderMode"];
|
||||
|
||||
[ConfigurationProperty("umbracoApplicationUrl", DefaultValue = null)]
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Umbraco.Core.Configuration
|
||||
/// <summary>
|
||||
/// Gets the non-semantic version of the Umbraco code.
|
||||
/// </summary>
|
||||
// TODO rename to Version
|
||||
// TODO: rename to Version
|
||||
public static Version Current { get; }
|
||||
|
||||
/// <summary>
|
||||
@@ -81,7 +81,7 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
try
|
||||
{
|
||||
// fixme/task - stop having version in web.config appSettings
|
||||
// TODO: https://github.com/umbraco/Umbraco-CMS/issues/4238 - stop having version in web.config appSettings
|
||||
var value = ConfigurationManager.AppSettings["umbracoConfigurationStatus"];
|
||||
return value.IsNullOrWhiteSpace() ? null : SemVersion.TryParse(value, out var semver) ? semver : null;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
public const string ThirdParty = "thirdPartyGroup";
|
||||
}
|
||||
|
||||
//TODO: Fill in the rest!
|
||||
// TODO: Fill in the rest!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Umbraco.Core
|
||||
{
|
||||
public static class Security
|
||||
{
|
||||
public const string UserMembershipProviderName = "UsersMembershipProvider";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the identifier of the 'super' user.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
namespace Umbraco.Core.Dashboards
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements <see cref="IAccessRule"/>.
|
||||
/// </summary>
|
||||
internal class AccessRule : IAccessRule
|
||||
public class AccessRule : IAccessRule
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public AccessRuleType Type { get; set; }
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
namespace Umbraco.Core.Dashboards
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines dashboard access rules type.
|
||||
12
src/Umbraco.Core/Dashboards/DashboardSlim.cs
Normal file
12
src/Umbraco.Core/Dashboards/DashboardSlim.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Core.Dashboards
|
||||
{
|
||||
[DataContract(IsReference = true)]
|
||||
public class DashboardSlim : IDashboardSlim
|
||||
{
|
||||
public string Alias { get; set; }
|
||||
|
||||
public string View { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Manifest;
|
||||
|
||||
namespace Umbraco.Core.Dashboards
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an access rule.
|
||||
38
src/Umbraco.Core/Dashboards/IDashboard.cs
Normal file
38
src/Umbraco.Core/Dashboards/IDashboard.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Composing;
|
||||
|
||||
namespace Umbraco.Core.Dashboards
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a dashboard.
|
||||
/// </summary>
|
||||
public interface IDashboard : IDashboardSlim, IDiscoverable
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the aliases of sections/applications where this dashboard appears.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This field is *not* needed by the UI and therefore we want to exclude
|
||||
/// it from serialization, but it is deserialized as part of the manifest,
|
||||
/// therefore we cannot plainly ignore it.</para>
|
||||
/// <para>So, it has to remain a data member, plus we use our special
|
||||
/// JsonDontSerialize attribute (see attribute for more details).</para>
|
||||
/// </remarks>
|
||||
[DataMember(Name = "sections")]
|
||||
string[] Sections { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the access rule determining the visibility of the dashboard.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This field is *not* needed by the UI and therefore we want to exclude
|
||||
/// it from serialization, but it is deserialized as part of the manifest,
|
||||
/// therefore we cannot plainly ignore it.</para>
|
||||
/// <para>So, it has to remain a data member, plus we use our special
|
||||
/// JsonDontSerialize attribute (see attribute for more details).</para>
|
||||
/// </remarks>
|
||||
[DataMember(Name = "access")]
|
||||
IAccessRule[] AccessRules { get; }
|
||||
}
|
||||
}
|
||||
22
src/Umbraco.Core/Dashboards/IDashboardSlim.cs
Normal file
22
src/Umbraco.Core/Dashboards/IDashboardSlim.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Core.Dashboards
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a dashboard with only minimal data.
|
||||
/// </summary>
|
||||
public interface IDashboardSlim
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the alias of the dashboard.
|
||||
/// </summary>
|
||||
[DataMember(Name = "alias")]
|
||||
string Alias { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the view used to render the dashboard.
|
||||
/// </summary>
|
||||
[DataMember(Name = "view")]
|
||||
string View { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Core.Deploy
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines methods that can convert a data type configurations to / from an environment-agnostic string.
|
||||
/// Defines methods that can convert data type configuration to / from an environment-agnostic string.
|
||||
/// </summary>
|
||||
/// <remarks>Configurations may contain values such as content identifiers, that would be local
|
||||
/// <remarks>Configuration may contain values such as content identifiers, that would be local
|
||||
/// to one environment, and need to be converted in order to be deployed.</remarks>
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "This is actual only used by Deploy, but we dont want third parties to have references on deploy, thats why this interface is part of core.")]
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "This is actual only used by Deploy, but we don't want third parties to have references on deploy, that's why this interface is part of core.")]
|
||||
public interface IDataTypeConfigurationConnector
|
||||
{
|
||||
/// <summary>
|
||||
@@ -17,18 +18,17 @@ namespace Umbraco.Core.Deploy
|
||||
IEnumerable<string> PropertyEditorAliases { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the environment-agnostic data type configurations corresponding to environment-specific configurations.
|
||||
/// Gets the artifact datatype configuration corresponding to the actual datatype configuration.
|
||||
/// </summary>
|
||||
/// <param name="configuration">The environment-specific configuration.</param>
|
||||
/// <param name="dataType">The datatype.</param>
|
||||
/// <param name="dependencies">The dependencies.</param>
|
||||
/// <returns></returns>
|
||||
IDictionary<string, string> ConvertToDeploy(IDictionary<string, string> configuration, ICollection<ArtifactDependency> dependencies);
|
||||
string ToArtifact(IDataType dataType, ICollection<ArtifactDependency> dependencies);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the environment-specific data type configurations corresponding to environment-agnostic configurations.
|
||||
/// Gets the actual datatype configuration corresponding to the artifact configuration.
|
||||
/// </summary>
|
||||
/// <param name="configuration">The environment-agnostic configuration.</param>
|
||||
/// <returns></returns>
|
||||
IDictionary<string, string> ConvertToLocalEnvironment(IDictionary<string, string> configuration);
|
||||
/// <param name="dataType">The datatype.</param>
|
||||
/// <param name="configuration">The artifact configuration.</param>
|
||||
object FromArtifact(IDataType dataType, string configuration);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Umbraco.Core
|
||||
/// </summary>
|
||||
public class EmailSender : IEmailSender
|
||||
{
|
||||
//TODO: This should encapsulate a BackgroundTaskRunner with a queue to send these emails!
|
||||
// TODO: This should encapsulate a BackgroundTaskRunner with a queue to send these emails!
|
||||
|
||||
private readonly bool _enableEvents;
|
||||
|
||||
|
||||
45
src/Umbraco.Core/EnumExtensions.cs
Normal file
45
src/Umbraco.Core/EnumExtensions.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides extension methods to enums.
|
||||
/// </summary>
|
||||
public static class EnumExtensions
|
||||
{
|
||||
// note:
|
||||
// - no need to HasFlagExact, that's basically an == test
|
||||
// - HasFlagAll cannot be named HasFlag because ext. methods never take priority over instance methods
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a flag enum has all the specified values.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>True when all bits set in <paramref name="uses"/> are set in <paramref name="use"/>, though other bits may be set too.</para>
|
||||
/// <para>This is the behavior of the original <see cref="Enum.HasFlag"/> method.</para>
|
||||
/// </remarks>
|
||||
public static bool HasFlagAll<T>(this T use, T uses)
|
||||
where T : Enum
|
||||
{
|
||||
var num = Convert.ToUInt64(use);
|
||||
var nums = Convert.ToUInt64(uses);
|
||||
|
||||
return (num & nums) == nums;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a flag enum has any of the specified values.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>True when at least one of the bits set in <paramref name="uses"/> is set in <paramref name="use"/>.</para>
|
||||
/// </remarks>
|
||||
public static bool HasFlagAny<T>(this T use, T uses)
|
||||
where T : Enum
|
||||
{
|
||||
var num = Convert.ToUInt64(use);
|
||||
var nums = Convert.ToUInt64(uses);
|
||||
|
||||
return (num & nums) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace Umbraco.Core.Events
|
||||
{
|
||||
if (ReferenceEquals(null, other)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
//TODO: MetaData for package metadata has no equality operators :/
|
||||
// TODO: MetaData for package metadata has no equality operators :/
|
||||
return base.Equals(other) && PackageMetaData.Equals(other.PackageMetaData);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Umbraco.Core.Events
|
||||
|
||||
private IMediaFileSystem _mediaFileSystem;
|
||||
|
||||
// todo: inject
|
||||
// TODO: inject
|
||||
private IMediaFileSystem MediaFileSystem => _mediaFileSystem ?? (_mediaFileSystem = Current.MediaFileSystem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Umbraco.Core.IO
|
||||
return Path.GetFileName(fs.GetFullPath(path));
|
||||
}
|
||||
|
||||
//TODO: Currently this is the only way to do this
|
||||
// TODO: Currently this is the only way to do this
|
||||
internal static void CreateFolder(this IFileSystem fs, string folderPath)
|
||||
{
|
||||
var path = fs.GetRelativePath(folderPath);
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace Umbraco.Core.IO
|
||||
_scriptsFileSystem = new ShadowWrapper(scriptsFileSystem, "scripts", IsScoped);
|
||||
_mvcViewsFileSystem = new ShadowWrapper(mvcViewsFileSystem, "Views", IsScoped);
|
||||
|
||||
// todo - do we need a lock here?
|
||||
// TODO: do we need a lock here?
|
||||
_shadowWrappers.Add(_macroPartialFileSystem);
|
||||
_shadowWrappers.Add(_partialViewsFileSystem);
|
||||
_shadowWrappers.Add(_stylesheetsFileSystem);
|
||||
|
||||
@@ -155,8 +155,7 @@ namespace Umbraco.Core.IO
|
||||
//
|
||||
// except that for templates, filePath actually is a virtual path
|
||||
|
||||
//TODO
|
||||
// what's below is dirty, there are too many ways to get the root dir, etc.
|
||||
// TODO: what's below is dirty, there are too many ways to get the root dir, etc.
|
||||
// not going to fix everything today
|
||||
|
||||
var mappedRoot = MapPath(SystemDirectories.Root);
|
||||
@@ -186,7 +185,7 @@ namespace Umbraco.Core.IO
|
||||
/// <param name="filePath">The filepath to validate.</param>
|
||||
/// <param name="validFileExtensions">The valid extensions.</param>
|
||||
/// <returns>A value indicating whether the filepath is valid.</returns>
|
||||
internal static bool VerifyFileExtension(string filePath, List<string> validFileExtensions)
|
||||
internal static bool VerifyFileExtension(string filePath, IEnumerable<string> validFileExtensions)
|
||||
{
|
||||
var ext = Path.GetExtension(filePath);
|
||||
return ext != null && validFileExtensions.Contains(ext.TrimStart('.'));
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Umbraco.Core.IO.MediaPathSchemes
|
||||
// prevpath should be "<int>/<filename>" OR "<int>-<filename>"
|
||||
// and we want to reuse the "<int>" part, so try to find it
|
||||
|
||||
var sep = Current.Configs.Settings().Content.UploadAllowDirectories ? "/" : "-";
|
||||
const string sep = "/";
|
||||
var pos = previous.IndexOf(sep, StringComparison.Ordinal);
|
||||
var s = pos > 0 ? previous.Substring(0, pos) : null;
|
||||
|
||||
@@ -45,9 +45,7 @@ namespace Umbraco.Core.IO.MediaPathSchemes
|
||||
if (directory == null)
|
||||
throw new InvalidOperationException("Cannot use a null directory.");
|
||||
|
||||
return Current.Configs.Settings().Content.UploadAllowDirectories
|
||||
? Path.Combine(directory, filename).Replace('\\', '/')
|
||||
: directory + "-" + filename;
|
||||
return Path.Combine(directory, filename).Replace('\\', '/');
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace Umbraco.Core.IO
|
||||
if (directory == null) throw new InvalidOperationException("Could not get directory.");
|
||||
Directory.CreateDirectory(directory); // ensure it exists
|
||||
|
||||
if (stream.CanSeek) // todo - what if we cannot?
|
||||
if (stream.CanSeek) // TODO: what if we cannot?
|
||||
stream.Seek(0, 0);
|
||||
|
||||
using (var destination = (Stream) File.Create(fullPath))
|
||||
@@ -284,7 +284,7 @@ namespace Umbraco.Core.IO
|
||||
var opath = path;
|
||||
path = EnsureDirectorySeparatorChar(path);
|
||||
|
||||
// fixme - this part should go!
|
||||
// FIXME: this part should go!
|
||||
// not sure what we are doing here - so if input starts with a (back) slash,
|
||||
// we assume it's not a FS relative path and we try to convert it... but it
|
||||
// really makes little sense?
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Web;
|
||||
|
||||
namespace Umbraco.Core.IO
|
||||
{
|
||||
@@ -36,12 +35,6 @@ namespace Umbraco.Core.IO
|
||||
|
||||
public static string Umbraco => IOHelper.ReturnPath("umbracoPath", "~/umbraco");
|
||||
|
||||
[Obsolete("Usercontrols are obsolete and code should be removed")]
|
||||
public static string UserControls => "~/usercontrols";
|
||||
|
||||
[Obsolete("Only used by legacy load balancing which is obsolete and should be removed")]
|
||||
public static string WebServices => IOHelper.ReturnPath("umbracoWebservicesPath", Umbraco.EnsureEndsWith("/") + "webservices");
|
||||
|
||||
public static string Packages => Data + "/packages";
|
||||
|
||||
public static string Preview => Data + "/preview";
|
||||
|
||||
@@ -7,14 +7,8 @@ namespace Umbraco.Core.IO
|
||||
{
|
||||
public class SystemFiles
|
||||
{
|
||||
public static string CreateUiXml => SystemDirectories.Umbraco + "/config/create/UI.xml";
|
||||
|
||||
public static string TinyMceConfig => SystemDirectories.Config + "/tinyMceConfig.config";
|
||||
|
||||
public static string NotFoundhandlersConfig => SystemDirectories.Config + "/404handlers.config";
|
||||
|
||||
public static string FeedProxyConfig => string.Concat(SystemDirectories.Config, "/feedProxy.config");
|
||||
|
||||
|
||||
public static string GetContentCacheXml(IGlobalSettings globalSettings)
|
||||
{
|
||||
switch (globalSettings.LocalTempStorageLocation)
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Umbraco.Core.Logging.Viewer
|
||||
{
|
||||
public void Compose(Composition composition)
|
||||
{
|
||||
composition.RegisterUnique<ILogViewer>(_ => new JsonLogViewer());
|
||||
composition.SetLogViewer(_ => new JsonLogViewer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Umbraco.Core.Configuration.Dashboard;
|
||||
using Umbraco.Core.Dashboards;
|
||||
using Umbraco.Core.Serialization;
|
||||
|
||||
namespace Umbraco.Core.Manifest
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.RegularExpressions;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.ContentEditing;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
|
||||
namespace Umbraco.Core.Manifest
|
||||
{
|
||||
@@ -30,6 +24,7 @@ namespace Umbraco.Core.Manifest
|
||||
/// <summary>
|
||||
/// Represents a content app definition, parsed from a manifest.
|
||||
/// </summary>
|
||||
/// <remarks>Is used to create an actual <see cref="ManifestContentAppFactory"/>.</remarks>
|
||||
[DataContract(Name = "appdef", Namespace = "")]
|
||||
public class ManifestContentAppDefinition
|
||||
{
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Configuration.Dashboard;
|
||||
using Umbraco.Core.Dashboards;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace Umbraco.Core.Manifest
|
||||
{
|
||||
public class ManifestDashboardDefinition
|
||||
public class ManifestDashboard : IDashboard
|
||||
{
|
||||
private string _view;
|
||||
|
||||
[JsonProperty("name", Required = Required.Always)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("alias", Required = Required.Always)]
|
||||
public string Alias { get; set; }
|
||||
|
||||
[JsonProperty("weight", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
|
||||
[DefaultValue(100)]
|
||||
[DefaultValue(100)] // must be equal to DashboardCollectionBuilder.DefaultWeight
|
||||
public int Weight { get; set; }
|
||||
|
||||
[JsonProperty("view", Required = Required.Always)]
|
||||
@@ -1,184 +1,182 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Exceptions;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models.ContentEditing;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Core.Manifest
|
||||
{
|
||||
/// <summary>
|
||||
/// Parses the Main.js file and replaces all tokens accordingly.
|
||||
/// </summary>
|
||||
public class ManifestParser
|
||||
{
|
||||
private static readonly string Utf8Preamble = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble());
|
||||
|
||||
private readonly IAppPolicyCache _cache;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ManifestValueValidatorCollection _validators;
|
||||
|
||||
private string _path;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ManifestParser"/> class.
|
||||
/// </summary>
|
||||
public ManifestParser(AppCaches appCaches, ManifestValueValidatorCollection validators, ILogger logger)
|
||||
: this(appCaches, validators, "~/App_Plugins", logger)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ManifestParser"/> class.
|
||||
/// </summary>
|
||||
private ManifestParser(AppCaches appCaches, ManifestValueValidatorCollection validators, string path, ILogger logger)
|
||||
{
|
||||
if (appCaches == null) throw new ArgumentNullException(nameof(appCaches));
|
||||
_cache = appCaches.RuntimeCache;
|
||||
_validators = validators ?? throw new ArgumentNullException(nameof(validators));
|
||||
if (string.IsNullOrWhiteSpace(path)) throw new ArgumentNullOrEmptyException(nameof(path));
|
||||
Path = path;
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
public string Path
|
||||
{
|
||||
get => _path;
|
||||
set => _path = value.StartsWith("~/") ? IOHelper.MapPath(value) : value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all manifests, merged into a single manifest object.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public PackageManifest Manifest
|
||||
=> _cache.GetCacheItem<PackageManifest>("Umbraco.Core.Manifest.ManifestParser::Manifests", () =>
|
||||
{
|
||||
var manifests = GetManifests();
|
||||
return MergeManifests(manifests);
|
||||
}, new TimeSpan(0, 4, 0));
|
||||
|
||||
/// <summary>
|
||||
/// Gets all manifests.
|
||||
/// </summary>
|
||||
private IEnumerable<PackageManifest> GetManifests()
|
||||
{
|
||||
var manifests = new List<PackageManifest>();
|
||||
|
||||
foreach (var path in GetManifestFiles())
|
||||
{
|
||||
try
|
||||
{
|
||||
var text = File.ReadAllText(path);
|
||||
text = TrimPreamble(text);
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
continue;
|
||||
var manifest = ParseManifest(text);
|
||||
manifests.Add(manifest);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Error<ManifestParser>(e, "Failed to parse manifest at '{Path}', ignoring.", path);
|
||||
}
|
||||
}
|
||||
|
||||
return manifests;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Merges all manifests into one.
|
||||
/// </summary>
|
||||
private static PackageManifest MergeManifests(IEnumerable<PackageManifest> manifests)
|
||||
{
|
||||
var scripts = new HashSet<string>();
|
||||
var stylesheets = new HashSet<string>();
|
||||
var propertyEditors = new List<IDataEditor>();
|
||||
var parameterEditors = new List<IDataEditor>();
|
||||
var gridEditors = new List<GridEditor>();
|
||||
var contentApps = new List<ManifestContentAppDefinition>();
|
||||
var dashboards = new List<ManifestDashboardDefinition>();
|
||||
var sections = new List<ManifestBackOfficeSection>();
|
||||
|
||||
foreach (var manifest in manifests)
|
||||
{
|
||||
if (manifest.Scripts != null) foreach (var script in manifest.Scripts) scripts.Add(script);
|
||||
if (manifest.Stylesheets != null) foreach (var stylesheet in manifest.Stylesheets) stylesheets.Add(stylesheet);
|
||||
if (manifest.PropertyEditors != null) propertyEditors.AddRange(manifest.PropertyEditors);
|
||||
if (manifest.ParameterEditors != null) parameterEditors.AddRange(manifest.ParameterEditors);
|
||||
if (manifest.GridEditors != null) gridEditors.AddRange(manifest.GridEditors);
|
||||
if (manifest.ContentApps != null) contentApps.AddRange(manifest.ContentApps);
|
||||
if (manifest.Dashboards != null) dashboards.AddRange(manifest.Dashboards);
|
||||
if (manifest.Sections != null) sections.AddRange(manifest.Sections.DistinctBy(x => x.Alias.ToLowerInvariant()));
|
||||
}
|
||||
|
||||
return new PackageManifest
|
||||
{
|
||||
Scripts = scripts.ToArray(),
|
||||
Stylesheets = stylesheets.ToArray(),
|
||||
PropertyEditors = propertyEditors.ToArray(),
|
||||
ParameterEditors = parameterEditors.ToArray(),
|
||||
GridEditors = gridEditors.ToArray(),
|
||||
ContentApps = contentApps.ToArray(),
|
||||
Dashboards = dashboards.ToArray(),
|
||||
Sections = sections.ToArray()
|
||||
};
|
||||
}
|
||||
|
||||
// gets all manifest files (recursively)
|
||||
private IEnumerable<string> GetManifestFiles()
|
||||
{
|
||||
if (Directory.Exists(_path) == false)
|
||||
return new string[0];
|
||||
return Directory.GetFiles(_path, "package.manifest", SearchOption.AllDirectories);
|
||||
}
|
||||
|
||||
private static string TrimPreamble(string text)
|
||||
{
|
||||
// strangely StartsWith(preamble) would always return true
|
||||
if (text.Substring(0, 1) == Utf8Preamble)
|
||||
text = text.Remove(0, Utf8Preamble.Length);
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses a manifest.
|
||||
/// </summary>
|
||||
internal PackageManifest ParseManifest(string text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
throw new ArgumentNullOrEmptyException(nameof(text));
|
||||
|
||||
var manifest = JsonConvert.DeserializeObject<PackageManifest>(text,
|
||||
new DataEditorConverter(_logger),
|
||||
new ValueValidatorConverter(_validators),
|
||||
new DashboardAccessRuleConverter());
|
||||
|
||||
// scripts and stylesheets are raw string, must process here
|
||||
for (var i = 0; i < manifest.Scripts.Length; i++)
|
||||
manifest.Scripts[i] = IOHelper.ResolveVirtualUrl(manifest.Scripts[i]);
|
||||
for (var i = 0; i < manifest.Stylesheets.Length; i++)
|
||||
manifest.Stylesheets[i] = IOHelper.ResolveVirtualUrl(manifest.Stylesheets[i]);
|
||||
|
||||
// add property editors that are also parameter editors, to the parameter editors list
|
||||
// (the manifest format is kinda legacy)
|
||||
var ppEditors = manifest.PropertyEditors.Where(x => (x.Type & EditorType.MacroParameter) > 0).ToList();
|
||||
if (ppEditors.Count > 0)
|
||||
manifest.ParameterEditors = manifest.ParameterEditors.Union(ppEditors).ToArray();
|
||||
|
||||
return manifest;
|
||||
}
|
||||
|
||||
// purely for tests
|
||||
internal IEnumerable<GridEditor> ParseGridEditors(string text)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<IEnumerable<GridEditor>>(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Exceptions;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Core.Manifest
|
||||
{
|
||||
/// <summary>
|
||||
/// Parses the Main.js file and replaces all tokens accordingly.
|
||||
/// </summary>
|
||||
public class ManifestParser
|
||||
{
|
||||
private static readonly string Utf8Preamble = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble());
|
||||
|
||||
private readonly IAppPolicyCache _cache;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ManifestValueValidatorCollection _validators;
|
||||
|
||||
private string _path;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ManifestParser"/> class.
|
||||
/// </summary>
|
||||
public ManifestParser(AppCaches appCaches, ManifestValueValidatorCollection validators, ILogger logger)
|
||||
: this(appCaches, validators, "~/App_Plugins", logger)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ManifestParser"/> class.
|
||||
/// </summary>
|
||||
private ManifestParser(AppCaches appCaches, ManifestValueValidatorCollection validators, string path, ILogger logger)
|
||||
{
|
||||
if (appCaches == null) throw new ArgumentNullException(nameof(appCaches));
|
||||
_cache = appCaches.RuntimeCache;
|
||||
_validators = validators ?? throw new ArgumentNullException(nameof(validators));
|
||||
if (string.IsNullOrWhiteSpace(path)) throw new ArgumentNullOrEmptyException(nameof(path));
|
||||
Path = path;
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
public string Path
|
||||
{
|
||||
get => _path;
|
||||
set => _path = value.StartsWith("~/") ? IOHelper.MapPath(value) : value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all manifests, merged into a single manifest object.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public PackageManifest Manifest
|
||||
=> _cache.GetCacheItem<PackageManifest>("Umbraco.Core.Manifest.ManifestParser::Manifests", () =>
|
||||
{
|
||||
var manifests = GetManifests();
|
||||
return MergeManifests(manifests);
|
||||
}, new TimeSpan(0, 4, 0));
|
||||
|
||||
/// <summary>
|
||||
/// Gets all manifests.
|
||||
/// </summary>
|
||||
private IEnumerable<PackageManifest> GetManifests()
|
||||
{
|
||||
var manifests = new List<PackageManifest>();
|
||||
|
||||
foreach (var path in GetManifestFiles())
|
||||
{
|
||||
try
|
||||
{
|
||||
var text = File.ReadAllText(path);
|
||||
text = TrimPreamble(text);
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
continue;
|
||||
var manifest = ParseManifest(text);
|
||||
manifests.Add(manifest);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Error<ManifestParser>(e, "Failed to parse manifest at '{Path}', ignoring.", path);
|
||||
}
|
||||
}
|
||||
|
||||
return manifests;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Merges all manifests into one.
|
||||
/// </summary>
|
||||
private static PackageManifest MergeManifests(IEnumerable<PackageManifest> manifests)
|
||||
{
|
||||
var scripts = new HashSet<string>();
|
||||
var stylesheets = new HashSet<string>();
|
||||
var propertyEditors = new List<IDataEditor>();
|
||||
var parameterEditors = new List<IDataEditor>();
|
||||
var gridEditors = new List<GridEditor>();
|
||||
var contentApps = new List<ManifestContentAppDefinition>();
|
||||
var dashboards = new List<ManifestDashboard>();
|
||||
var sections = new List<ManifestBackOfficeSection>();
|
||||
|
||||
foreach (var manifest in manifests)
|
||||
{
|
||||
if (manifest.Scripts != null) foreach (var script in manifest.Scripts) scripts.Add(script);
|
||||
if (manifest.Stylesheets != null) foreach (var stylesheet in manifest.Stylesheets) stylesheets.Add(stylesheet);
|
||||
if (manifest.PropertyEditors != null) propertyEditors.AddRange(manifest.PropertyEditors);
|
||||
if (manifest.ParameterEditors != null) parameterEditors.AddRange(manifest.ParameterEditors);
|
||||
if (manifest.GridEditors != null) gridEditors.AddRange(manifest.GridEditors);
|
||||
if (manifest.ContentApps != null) contentApps.AddRange(manifest.ContentApps);
|
||||
if (manifest.Dashboards != null) dashboards.AddRange(manifest.Dashboards);
|
||||
if (manifest.Sections != null) sections.AddRange(manifest.Sections.DistinctBy(x => x.Alias.ToLowerInvariant()));
|
||||
}
|
||||
|
||||
return new PackageManifest
|
||||
{
|
||||
Scripts = scripts.ToArray(),
|
||||
Stylesheets = stylesheets.ToArray(),
|
||||
PropertyEditors = propertyEditors.ToArray(),
|
||||
ParameterEditors = parameterEditors.ToArray(),
|
||||
GridEditors = gridEditors.ToArray(),
|
||||
ContentApps = contentApps.ToArray(),
|
||||
Dashboards = dashboards.ToArray(),
|
||||
Sections = sections.ToArray()
|
||||
};
|
||||
}
|
||||
|
||||
// gets all manifest files (recursively)
|
||||
private IEnumerable<string> GetManifestFiles()
|
||||
{
|
||||
if (Directory.Exists(_path) == false)
|
||||
return new string[0];
|
||||
return Directory.GetFiles(_path, "package.manifest", SearchOption.AllDirectories);
|
||||
}
|
||||
|
||||
private static string TrimPreamble(string text)
|
||||
{
|
||||
// strangely StartsWith(preamble) would always return true
|
||||
if (text.Substring(0, 1) == Utf8Preamble)
|
||||
text = text.Remove(0, Utf8Preamble.Length);
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses a manifest.
|
||||
/// </summary>
|
||||
internal PackageManifest ParseManifest(string text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
throw new ArgumentNullOrEmptyException(nameof(text));
|
||||
|
||||
var manifest = JsonConvert.DeserializeObject<PackageManifest>(text,
|
||||
new DataEditorConverter(_logger),
|
||||
new ValueValidatorConverter(_validators),
|
||||
new DashboardAccessRuleConverter());
|
||||
|
||||
// scripts and stylesheets are raw string, must process here
|
||||
for (var i = 0; i < manifest.Scripts.Length; i++)
|
||||
manifest.Scripts[i] = IOHelper.ResolveVirtualUrl(manifest.Scripts[i]);
|
||||
for (var i = 0; i < manifest.Stylesheets.Length; i++)
|
||||
manifest.Stylesheets[i] = IOHelper.ResolveVirtualUrl(manifest.Stylesheets[i]);
|
||||
|
||||
// add property editors that are also parameter editors, to the parameter editors list
|
||||
// (the manifest format is kinda legacy)
|
||||
var ppEditors = manifest.PropertyEditors.Where(x => (x.Type & EditorType.MacroParameter) > 0).ToList();
|
||||
if (ppEditors.Count > 0)
|
||||
manifest.ParameterEditors = manifest.ParameterEditors.Union(ppEditors).ToArray();
|
||||
|
||||
return manifest;
|
||||
}
|
||||
|
||||
// purely for tests
|
||||
internal IEnumerable<GridEditor> ParseGridEditors(string text)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<IEnumerable<GridEditor>>(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Umbraco.Core.Manifest
|
||||
/// Gets or sets the dashboards listed in the manifest.
|
||||
/// </summary>
|
||||
[JsonProperty("dashboards")]
|
||||
public ManifestDashboardDefinition[] Dashboards { get; set; } = Array.Empty<ManifestDashboardDefinition>();
|
||||
public ManifestDashboard[] Dashboards { get; set; } = Array.Empty<ManifestDashboard>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the sections listed in the manifest.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace Umbraco.Core.Media
|
||||
{
|
||||
|
||||
//TODO: Could definitely have done with a better name
|
||||
// TODO: Could definitely have done with a better name
|
||||
public class Result
|
||||
{
|
||||
public Status Status { get; set; }
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/// </summary>
|
||||
public interface IMigrationExpression
|
||||
{
|
||||
string Process(IMigrationContext context); // todo: remove that one?
|
||||
string Process(IMigrationContext context); // TODO: remove that one?
|
||||
void Execute();
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user