Makes some massive headway with the real config section, have got all code re-delegated to using it and have migrated the baserest config to the core project, all configs will be shared out of the UmbracoConfiguration singleton, now to get the unit tests all wired up and using mocks for the most part.
This commit is contained in:
@@ -107,25 +107,6 @@ namespace Umbraco.Core
|
||||
}
|
||||
}
|
||||
|
||||
public UmbracoConfiguration UmbracoConfiguration
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_umbracoConfiguration == null)
|
||||
{
|
||||
var umbracoSettings = ConfigurationManager.GetSection("umbracoConfiguration/settings") as IUmbracoSettings;
|
||||
if (umbracoSettings == null)
|
||||
{
|
||||
throw new InvalidOperationException("Could not find configuration section 'umbracoConfiguration/settings' or it does not cast to " + typeof (IUmbracoSettings));
|
||||
}
|
||||
|
||||
//create a new one if it is null
|
||||
_umbracoConfiguration = new UmbracoConfiguration(umbracoSettings);
|
||||
}
|
||||
return _umbracoConfiguration;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The original/first url that the web application executes
|
||||
/// </summary>
|
||||
|
||||
@@ -1,43 +1,45 @@
|
||||
using System.Configuration;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Web.BaseRest.Configuration
|
||||
{
|
||||
// note: the name should be "BaseRest" but we keep it "BaseRestSection" for compat. reasons.
|
||||
|
||||
[ConfigurationKey("BaseRestExtensions")]
|
||||
internal class BaseRestSection : UmbracoConfigurationSection
|
||||
{
|
||||
private const string KeyEnabled = "enabled";
|
||||
|
||||
private bool? _enabled;
|
||||
|
||||
internal protected override void ResetSection()
|
||||
{
|
||||
base.ResetSection();
|
||||
|
||||
_enabled = null;
|
||||
}
|
||||
|
||||
[ConfigurationProperty("", IsKey = false, IsRequired = false, IsDefaultCollection = true)]
|
||||
public ExtensionElementCollection Items
|
||||
{
|
||||
get { return (ExtensionElementCollection)base[""]; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether base rest extensions are enabled.
|
||||
/// </summary>
|
||||
[ConfigurationProperty(KeyEnabled, DefaultValue = true, IsRequired = false)]
|
||||
public bool Enabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _enabled ?? (IsPresent
|
||||
? (bool)this[KeyEnabled]
|
||||
: true);
|
||||
}
|
||||
internal set { _enabled = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.BaseRest
|
||||
{
|
||||
[ConfigurationKey("BaseRestExtensions")]
|
||||
internal class BaseRestSection : UmbracoConfigurationSection, IBaseRest
|
||||
{
|
||||
private const string KeyEnabled = "enabled";
|
||||
|
||||
private bool? _enabled;
|
||||
|
||||
internal protected override void ResetSection()
|
||||
{
|
||||
base.ResetSection();
|
||||
|
||||
_enabled = null;
|
||||
}
|
||||
|
||||
[ConfigurationProperty("", IsKey = false, IsRequired = false, IsDefaultCollection = true)]
|
||||
public ExtensionElementCollection Items
|
||||
{
|
||||
get { return (ExtensionElementCollection)base[""]; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether base rest extensions are enabled.
|
||||
/// </summary>
|
||||
[ConfigurationProperty(KeyEnabled, DefaultValue = true, IsRequired = false)]
|
||||
public bool Enabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _enabled ?? (IsPresent == false || (bool)this[KeyEnabled]);
|
||||
}
|
||||
internal set { _enabled = value; }
|
||||
}
|
||||
|
||||
IExtensionsCollection IBaseRest.Items
|
||||
{
|
||||
get { return Items; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,63 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Web.BaseRest.Configuration
|
||||
{
|
||||
[ConfigurationCollection(typeof(ExtensionElement), CollectionType = ConfigurationElementCollectionType.BasicMapAlternate)]
|
||||
public class ExtensionElement : ConfigurationElementCollection
|
||||
{
|
||||
const string KeyAlias = "alias";
|
||||
const string KeyType = "type";
|
||||
const string KeyMethod = "method";
|
||||
|
||||
[ConfigurationProperty(KeyAlias, IsKey = true, IsRequired = true)]
|
||||
public string Alias
|
||||
{
|
||||
get { return (string)base[KeyAlias]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(KeyType, IsKey = false, IsRequired = true)]
|
||||
public string Type
|
||||
{
|
||||
get { return (string)base[KeyType]; }
|
||||
}
|
||||
|
||||
public override ConfigurationElementCollectionType CollectionType
|
||||
{
|
||||
get { return ConfigurationElementCollectionType.BasicMapAlternate; }
|
||||
}
|
||||
|
||||
protected override string ElementName
|
||||
{
|
||||
get { return KeyMethod; }
|
||||
}
|
||||
|
||||
protected override bool IsElementName(string elementName)
|
||||
{
|
||||
return elementName.Equals(KeyMethod, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new MethodElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((MethodElement)element).Name;
|
||||
}
|
||||
|
||||
public override bool IsReadOnly()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
new public MethodElement this[string index]
|
||||
{
|
||||
get { return (MethodElement)BaseGet(index); }
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.BaseRest
|
||||
{
|
||||
|
||||
[ConfigurationCollection(typeof(ExtensionElement), CollectionType = ConfigurationElementCollectionType.BasicMapAlternate)]
|
||||
internal class ExtensionElement : ConfigurationElementCollection, IEnumerable<IMethod>, IExtension
|
||||
{
|
||||
const string KeyAlias = "alias";
|
||||
const string KeyType = "type";
|
||||
const string KeyMethod = "method";
|
||||
|
||||
[ConfigurationProperty(KeyAlias, IsKey = true, IsRequired = true)]
|
||||
public string Alias
|
||||
{
|
||||
get { return (string)base[KeyAlias]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(KeyType, IsKey = false, IsRequired = true)]
|
||||
public string Type
|
||||
{
|
||||
get { return (string)base[KeyType]; }
|
||||
}
|
||||
|
||||
public override ConfigurationElementCollectionType CollectionType
|
||||
{
|
||||
get { return ConfigurationElementCollectionType.BasicMapAlternate; }
|
||||
}
|
||||
|
||||
protected override string ElementName
|
||||
{
|
||||
get { return KeyMethod; }
|
||||
}
|
||||
|
||||
protected override bool IsElementName(string elementName)
|
||||
{
|
||||
return elementName.Equals(KeyMethod, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new MethodElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((MethodElement)element).Name;
|
||||
}
|
||||
|
||||
public override bool IsReadOnly()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
new public MethodElement this[string index]
|
||||
{
|
||||
get { return (MethodElement)BaseGet(index); }
|
||||
}
|
||||
|
||||
IEnumerator<IMethod> IEnumerable<IMethod>.GetEnumerator()
|
||||
{
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
yield return BaseGet(i) as IMethod;
|
||||
}
|
||||
}
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
IMethod IExtension.this[string index]
|
||||
{
|
||||
get { return this[index]; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Web.BaseRest.Configuration
|
||||
{
|
||||
[ConfigurationCollection(typeof(ExtensionElement), CollectionType = ConfigurationElementCollectionType.BasicMapAlternate)]
|
||||
public class ExtensionElementCollection : ConfigurationElementCollection
|
||||
{
|
||||
const string KeyExtension = "extension";
|
||||
|
||||
public override ConfigurationElementCollectionType CollectionType
|
||||
{
|
||||
get { return ConfigurationElementCollectionType.BasicMapAlternate; }
|
||||
}
|
||||
|
||||
protected override string ElementName
|
||||
{
|
||||
get { return KeyExtension; }
|
||||
}
|
||||
|
||||
protected override bool IsElementName(string elementName)
|
||||
{
|
||||
return elementName.Equals(KeyExtension, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new ExtensionElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((ExtensionElement)element).Alias;
|
||||
}
|
||||
|
||||
public override bool IsReadOnly()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
new public ExtensionElement this[string index]
|
||||
{
|
||||
get { return (ExtensionElement)BaseGet(index); }
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.BaseRest
|
||||
{
|
||||
public interface IExtensionsCollection : IEnumerable<IExtension>
|
||||
{
|
||||
IExtension this[string index] { get; }
|
||||
}
|
||||
|
||||
[ConfigurationCollection(typeof(ExtensionElement), CollectionType = ConfigurationElementCollectionType.BasicMapAlternate)]
|
||||
internal class ExtensionElementCollection : ConfigurationElementCollection, IExtensionsCollection
|
||||
{
|
||||
const string KeyExtension = "extension";
|
||||
|
||||
public override ConfigurationElementCollectionType CollectionType
|
||||
{
|
||||
get { return ConfigurationElementCollectionType.BasicMapAlternate; }
|
||||
}
|
||||
|
||||
protected override string ElementName
|
||||
{
|
||||
get { return KeyExtension; }
|
||||
}
|
||||
|
||||
protected override bool IsElementName(string elementName)
|
||||
{
|
||||
return elementName.Equals(KeyExtension, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new ExtensionElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((ExtensionElement)element).Alias;
|
||||
}
|
||||
|
||||
public override bool IsReadOnly()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
new public ExtensionElement this[string index]
|
||||
{
|
||||
get { return (ExtensionElement)BaseGet(index); }
|
||||
}
|
||||
|
||||
IEnumerator<IExtension> IEnumerable<IExtension>.GetEnumerator()
|
||||
{
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
yield return BaseGet(i) as IExtension;
|
||||
}
|
||||
}
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
IExtension IExtensionsCollection.this[string index]
|
||||
{
|
||||
get { return this[index]; }
|
||||
}
|
||||
}
|
||||
}
|
||||
14
src/Umbraco.Core/Configuration/BaseRest/IBaseRest.cs
Normal file
14
src/Umbraco.Core/Configuration/BaseRest/IBaseRest.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Configuration.BaseRest
|
||||
{
|
||||
public interface IBaseRest
|
||||
{
|
||||
IExtensionsCollection Items { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether base rest extensions are enabled.
|
||||
/// </summary>
|
||||
bool Enabled { get; }
|
||||
}
|
||||
}
|
||||
11
src/Umbraco.Core/Configuration/BaseRest/IExtension.cs
Normal file
11
src/Umbraco.Core/Configuration/BaseRest/IExtension.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Umbraco.Core.Configuration.BaseRest
|
||||
{
|
||||
public interface IExtension
|
||||
{
|
||||
string Alias { get; }
|
||||
|
||||
string Type { get; }
|
||||
|
||||
IMethod this[string index] { get; }
|
||||
}
|
||||
}
|
||||
17
src/Umbraco.Core/Configuration/BaseRest/IMethod.cs
Normal file
17
src/Umbraco.Core/Configuration/BaseRest/IMethod.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Umbraco.Core.Configuration.BaseRest
|
||||
{
|
||||
public interface IMethod
|
||||
{
|
||||
string Name { get; }
|
||||
|
||||
bool AllowAll { get; }
|
||||
|
||||
string AllowGroup { get; }
|
||||
|
||||
string AllowType { get; }
|
||||
|
||||
string AllowMember { get; }
|
||||
|
||||
bool ReturnXml { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,50 +1,50 @@
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Web.BaseRest.Configuration
|
||||
{
|
||||
public class MethodElement : ConfigurationElement
|
||||
{
|
||||
const string KeyName = "name";
|
||||
const string KeyAllowAll = "allowAll";
|
||||
const string KeyAllowGroup = "allowGroup";
|
||||
const string KeyAllowType = "allowType";
|
||||
const string KeyAllowMember = "allowMember";
|
||||
const string KeyReturnXml = "returnXml";
|
||||
|
||||
[ConfigurationProperty(KeyName, IsKey = true, IsRequired = true)]
|
||||
public string Name
|
||||
{
|
||||
get { return (string)base[KeyName]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(KeyAllowAll, IsKey = false, IsRequired = false, DefaultValue = false)]
|
||||
public bool AllowAll
|
||||
{
|
||||
get { return (bool)base[KeyAllowAll]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(KeyAllowGroup, IsKey = false, IsRequired = false, DefaultValue = null)]
|
||||
public string AllowGroup
|
||||
{
|
||||
get { return (string)base[KeyAllowGroup]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(KeyAllowType, IsKey = false, IsRequired = false, DefaultValue = null)]
|
||||
public string AllowType
|
||||
{
|
||||
get { return (string)base[KeyAllowType]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(KeyAllowMember, IsKey = false, IsRequired = false, DefaultValue = null)]
|
||||
public string AllowMember
|
||||
{
|
||||
get { return (string)base[KeyAllowMember]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(KeyReturnXml, IsKey = false, IsRequired = false, DefaultValue = true)]
|
||||
public bool ReturnXml
|
||||
{
|
||||
get { return (bool)base[KeyReturnXml]; }
|
||||
}
|
||||
}
|
||||
}
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.BaseRest
|
||||
{
|
||||
internal class MethodElement : ConfigurationElement, IMethod
|
||||
{
|
||||
const string KeyName = "name";
|
||||
const string KeyAllowAll = "allowAll";
|
||||
const string KeyAllowGroup = "allowGroup";
|
||||
const string KeyAllowType = "allowType";
|
||||
const string KeyAllowMember = "allowMember";
|
||||
const string KeyReturnXml = "returnXml";
|
||||
|
||||
[ConfigurationProperty(KeyName, IsKey = true, IsRequired = true)]
|
||||
public string Name
|
||||
{
|
||||
get { return (string)base[KeyName]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(KeyAllowAll, IsKey = false, IsRequired = false, DefaultValue = false)]
|
||||
public bool AllowAll
|
||||
{
|
||||
get { return (bool)base[KeyAllowAll]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(KeyAllowGroup, IsKey = false, IsRequired = false, DefaultValue = null)]
|
||||
public string AllowGroup
|
||||
{
|
||||
get { return (string)base[KeyAllowGroup]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(KeyAllowType, IsKey = false, IsRequired = false, DefaultValue = null)]
|
||||
public string AllowType
|
||||
{
|
||||
get { return (string)base[KeyAllowType]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(KeyAllowMember, IsKey = false, IsRequired = false, DefaultValue = null)]
|
||||
public string AllowMember
|
||||
{
|
||||
get { return (string)base[KeyAllowMember]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(KeyReturnXml, IsKey = false, IsRequired = false, DefaultValue = true)]
|
||||
public bool ReturnXml
|
||||
{
|
||||
get { return (bool)base[KeyReturnXml]; }
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,7 @@ namespace Umbraco.Core.Configuration
|
||||
|
||||
internal class RazorDataTypeModelStaticMappingItem
|
||||
{
|
||||
[Obsolete("This is not used whatsoever")]
|
||||
public string Raw { get; set; }
|
||||
//if all of the set (non null) properties match the property data currently being evaluated
|
||||
public string PropertyTypeAlias { get; set; }
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using Umbraco.Core.Configuration.BaseRest;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
|
||||
namespace Umbraco.Core.Configuration
|
||||
{
|
||||
@@ -7,13 +10,45 @@ namespace Umbraco.Core.Configuration
|
||||
/// </summary>
|
||||
public class UmbracoConfiguration
|
||||
{
|
||||
//TODO: Add other configurations here !
|
||||
#region Singleton
|
||||
|
||||
public IUmbracoSettings UmbracoSettings { get; private set; }
|
||||
private static readonly Lazy<UmbracoConfiguration> Lazy = new Lazy<UmbracoConfiguration>(() => new UmbracoConfiguration());
|
||||
|
||||
public UmbracoConfiguration(IUmbracoSettings umbracoSettings)
|
||||
public static UmbracoConfiguration Current { get { return Lazy.Value; } }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
private UmbracoConfiguration()
|
||||
{
|
||||
if (UmbracoSettings == null)
|
||||
{
|
||||
var umbracoSettings = ConfigurationManager.GetSection("umbracoConfiguration/settings") as IUmbracoSettings;
|
||||
if (umbracoSettings == null)
|
||||
{
|
||||
throw new InvalidOperationException("Could not find configuration section 'umbracoConfiguration/settings' or it does not cast to " + typeof(IUmbracoSettings));
|
||||
}
|
||||
UmbracoSettings = umbracoSettings;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor - can be used for testing
|
||||
/// </summary>
|
||||
/// <param name="umbracoSettings"></param>
|
||||
/// <param name="baseRestSettings"></param>
|
||||
public UmbracoConfiguration(IUmbracoSettings umbracoSettings, IBaseRest baseRestSettings)
|
||||
{
|
||||
UmbracoSettings = umbracoSettings;
|
||||
BaseRestExtensions = baseRestSettings;
|
||||
}
|
||||
|
||||
public IUmbracoSettings UmbracoSettings { get; private set; }
|
||||
|
||||
public IBaseRest BaseRestExtensions { get; private set; }
|
||||
|
||||
//TODO: Add other configurations here !
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class AppCodeFileExtensionsElement : ConfigurationElement, IAppCodeFileExtensions
|
||||
internal class AppCodeFileExtensionsElement : ConfigurationElement
|
||||
{
|
||||
[ConfigurationCollection(typeof(AppCodeFileExtensionsCollection), AddItemName = "ext")]
|
||||
[ConfigurationProperty("", IsDefaultCollection = true)]
|
||||
@@ -13,9 +13,5 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
set { base[""] = value; }
|
||||
}
|
||||
|
||||
IEnumerable<IFileExtension> IAppCodeFileExtensions.AppCodeFileExtensions
|
||||
{
|
||||
get { return AppCodeFileExtensionsCollection; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -379,12 +379,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
get { return UmbracoLibraryCacheDuration; }
|
||||
}
|
||||
|
||||
MacroErrorBehaviour IContent.MacroErrors
|
||||
MacroErrorBehaviour IContent.MacroErrorBehaviour
|
||||
{
|
||||
get { return MacroErrors; }
|
||||
}
|
||||
|
||||
IconPickerBehaviour IContent.DocumentTypeIconList
|
||||
IconPickerBehaviour IContent.IconPickerBehaviour
|
||||
{
|
||||
get { return DocumentTypeIconList; }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
@@ -38,9 +39,9 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
}
|
||||
}
|
||||
|
||||
IAppCodeFileExtensions IDeveloper.AppCodeFileExtensions
|
||||
IEnumerable<IFileExtension> IDeveloper.AppCodeFileExtensions
|
||||
{
|
||||
get { return AppCodeFileExtensions; }
|
||||
get { return AppCodeFileExtensions.AppCodeFileExtensionsCollection; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
get { return UserId; }
|
||||
}
|
||||
|
||||
IEnumerable<IServerElement> IDistributedCall.Servers
|
||||
IEnumerable<IServer> IDistributedCall.Servers
|
||||
{
|
||||
get { return Servers; }
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
get { return Assembly; }
|
||||
}
|
||||
|
||||
string IExternalLogger.Type
|
||||
string IExternalLogger.ExternalLoggerType
|
||||
{
|
||||
get { return Type; }
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public interface IAppCodeFileExtensions
|
||||
{
|
||||
IEnumerable<IFileExtension> AppCodeFileExtensions { get; }
|
||||
}
|
||||
}
|
||||
@@ -42,9 +42,9 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
|
||||
int UmbracoLibraryCacheDuration { get; }
|
||||
|
||||
MacroErrorBehaviour MacroErrors { get; }
|
||||
MacroErrorBehaviour MacroErrorBehaviour { get; }
|
||||
|
||||
IconPickerBehaviour DocumentTypeIconList { get; }
|
||||
IconPickerBehaviour IconPickerBehaviour { get; }
|
||||
|
||||
IEnumerable<string> DisallowedUploadFiles { get; }
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public interface IDeveloper
|
||||
{
|
||||
IAppCodeFileExtensions AppCodeFileExtensions { get; }
|
||||
IEnumerable<IFileExtension> AppCodeFileExtensions { get; }
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
|
||||
int UserId { get; }
|
||||
|
||||
IEnumerable<IServerElement> Servers { get; }
|
||||
IEnumerable<IServer> Servers { get; }
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
string Assembly { get; }
|
||||
|
||||
string Type { get; }
|
||||
string ExternalLoggerType { get; }
|
||||
|
||||
bool LogAuditTrail { get; }
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
Guid DataTypeGuid { get; }
|
||||
string NodeTypeAlias { get; }
|
||||
string DocumentTypeAlias { get; }
|
||||
string PropertyTypeAlias { get; }
|
||||
string MappingName { get; }
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
//TODO: Where do we put the 'package server' setting?
|
||||
|
||||
public interface IRepositories
|
||||
{
|
||||
IEnumerable<IRepository> Repositories { get; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public interface IServerElement
|
||||
public interface IServer
|
||||
{
|
||||
string ForcePortnumber { get; }
|
||||
string ForceProtocol { get; }
|
||||
@@ -5,5 +5,8 @@
|
||||
bool TrySkipIisCustomErrors { get; }
|
||||
|
||||
bool InternalRedirectPreservesTemplate { get; }
|
||||
|
||||
string UrlProviderMode { get; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
return ((RazorStaticMappingElement) element).DataTypeGuid
|
||||
+ ((RazorStaticMappingElement) element).NodeTypeAlias
|
||||
+ ((RazorStaticMappingElement) element).DocumentTypeAlias;
|
||||
+ ((RazorStaticMappingElement) element).PropertyTypeAlias;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,13 +24,13 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
}
|
||||
}
|
||||
|
||||
public string DocumentTypeAlias
|
||||
public string PropertyTypeAlias
|
||||
{
|
||||
get
|
||||
{
|
||||
return RawXml.Attribute("documentTypeAlias") == null
|
||||
return RawXml.Attribute("propertyTypeAlias") == null
|
||||
? null
|
||||
: RawXml.Attribute("documentTypeAlias").Value;
|
||||
: RawXml.Attribute("propertyTypeAlias").Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class ServerCollection : ConfigurationElementCollection, IEnumerable<IServerElement>
|
||||
internal class ServerCollection : ConfigurationElementCollection, IEnumerable<IServer>
|
||||
{
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
@@ -15,11 +15,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
return ((ServerElement)element).Value;
|
||||
}
|
||||
|
||||
IEnumerator<IServerElement> IEnumerable<IServerElement>.GetEnumerator()
|
||||
IEnumerator<IServer> IEnumerable<IServer>.GetEnumerator()
|
||||
{
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
yield return BaseGet(i) as IServerElement;
|
||||
yield return BaseGet(i) as IServer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class ServerElement : InnerTextConfigurationElement<string>, IServerElement
|
||||
internal class ServerElement : InnerTextConfigurationElement<string>, IServer
|
||||
{
|
||||
public string ForcePortnumber
|
||||
{
|
||||
@@ -22,7 +22,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
string IServerElement.ServerAddress
|
||||
string IServer.ServerAddress
|
||||
{
|
||||
get { return Value; }
|
||||
}
|
||||
|
||||
@@ -16,5 +16,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
get { return (bool) base["internalRedirectPreservesTemplate"]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("urlProviderMode", DefaultValue = "Auto")]
|
||||
public string UrlProviderMode
|
||||
{
|
||||
get { return (string)base["urlProviderMode"]; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ namespace Umbraco.Core.IO
|
||||
[Obsolete("Use Umbraco.Web.Templates.TemplateUtilities.ResolveUrlsFromTextString instead, this method on this class will be removed in future versions")]
|
||||
internal static string ResolveUrlsFromTextString(string text)
|
||||
{
|
||||
if (LegacyUmbracoSettings.ResolveUrlsFromTextString)
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Content.ResolveUrlsFromTextString)
|
||||
{
|
||||
using (var timer = DisposableTimer.DebugDuration(typeof(IOHelper), "ResolveUrlsFromTextString starting", "ResolveUrlsFromTextString complete"))
|
||||
{
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
|
||||
namespace Umbraco.Core.IO
|
||||
{
|
||||
@@ -11,23 +13,30 @@ namespace Umbraco.Core.IO
|
||||
[FileSystemProvider("media")]
|
||||
public class MediaFileSystem : FileSystemWrapper
|
||||
{
|
||||
public MediaFileSystem(IFileSystem wrapped)
|
||||
: base(wrapped)
|
||||
private readonly IContent _contentConfig;
|
||||
|
||||
public MediaFileSystem(IFileSystem wrapped)
|
||||
: this(wrapped, UmbracoConfiguration.Current.UmbracoSettings.Content)
|
||||
{
|
||||
}
|
||||
|
||||
public string GetRelativePath(int propertyId, string fileName)
|
||||
public MediaFileSystem(IFileSystem wrapped, IContent contentConfig) : base(wrapped)
|
||||
{
|
||||
_contentConfig = contentConfig;
|
||||
}
|
||||
|
||||
public string GetRelativePath(int propertyId, string fileName)
|
||||
{
|
||||
var seperator = LegacyUmbracoSettings.UploadAllowDirectories
|
||||
var seperator = _contentConfig.UploadAllowDirectories
|
||||
? Path.DirectorySeparatorChar
|
||||
: '-';
|
||||
|
||||
return propertyId.ToString() + seperator + fileName;
|
||||
return propertyId.ToString(CultureInfo.InvariantCulture) + seperator + fileName;
|
||||
}
|
||||
|
||||
public string GetRelativePath(string subfolder, string fileName)
|
||||
{
|
||||
var seperator = LegacyUmbracoSettings.UploadAllowDirectories
|
||||
var seperator = _contentConfig.UploadAllowDirectories
|
||||
? Path.DirectorySeparatorChar
|
||||
: '-';
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace Umbraco.Core.IO
|
||||
{
|
||||
get
|
||||
{
|
||||
return ("," + LegacyUmbracoSettings.ImageFileTypes + ",").Contains(string.Format(",{0},", Extension));
|
||||
return UmbracoConfiguration.Current.UmbracoSettings.Content.Imaging.ImageFileTypes.InvariantContains(Extension);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Web;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Media;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
@@ -402,7 +403,7 @@ namespace Umbraco.Core.Models
|
||||
return;
|
||||
|
||||
var numberedFolder = MediaSubfolderCounter.Current.Increment();
|
||||
var fileName = LegacyUmbracoSettings.UploadAllowDirectories
|
||||
var fileName = UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories
|
||||
? Path.Combine(numberedFolder.ToString(CultureInfo.InvariantCulture), name)
|
||||
: numberedFolder + "-" + name;
|
||||
|
||||
@@ -415,17 +416,17 @@ namespace Umbraco.Core.Models
|
||||
fs.AddFile(fileName, fileStream);
|
||||
|
||||
//Check if file supports resizing and create thumbnails
|
||||
var supportsResizing = ("," + LegacyUmbracoSettings.ImageFileTypes + ",").Contains(string.Format(",{0},", extension));
|
||||
var supportsResizing = UmbracoConfiguration.Current.UmbracoSettings.Content.Imaging.ImageFileTypes.InvariantContains(extension);
|
||||
|
||||
//the config section used to auto-fill properties
|
||||
XmlNode uploadFieldConfigNode = null;
|
||||
IContentImagingAutoFillUploadField uploadFieldConfigNode = null;
|
||||
|
||||
//Check for auto fill of additional properties
|
||||
if (LegacyUmbracoSettings.ImageAutoFillImageProperties != null)
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Content.Imaging.ImageAutoFillProperties != null)
|
||||
{
|
||||
uploadFieldConfigNode =
|
||||
LegacyUmbracoSettings.ImageAutoFillImageProperties.SelectSingleNode(
|
||||
string.Format("uploadField [@alias = \"{0}\"]", propertyTypeAlias));
|
||||
uploadFieldConfigNode = UmbracoConfiguration.Current.UmbracoSettings.Content.Imaging.ImageAutoFillProperties
|
||||
.Single(x => x.Alias == propertyTypeAlias);
|
||||
|
||||
}
|
||||
|
||||
if (supportsResizing)
|
||||
@@ -462,8 +463,8 @@ namespace Umbraco.Core.Models
|
||||
//while the image is still open, we'll check if we need to auto-populate the image properties
|
||||
if (uploadFieldConfigNode != null)
|
||||
{
|
||||
SetPropertyValue(content, uploadFieldConfigNode, "widthFieldAlias", originalImage.Width.ToString(CultureInfo.InvariantCulture));
|
||||
SetPropertyValue(content, uploadFieldConfigNode, "heightFieldAlias", originalImage.Height.ToString(CultureInfo.InvariantCulture));
|
||||
content.SetValue(uploadFieldConfigNode.WidthFieldAlias, originalImage.Width.ToString(CultureInfo.InvariantCulture));
|
||||
content.SetValue(uploadFieldConfigNode.HeightFieldAlias, originalImage.Height.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -472,23 +473,14 @@ namespace Umbraco.Core.Models
|
||||
//if auto-fill is true, then fill the remaining, non-image properties
|
||||
if (uploadFieldConfigNode != null)
|
||||
{
|
||||
SetPropertyValue(content, uploadFieldConfigNode, "lengthFieldAlias", fileSize.ToString(CultureInfo.InvariantCulture));
|
||||
SetPropertyValue(content, uploadFieldConfigNode, "extensionFieldAlias", extension);
|
||||
content.SetValue(uploadFieldConfigNode.LengthFieldAlias, fileSize.ToString(CultureInfo.InvariantCulture));
|
||||
content.SetValue(uploadFieldConfigNode.ExtensionFieldAlias, extension);
|
||||
}
|
||||
|
||||
//Set the value of the property to that of the uploaded file's url
|
||||
property.Value = fs.GetUrl(fileName);
|
||||
}
|
||||
|
||||
private static void SetPropertyValue(IContentBase content, XmlNode uploadFieldConfigNode, string propertyAlias, string propertyValue)
|
||||
{
|
||||
XmlNode propertyNode = uploadFieldConfigNode.SelectSingleNode(propertyAlias);
|
||||
if (propertyNode != null && string.IsNullOrEmpty(propertyNode.FirstChild.Value) == false && content.HasProperty(propertyNode.FirstChild.Value))
|
||||
{
|
||||
content.SetValue(propertyNode.FirstChild.Value, propertyValue);
|
||||
}
|
||||
}
|
||||
|
||||
private static ResizedImage Resize(MediaFileSystem fileSystem, string path, string extension, int maxWidthHeight, string fileNameAddition, Image originalImage)
|
||||
{
|
||||
var fileNameThumb = String.IsNullOrEmpty(fileNameAddition)
|
||||
|
||||
@@ -22,13 +22,13 @@ namespace Umbraco.Core.Models
|
||||
|
||||
internal static XElement ToXml(this Property property, IDataTypeService dataTypeService)
|
||||
{
|
||||
var nodeName = LegacyUmbracoSettings.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias();
|
||||
var nodeName = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias();
|
||||
|
||||
var xd = new XmlDocument();
|
||||
var xmlNode = xd.CreateNode(XmlNodeType.Element, nodeName, "");
|
||||
|
||||
//Add the property alias to the legacy schema
|
||||
if (LegacyUmbracoSettings.UseLegacyXmlSchema)
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema)
|
||||
{
|
||||
var alias = xd.CreateAttribute("alias");
|
||||
alias.Value = property.Alias.ToSafeAlias();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
@@ -13,8 +14,18 @@ namespace Umbraco.Core.Models
|
||||
[DataContract(IsReference = true)]
|
||||
public class Script : File
|
||||
{
|
||||
public Script(string path) : base(path)
|
||||
private readonly IContentScriptEditor _scriptEditorConfig;
|
||||
|
||||
public Script(string path)
|
||||
: this(path, UmbracoConfiguration.Current.UmbracoSettings.Content.ScriptEditor)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Script(string path, IContentScriptEditor scriptEditorConfig)
|
||||
: base(path)
|
||||
{
|
||||
_scriptEditorConfig = scriptEditorConfig;
|
||||
base.Path = path;
|
||||
}
|
||||
|
||||
@@ -33,7 +44,7 @@ namespace Umbraco.Core.Models
|
||||
//into 4 private methods.
|
||||
//See codeEditorSave.asmx.cs for reference.
|
||||
|
||||
var exts = LegacyUmbracoSettings.ScriptFileTypes.Split(',').ToList();
|
||||
var exts = _scriptEditorConfig.ScriptFileTypes.ToList();
|
||||
/*if (UmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc)
|
||||
{
|
||||
exts.Add("cshtml");
|
||||
|
||||
@@ -157,18 +157,18 @@ namespace Umbraco.Core.Models
|
||||
public override bool IsValid()
|
||||
{
|
||||
var exts = new List<string>();
|
||||
if (LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc)
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc)
|
||||
{
|
||||
exts.Add("cshtml");
|
||||
exts.Add("vbhtml");
|
||||
}
|
||||
else
|
||||
{
|
||||
exts.Add(LegacyUmbracoSettings.UseAspNetMasterPages ? "master" : "aspx");
|
||||
exts.Add(UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages ? "master" : "aspx");
|
||||
}
|
||||
|
||||
var dirs = SystemDirectories.Masterpages;
|
||||
if (LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc)
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc)
|
||||
dirs += "," + SystemDirectories.MvcViews;
|
||||
|
||||
//Validate file
|
||||
|
||||
@@ -441,7 +441,7 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
var parentDirectory = System.IO.Path.GetDirectoryName(relativeFilePath);
|
||||
|
||||
// don't want to delete the media folder if not using directories.
|
||||
if (LegacyUmbracoSettings.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/"))
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/"))
|
||||
{
|
||||
//issue U4-771: if there is a parent directory the recursive parameter should be true
|
||||
fs.DeleteDirectory(parentDirectory, String.IsNullOrEmpty(parentDirectory) == false);
|
||||
|
||||
@@ -342,7 +342,7 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
var parentDirectory = System.IO.Path.GetDirectoryName(relativeFilePath);
|
||||
|
||||
// don't want to delete the media folder if not using directories.
|
||||
if (LegacyUmbracoSettings.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/"))
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/"))
|
||||
{
|
||||
//issue U4-771: if there is a parent directory the recursive parameter should be true
|
||||
fs.DeleteDirectory(parentDirectory, String.IsNullOrEmpty(parentDirectory) == false);
|
||||
|
||||
@@ -345,7 +345,7 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
var parentDirectory = System.IO.Path.GetDirectoryName(relativeFilePath);
|
||||
|
||||
// don't want to delete the media folder if not using directories.
|
||||
if (LegacyUmbracoSettings.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/"))
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/"))
|
||||
{
|
||||
//issue U4-771: if there is a parent directory the recursive parameter should be true
|
||||
fs.DeleteDirectory(parentDirectory, String.IsNullOrEmpty(parentDirectory) == false);
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
var fs = FileSystemProviderManager.Current.GetFileSystemProvider<MediaFileSystem>();
|
||||
Parallel.ForEach(files, file =>
|
||||
{
|
||||
if (LegacyUmbracoSettings.UploadAllowDirectories)
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories)
|
||||
{
|
||||
var relativeFilePath = fs.GetRelativePath(file);
|
||||
var parentDirectory = System.IO.Path.GetDirectoryName(relativeFilePath);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Persistence.Caching;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
using Umbraco.Core.Persistence.UnitOfWork;
|
||||
@@ -9,13 +11,26 @@ namespace Umbraco.Core.Persistence
|
||||
/// </summary>
|
||||
public class RepositoryFactory
|
||||
{
|
||||
private readonly IUmbracoSettings _settings;
|
||||
|
||||
public RepositoryFactory(IUmbracoSettings settings)
|
||||
{
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
public RepositoryFactory()
|
||||
: this(UmbracoConfiguration.Current.UmbracoSettings)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual IContentRepository CreateContentRepository(IDatabaseUnitOfWork uow)
|
||||
{
|
||||
return new ContentRepository(
|
||||
uow,
|
||||
RuntimeCacheProvider.Current,
|
||||
CreateContentTypeRepository(uow),
|
||||
CreateTemplateRepository(uow)) { EnsureUniqueNaming = Umbraco.Core.Configuration.LegacyUmbracoSettings.EnsureUniqueNaming };
|
||||
CreateTemplateRepository(uow)) { EnsureUniqueNaming = _settings.Content.EnsureUniqueNaming };
|
||||
}
|
||||
|
||||
public virtual IContentTypeRepository CreateContentTypeRepository(IDatabaseUnitOfWork uow)
|
||||
@@ -53,7 +68,7 @@ namespace Umbraco.Core.Persistence
|
||||
return new MediaRepository(
|
||||
uow,
|
||||
RuntimeCacheProvider.Current,
|
||||
CreateMediaTypeRepository(uow)) { EnsureUniqueNaming = Umbraco.Core.Configuration.LegacyUmbracoSettings.EnsureUniqueNaming };
|
||||
CreateMediaTypeRepository(uow)) { EnsureUniqueNaming = _settings.Content.EnsureUniqueNaming };
|
||||
}
|
||||
|
||||
public virtual IMediaTypeRepository CreateMediaTypeRepository(IDatabaseUnitOfWork uow)
|
||||
|
||||
@@ -174,8 +174,8 @@ namespace Umbraco.Core
|
||||
var documentElement = e.Name.LocalName;
|
||||
|
||||
//TODO: See note against this setting, pretty sure we don't need this
|
||||
if (!LegacyUmbracoSettings.NotDynamicXmlDocumentElements.Any(
|
||||
tag => string.Equals(tag, documentElement, StringComparison.CurrentCultureIgnoreCase)))
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Scripting.Razor.NotDynamicXmlDocumentElements.Any(
|
||||
tag => string.Equals(tag.Element, documentElement, StringComparison.CurrentCultureIgnoreCase)) == false)
|
||||
{
|
||||
return new Attempt<object>(true, new DynamicXml(e));
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Umbraco.Core.Security
|
||||
/// </summary>
|
||||
public static void UmbracoLogout(this HttpContextBase http)
|
||||
{
|
||||
Logout(http, LegacyUmbracoSettings.AuthCookieName);
|
||||
Logout(http, UmbracoConfiguration.Current.UmbracoSettings.Security.AuthCookieName);
|
||||
}
|
||||
|
||||
internal static void UmbracoLogout(this HttpContext http)
|
||||
@@ -42,7 +42,10 @@ namespace Umbraco.Core.Security
|
||||
/// <returns></returns>
|
||||
public static bool RenewUmbracoAuthTicket(this HttpContextBase http, int timeoutInMinutes = 60)
|
||||
{
|
||||
return RenewAuthTicket(http, LegacyUmbracoSettings.AuthCookieName, LegacyUmbracoSettings.AuthCookieDomain, timeoutInMinutes);
|
||||
return RenewAuthTicket(http,
|
||||
UmbracoConfiguration.Current.UmbracoSettings.Security.AuthCookieName,
|
||||
UmbracoConfiguration.Current.UmbracoSettings.Security.AuthCookieDomain,
|
||||
timeoutInMinutes);
|
||||
}
|
||||
|
||||
internal static bool RenewUmbracoAuthTicket(this HttpContext http, int timeoutInMinutes = 60)
|
||||
@@ -65,9 +68,9 @@ namespace Umbraco.Core.Security
|
||||
GlobalSettings.TimeOutInMinutes,
|
||||
//Umbraco has always persisted it's original cookie for 1 day so we'll keep it that way
|
||||
1440,
|
||||
"/",
|
||||
LegacyUmbracoSettings.AuthCookieName,
|
||||
LegacyUmbracoSettings.AuthCookieDomain);
|
||||
"/",
|
||||
UmbracoConfiguration.Current.UmbracoSettings.Security.AuthCookieName,
|
||||
UmbracoConfiguration.Current.UmbracoSettings.Security.AuthCookieDomain);
|
||||
}
|
||||
|
||||
internal static void CreateUmbracoAuthTicket(this HttpContext http, UserData userdata)
|
||||
@@ -82,7 +85,7 @@ namespace Umbraco.Core.Security
|
||||
/// <returns></returns>
|
||||
public static FormsAuthenticationTicket GetUmbracoAuthTicket(this HttpContextBase http)
|
||||
{
|
||||
return GetAuthTicket(http, LegacyUmbracoSettings.AuthCookieName);
|
||||
return GetAuthTicket(http, UmbracoConfiguration.Current.UmbracoSettings.Security.AuthCookieName);
|
||||
}
|
||||
|
||||
internal static FormsAuthenticationTicket GetUmbracoAuthTicket(this HttpContext http)
|
||||
|
||||
@@ -567,7 +567,7 @@ namespace Umbraco.Core.Services
|
||||
public string GetContentTypesDtd()
|
||||
{
|
||||
var dtd = new StringBuilder();
|
||||
if (LegacyUmbracoSettings.UseLegacyXmlSchema)
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema)
|
||||
{
|
||||
dtd.AppendLine("<!ELEMENT node ANY> <!ATTLIST node id ID #REQUIRED> <!ELEMENT data ANY>");
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Umbraco.Core.Services
|
||||
internal XElement Export(IContent content, bool deep = false)
|
||||
{
|
||||
//nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias);
|
||||
var nodeName = LegacyUmbracoSettings.UseLegacyXmlSchema ? "node" : content.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
var nodeName = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "node" : content.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
|
||||
var xml = Export(content, nodeName);
|
||||
xml.Add(new XAttribute("nodeType", content.ContentType.Id));
|
||||
@@ -862,7 +862,7 @@ namespace Umbraco.Core.Services
|
||||
internal XElement Export(IMedia media, bool deep = false)
|
||||
{
|
||||
//nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias);
|
||||
var nodeName = LegacyUmbracoSettings.UseLegacyXmlSchema ? "node" : media.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
var nodeName = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "node" : media.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
|
||||
var xml = Export(media, nodeName);
|
||||
xml.Add(new XAttribute("nodeType", media.ContentType.Id));
|
||||
|
||||
@@ -958,7 +958,7 @@ namespace Umbraco.Core
|
||||
/// <remarks>Checks <c>UmbracoSettings.ForceSafeAliases</c> to determine whether it should filter the text.</remarks>
|
||||
public static string ToSafeAliasWithForcingCheck(this string alias)
|
||||
{
|
||||
return LegacyUmbracoSettings.ForceSafeAliases ? alias.ToSafeAlias() : alias;
|
||||
return UmbracoConfiguration.Current.UmbracoSettings.Content.ForceSafeAliases ? alias.ToSafeAlias() : alias;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -970,7 +970,7 @@ namespace Umbraco.Core
|
||||
/// <remarks>Checks <c>UmbracoSettings.ForceSafeAliases</c> to determine whether it should filter the text.</remarks>
|
||||
public static string ToSafeAliasWithForcingCheck(this string alias, CultureInfo culture)
|
||||
{
|
||||
return LegacyUmbracoSettings.ForceSafeAliases ? alias.ToSafeAlias(culture) : alias;
|
||||
return UmbracoConfiguration.Current.UmbracoSettings.Content.ForceSafeAliases ? alias.ToSafeAlias(culture) : alias;
|
||||
}
|
||||
|
||||
// note: LegacyShortStringHelper will produce a 100% backward-compatible output for ToUmbracoAlias.
|
||||
|
||||
@@ -57,17 +57,10 @@ namespace Umbraco.Core.Strings
|
||||
|
||||
static void InitializeLegacyUrlReplaceCharacters()
|
||||
{
|
||||
var replaceChars = LegacyUmbracoSettings.UrlReplaceCharacters;
|
||||
if (replaceChars == null) return;
|
||||
var nodes = replaceChars.SelectNodes("char");
|
||||
if (nodes == null) return;
|
||||
foreach (var node in nodes.Cast<System.Xml.XmlNode>())
|
||||
foreach (var node in UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.UrlReplacing.CharCollection)
|
||||
{
|
||||
var attributes = node.Attributes;
|
||||
if (attributes == null) continue;
|
||||
var org = attributes.GetNamedItem("org");
|
||||
if (org != null && org.Value != "")
|
||||
UrlReplaceCharacters[org.Value] = XmlHelper.GetNodeValue(node);
|
||||
if (node.Char.IsNullOrWhiteSpace() == false)
|
||||
UrlReplaceCharacters[node.Char] = node.Replacement;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +227,7 @@ function validateSafeAlias(id, value, immediate, callback) {{
|
||||
public string GetShortStringServicesJavaScript(string controllerPath)
|
||||
{
|
||||
return string.Format(SssjsFormat,
|
||||
LegacyUmbracoSettings.ForceSafeAliases ? "true" : "false", controllerPath);
|
||||
UmbracoConfiguration.Current.UmbracoSettings.Content.ForceSafeAliases ? "true" : "false", controllerPath);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -94,7 +94,7 @@ function isValidAlias(alias) {{
|
||||
public string GetShortStringServicesJavaScript(string controllerPath)
|
||||
{
|
||||
return string.Format(SssjsFormat,
|
||||
LegacyUmbracoSettings.ForceSafeAliases ? "true" : "false", SssjsValidCharacters, SssjsInvalidFirstCharacters);
|
||||
UmbracoConfiguration.Current.UmbracoSettings.Content.ForceSafeAliases ? "true" : "false", SssjsValidCharacters, SssjsInvalidFirstCharacters);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -205,11 +205,10 @@ function isValidAlias(alias) {{
|
||||
var ext = filePath.Substring(filePath.LastIndexOf('.'));
|
||||
|
||||
//Because the file usually is downloadable as well we check characters against 'UmbracoSettings.UrlReplaceCharacters'
|
||||
XmlNode replaceChars = LegacyUmbracoSettings.UrlReplaceCharacters;
|
||||
foreach (XmlNode n in replaceChars.SelectNodes("char"))
|
||||
foreach (var n in UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.UrlReplacing.CharCollection)
|
||||
{
|
||||
if (n.Attributes.GetNamedItem("org") != null && n.Attributes.GetNamedItem("org").Value != "")
|
||||
fileNamePart = fileNamePart.Replace(n.Attributes.GetNamedItem("org").Value, XmlHelper.GetNodeValue(n));
|
||||
if (n.Char.IsNullOrWhiteSpace() == false)
|
||||
fileNamePart = fileNamePart.Replace(n.Char, n.Replacement);
|
||||
}
|
||||
|
||||
filePath = string.Concat(fileNamePart, ext);
|
||||
@@ -469,15 +468,14 @@ function isValidAlias(alias) {{
|
||||
public string LegacyFormatUrl(string url)
|
||||
{
|
||||
var newUrl = url.ToLowerInvariant();
|
||||
var replaceChars = LegacyUmbracoSettings.UrlReplaceCharacters;
|
||||
foreach (XmlNode n in replaceChars.SelectNodes("char"))
|
||||
foreach (var n in UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.UrlReplacing.CharCollection)
|
||||
{
|
||||
if (n.Attributes.GetNamedItem("org") != null && n.Attributes.GetNamedItem("org").Value != "")
|
||||
newUrl = newUrl.Replace(n.Attributes.GetNamedItem("org").Value, XmlHelper.GetNodeValue(n));
|
||||
if (n.Char.IsNullOrWhiteSpace() == false)
|
||||
newUrl = newUrl.Replace(n.Char, n.Replacement);
|
||||
}
|
||||
|
||||
// check for double dashes
|
||||
if (LegacyUmbracoSettings.RemoveDoubleDashesFromUrlReplacing)
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.UrlReplacing.RemoveDoubleDashes)
|
||||
{
|
||||
newUrl = Regex.Replace(newUrl, @"[-]{2,}", "-");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Xml;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace Umbraco.Core.Sync
|
||||
@@ -10,16 +11,16 @@ namespace Umbraco.Core.Sync
|
||||
internal class ConfigServerAddress : IServerAddress
|
||||
{
|
||||
|
||||
public ConfigServerAddress(XmlNode n)
|
||||
public ConfigServerAddress(IServer n)
|
||||
{
|
||||
var webServicesUrl = IOHelper.ResolveUrl(SystemDirectories.WebServices);
|
||||
|
||||
var protocol = GlobalSettings.UseSSL ? "https" : "http";
|
||||
if (n.Attributes.GetNamedItem("forceProtocol") != null && !string.IsNullOrEmpty(n.Attributes.GetNamedItem("forceProtocol").Value))
|
||||
protocol = n.Attributes.GetNamedItem("forceProtocol").Value;
|
||||
var domain = XmlHelper.GetNodeValue(n);
|
||||
if (n.Attributes.GetNamedItem("forcePortnumber") != null && !string.IsNullOrEmpty(n.Attributes.GetNamedItem("forcePortnumber").Value))
|
||||
domain += string.Format(":{0}", n.Attributes.GetNamedItem("forcePortnumber").Value);
|
||||
if (n.ForceProtocol.IsNullOrWhiteSpace() == false)
|
||||
protocol = n.ForceProtocol;
|
||||
var domain = n.ServerAddress;
|
||||
if (n.ForcePortnumber.IsNullOrWhiteSpace() == false)
|
||||
domain += string.Format(":{0}", n.ForcePortnumber);
|
||||
ServerAddress = string.Format("{0}://{1}{2}/cacheRefresher.asmx", protocol, domain, webServicesUrl);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Core.Sync
|
||||
@@ -13,17 +14,17 @@ namespace Umbraco.Core.Sync
|
||||
/// </summary>
|
||||
internal class ConfigServerRegistrar : IServerRegistrar
|
||||
{
|
||||
private readonly XmlNode _xmlServers;
|
||||
private readonly IEnumerable<IServer> _servers;
|
||||
|
||||
public ConfigServerRegistrar()
|
||||
: this(LegacyUmbracoSettings.DistributionServers)
|
||||
: this(UmbracoConfiguration.Current.UmbracoSettings.DistributedCall.Servers)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
internal ConfigServerRegistrar(XmlNode xmlServers)
|
||||
internal ConfigServerRegistrar(IEnumerable<IServer> servers)
|
||||
{
|
||||
_xmlServers = xmlServers;
|
||||
_servers = servers;
|
||||
}
|
||||
|
||||
private List<IServerAddress> _addresses;
|
||||
@@ -36,16 +37,12 @@ namespace Umbraco.Core.Sync
|
||||
{
|
||||
_addresses = new List<IServerAddress>();
|
||||
|
||||
if (_xmlServers != null)
|
||||
if (_servers != null)
|
||||
{
|
||||
var nodes = _xmlServers.SelectNodes("./server");
|
||||
if (nodes != null)
|
||||
foreach (var n in _servers)
|
||||
{
|
||||
foreach (XmlNode n in nodes)
|
||||
{
|
||||
_addresses.Add(new ConfigServerAddress(n));
|
||||
}
|
||||
}
|
||||
_addresses.Add(new ConfigServerAddress(n));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Umbraco.Core.Sync
|
||||
/// <param name="login"></param>
|
||||
/// <param name="password"></param>
|
||||
internal DefaultServerMessenger(string login, string password)
|
||||
: this(login, password, LegacyUmbracoSettings.UseDistributedCalls)
|
||||
: this(login, password, UmbracoConfiguration.Current.UmbracoSettings.DistributedCall.Enabled)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace Umbraco.Core.Sync
|
||||
{
|
||||
Login = result.Item1;
|
||||
Password = result.Item2;
|
||||
_useDistributedCalls = LegacyUmbracoSettings.UseDistributedCalls;
|
||||
_useDistributedCalls = UmbracoConfiguration.Current.UmbracoSettings.DistributedCall.Enabled;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -144,9 +144,16 @@
|
||||
<Compile Include="CodeAnnotations\UmbracoExperimentalFeatureAttribute.cs" />
|
||||
<Compile Include="CodeAnnotations\UmbracoProposedPublicAttribute.cs" />
|
||||
<Compile Include="ConcurrentHashSet.cs" />
|
||||
<Compile Include="Configuration\BaseRest\IBaseRest.cs" />
|
||||
<Compile Include="Configuration\BaseRest\IExtension.cs" />
|
||||
<Compile Include="Configuration\BaseRest\IMethod.cs" />
|
||||
<Compile Include="Configuration\CaseInsensitiveEnumConfigConverter.cs" />
|
||||
<Compile Include="Configuration\ClientDependencyConfiguration.cs" />
|
||||
<Compile Include="Configuration\ConfigurationKeyAttribute.cs" />
|
||||
<Compile Include="Configuration\BaseRest\BaseRestSection.cs" />
|
||||
<Compile Include="Configuration\BaseRest\ExtensionElement.cs" />
|
||||
<Compile Include="Configuration\BaseRest\ExtensionElementCollection.cs" />
|
||||
<Compile Include="Configuration\BaseRest\MethodElement.cs" />
|
||||
<Compile Include="Configuration\FileSystemProviderElement.cs" />
|
||||
<Compile Include="Configuration\FileSystemProviderElementCollection.cs" />
|
||||
<Compile Include="Configuration\FileSystemProvidersSection.cs" />
|
||||
@@ -172,7 +179,6 @@
|
||||
<Compile Include="Configuration\UmbracoSettings\ExternalLoggerElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\FileExtensionElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\HelpElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IAppCodeFileExtensions.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IChar.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IContent.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IContentErrorPage.cs" />
|
||||
@@ -201,7 +207,7 @@
|
||||
<Compile Include="Configuration\UmbracoSettings\IScheduledTasks.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IScripting.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\ISecurity.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IServerElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IServer.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\ITemplates.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IUmbracoSettings.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IUrlReplacing.cs" />
|
||||
@@ -804,7 +810,6 @@
|
||||
<Compile Include="ActionsResolver.cs" />
|
||||
<Compile Include="CacheRefreshersResolver.cs" />
|
||||
<Compile Include="Configuration\GlobalSettings.cs" />
|
||||
<Compile Include="Configuration\LegacyUmbracoSettings.cs" />
|
||||
<Compile Include="CustomBooleanTypeConverter.cs" />
|
||||
<Compile Include="DataTypesResolver.cs" />
|
||||
<Compile Include="DisposableObject.cs" />
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Umbraco.Core
|
||||
if (xml == null) return false;
|
||||
xml = xml.Trim();
|
||||
if (xml.StartsWith("<") == false || xml.EndsWith(">") == false || xml.Contains('/') == false) return false;
|
||||
if (LegacyUmbracoSettings.NotDynamicXmlDocumentElements.Any(x => x.InvariantEquals(alias))) return false;
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Scripting.Razor.NotDynamicXmlDocumentElements.Any(x => x.Element.InvariantEquals(alias))) return false;
|
||||
return TryCreateXPathDocument(xml, out doc);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,12 +104,12 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
[Test]
|
||||
public void MacroErrors()
|
||||
{
|
||||
Assert.IsTrue(Section.Content.MacroErrors == MacroErrorBehaviour.Inline);
|
||||
Assert.IsTrue(Section.Content.MacroErrorBehaviour == MacroErrorBehaviour.Inline);
|
||||
}
|
||||
[Test]
|
||||
public void DocumentTypeIconList()
|
||||
{
|
||||
Assert.IsTrue(Section.Content.DocumentTypeIconList == IconPickerBehaviour.HideFileDuplicates);
|
||||
Assert.IsTrue(Section.Content.IconPickerBehaviour == IconPickerBehaviour.HideFileDuplicates);
|
||||
}
|
||||
[Test]
|
||||
public void DisallowedUploadFiles()
|
||||
|
||||
@@ -9,8 +9,8 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
[Test]
|
||||
public void AppCodeFileExtensions()
|
||||
{
|
||||
Assert.IsTrue(Section.Developer.AppCodeFileExtensions.AppCodeFileExtensions.Count() == 2);
|
||||
Assert.IsTrue(Section.Developer.AppCodeFileExtensions.AppCodeFileExtensions.All(
|
||||
Assert.IsTrue(Section.Developer.AppCodeFileExtensions.Count() == 2);
|
||||
Assert.IsTrue(Section.Developer.AppCodeFileExtensions.All(
|
||||
x => "cs,vb".Split(',').Contains(x.Extension)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
[Test]
|
||||
public virtual void ExternalLogger_Type()
|
||||
{
|
||||
Assert.IsTrue(Section.Logging.ExternalLogger.Type == "fully.qualified.namespace.and.type");
|
||||
Assert.IsTrue(Section.Logging.ExternalLogger.ExternalLoggerType == "fully.qualified.namespace.and.type");
|
||||
}
|
||||
[Test]
|
||||
public virtual void ExternalLogger_LogAuditTrail()
|
||||
|
||||
@@ -16,5 +16,11 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
{
|
||||
Assert.IsTrue(Section.WebRouting.TrySkipIisCustomErrors == false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UrlProviderMode()
|
||||
{
|
||||
Assert.IsTrue(Section.WebRouting.UrlProviderMode == "Auto");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,16 +22,16 @@ namespace Umbraco.Web.UI.Install.Steps
|
||||
if (Page.IsValid)
|
||||
{
|
||||
var u = User.GetUser(0);
|
||||
var user = Membership.Providers[LegacyUmbracoSettings.DefaultBackofficeProvider].GetUser(0, true);
|
||||
var user = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider].GetUser(0, true);
|
||||
user.ChangePassword(u.GetPassword(), tb_password.Text.Trim());
|
||||
|
||||
// Is it using the default membership provider
|
||||
if (Membership.Providers[LegacyUmbracoSettings.DefaultBackofficeProvider] is UsersMembershipProvider)
|
||||
if (Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider] is UsersMembershipProvider)
|
||||
{
|
||||
// Save user in membership provider
|
||||
var umbracoUser = user as UsersMembershipUser;
|
||||
umbracoUser.FullName = tb_name.Text.Trim();
|
||||
Membership.Providers[LegacyUmbracoSettings.DefaultBackofficeProvider].UpdateUser(umbracoUser);
|
||||
Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider].UpdateUser(umbracoUser);
|
||||
|
||||
// Save user details
|
||||
u.Email = tb_email.Text.Trim();
|
||||
@@ -39,7 +39,7 @@ namespace Umbraco.Web.UI.Install.Steps
|
||||
else
|
||||
{
|
||||
u.Name = tb_name.Text.Trim();
|
||||
if (!(Membership.Providers[LegacyUmbracoSettings.DefaultBackofficeProvider] is ActiveDirectoryMembershipProvider)) Membership.Providers[LegacyUmbracoSettings.DefaultBackofficeProvider].UpdateUser(user);
|
||||
if (!(Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider] is ActiveDirectoryMembershipProvider)) Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider].UpdateUser(user);
|
||||
}
|
||||
|
||||
// we need to update the login name here as it's set to the old name when saving the user via the membership provider!
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
<section name="ExamineLuceneIndexSets" type="Examine.LuceneEngine.Config.IndexSets, Examine" requirePermission="false"/>
|
||||
<section name="FileSystemProviders" type="Umbraco.Core.Configuration.FileSystemProvidersSection, Umbraco.Core" requirePermission="false"/>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" requirePermission="false" />
|
||||
<section name="BaseRestExtensions" type="Umbraco.Web.BaseRest.Configuration.BaseRestSection, umbraco" requirePermission="false" />
|
||||
|
||||
|
||||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
|
||||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
|
||||
@@ -17,12 +16,14 @@
|
||||
|
||||
<sectionGroup name="umbracoConfiguration">
|
||||
<section name="settings" type="Umbraco.Core.Configuration.UmbracoSettings.UmbracoSettingsSection, Umbraco.Core" requirePermission="false" />
|
||||
<section name="BaseRestExtensions" type="Umbraco.Web.BaseRest.Configuration.BaseRestSection, umbraco" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
|
||||
</configSections>
|
||||
|
||||
<umbracoConfiguration>
|
||||
<settings configSource="config\umbracoSettings.config" />
|
||||
<BaseRestExtensions configSource="config\BaseRestExtensions.config" />
|
||||
</umbracoConfiguration>
|
||||
|
||||
<urlrewritingnet configSource="config\UrlRewriting.config" />
|
||||
@@ -32,7 +33,6 @@
|
||||
<ExamineLuceneIndexSets configSource="config\ExamineIndex.config" />
|
||||
<FileSystemProviders configSource="config\FileSystemProviders.config" />
|
||||
<log4net configSource="config\log4net.config" />
|
||||
<BaseRestExtensions configSource="config\BaseRestExtensions.config" />
|
||||
|
||||
<appSettings>
|
||||
<!--
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
using System.Web;
|
||||
using System.Web.SessionState;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.BaseRest;
|
||||
|
||||
namespace Umbraco.Web.BaseRest
|
||||
{
|
||||
@@ -28,7 +30,7 @@ namespace Umbraco.Web.BaseRest
|
||||
/// <returns>A value indicating whether the specified Uri should be routed to the BaseRestHandler.</returns>
|
||||
public static bool IsBaseRestRequest(Uri uri)
|
||||
{
|
||||
return Core.Configuration.LegacyUmbracoSettings.For<Configuration.BaseRestSection>().Enabled
|
||||
return UmbracoConfiguration.Current.BaseRestExtensions.Enabled
|
||||
&& uri.AbsolutePath.ToLowerInvariant().StartsWith(BaseUrl);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ using System.Xml;
|
||||
using System.IO;
|
||||
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.BaseRest;
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.cms.businesslogic.member;
|
||||
|
||||
@@ -87,7 +89,7 @@ namespace Umbraco.Web.BaseRest
|
||||
//
|
||||
static RestExtensionMethodInfo GetFromConfiguration(string extensionAlias, string methodName, int paramsCount)
|
||||
{
|
||||
var config = Core.Configuration.LegacyUmbracoSettings.For<Configuration.BaseRestSection>();
|
||||
var config = UmbracoConfiguration.Current.BaseRestExtensions;
|
||||
|
||||
var configExtension = config.Items[extensionAlias];
|
||||
if (configExtension == null)
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Web.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// The Web.Routing settings section.
|
||||
/// </summary>
|
||||
[ConfigurationKey("umbraco/web.routing")]
|
||||
internal class WebRouting : UmbracoConfigurationSection
|
||||
{
|
||||
private const string KeyTrySkipIisCustomErrors = "trySkipIisCustomErrors";
|
||||
private const string KeyUrlProviderMode = "urlProviderMode";
|
||||
private const string KeyInternalRedirectPreservesTemplate = "internalRedirectPreservesTemplate";
|
||||
|
||||
private bool? _trySkipIisCustomErrors;
|
||||
private Routing.UrlProviderMode? _urlProviderMode;
|
||||
private bool? _internalRedirectPreservesTemplate;
|
||||
|
||||
internal protected override void ResetSection()
|
||||
{
|
||||
base.ResetSection();
|
||||
|
||||
_trySkipIisCustomErrors = null;
|
||||
_urlProviderMode = null;
|
||||
_internalRedirectPreservesTemplate = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to try to skip IIS custom errors.
|
||||
/// </summary>
|
||||
[ConfigurationProperty(KeyTrySkipIisCustomErrors, DefaultValue = false, IsRequired = false)]
|
||||
public bool TrySkipIisCustomErrors
|
||||
{
|
||||
get
|
||||
{
|
||||
return _trySkipIisCustomErrors ?? (IsPresent
|
||||
? (bool)this[KeyTrySkipIisCustomErrors]
|
||||
: LegacyUmbracoSettings.TrySkipIisCustomErrors);
|
||||
}
|
||||
internal set { _trySkipIisCustomErrors = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the url provider mode.
|
||||
/// </summary>
|
||||
/// <remarks>If the section is present then default is Auto, else default is AutoLegacy.</remarks>
|
||||
[ConfigurationProperty(KeyUrlProviderMode, DefaultValue = Routing.UrlProviderMode.Auto, IsRequired = false)]
|
||||
[TypeConverter(typeof(CaseInsensitiveEnumConfigConverter<Routing.UrlProviderMode>))]
|
||||
public Routing.UrlProviderMode UrlProviderMode
|
||||
{
|
||||
get
|
||||
{
|
||||
return _urlProviderMode ?? (IsPresent
|
||||
? (Routing.UrlProviderMode)this[KeyUrlProviderMode]
|
||||
: Routing.UrlProviderMode.AutoLegacy);
|
||||
}
|
||||
internal set { _urlProviderMode = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether internal redirect preserves the template.
|
||||
/// </summary>
|
||||
[ConfigurationProperty(KeyInternalRedirectPreservesTemplate, DefaultValue = false, IsRequired = false)]
|
||||
public bool InternalRedirectPreservesTemplate
|
||||
{
|
||||
get
|
||||
{
|
||||
return _internalRedirectPreservesTemplate ?? (IsPresent
|
||||
? (bool)this[KeyInternalRedirectPreservesTemplate]
|
||||
: LegacyUmbracoSettings.InternalRedirectPreservesTemplate);
|
||||
}
|
||||
internal set { _internalRedirectPreservesTemplate = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,8 @@ namespace Umbraco.Web.Editors
|
||||
"umbracoSettings", new Dictionary<string, object>
|
||||
{
|
||||
{"umbracoPath", GlobalSettings.Path},
|
||||
{"imageFileTypes", LegacyUmbracoSettings.ImageFileTypes},
|
||||
{"imageFileTypes",
|
||||
string.Join(",",UmbracoConfiguration.Current.UmbracoSettings.Content.Imaging.ImageFileTypes)},
|
||||
}
|
||||
},
|
||||
{ "isDebuggingEnabled", HttpContext.IsDebuggingEnabled }
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace Umbraco.Web.Models
|
||||
if (_pageXmlNode.Attributes.GetNamedItem("writerID") != null)
|
||||
_writerId = int.Parse(_pageXmlNode.Attributes.GetNamedItem("writerID").Value);
|
||||
|
||||
if (LegacyUmbracoSettings.UseLegacyXmlSchema)
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema)
|
||||
{
|
||||
if (_pageXmlNode.Attributes.GetNamedItem("nodeTypeAlias") != null)
|
||||
_docTypeAlias = _pageXmlNode.Attributes.GetNamedItem("nodeTypeAlias").Value;
|
||||
@@ -343,12 +343,12 @@ namespace Umbraco.Web.Models
|
||||
}
|
||||
|
||||
// load data
|
||||
var dataXPath = LegacyUmbracoSettings.UseLegacyXmlSchema ? "data" : "* [not(@isDoc)]";
|
||||
var dataXPath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "data" : "* [not(@isDoc)]";
|
||||
foreach (XmlNode n in _pageXmlNode.SelectNodes(dataXPath))
|
||||
_properties.Add(new XmlPublishedContentProperty(n));
|
||||
|
||||
// load children
|
||||
var childXPath = LegacyUmbracoSettings.UseLegacyXmlSchema ? "node" : "* [@isDoc]";
|
||||
var childXPath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "node" : "* [@isDoc]";
|
||||
var nav = _pageXmlNode.CreateNavigator();
|
||||
var expr = nav.Compile(childXPath);
|
||||
expr.AddSort("@sortOrder", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number);
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Umbraco.Web.Models
|
||||
// For backward compatibility with 2.x (the version attribute has been removed from 3.0 data nodes)
|
||||
if (propertyXmlData.Attributes.GetNamedItem("versionID") != null)
|
||||
_version = new Guid(propertyXmlData.Attributes.GetNamedItem("versionID").Value);
|
||||
_alias = LegacyUmbracoSettings.UseLegacyXmlSchema ?
|
||||
_alias = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ?
|
||||
propertyXmlData.Attributes.GetNamedItem("alias").Value :
|
||||
propertyXmlData.Name;
|
||||
_value = XmlHelper.GetNodeValue(propertyXmlData);
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Umbraco.Web.Mvc
|
||||
{
|
||||
// creating previewBadge markup
|
||||
markupToInject =
|
||||
String.Format(LegacyUmbracoSettings.PreviewBadge,
|
||||
String.Format(UmbracoConfiguration.Current.UmbracoSettings.Content.PreviewBadge,
|
||||
IOHelper.ResolveUrl(SystemDirectories.Umbraco),
|
||||
IOHelper.ResolveUrl(SystemDirectories.UmbracoClient),
|
||||
Server.UrlEncode(UmbracoContext.Current.HttpContext.Request.Path));
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Xml;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
@@ -65,73 +66,65 @@ namespace Umbraco.Web.PropertyEditors
|
||||
}
|
||||
|
||||
static void AutoFillProperties(IContentBase model)
|
||||
{
|
||||
if (LegacyUmbracoSettings.ImageAutoFillImageProperties != null)
|
||||
{
|
||||
foreach (var p in model.Properties)
|
||||
{
|
||||
foreach (var p in model.Properties)
|
||||
{
|
||||
var uploadFieldConfigNode =
|
||||
LegacyUmbracoSettings.ImageAutoFillImageProperties.SelectSingleNode(
|
||||
string.Format("uploadField [@alias = \"{0}\"]", p.Alias));
|
||||
var uploadFieldConfigNode =
|
||||
UmbracoConfiguration.Current.UmbracoSettings.Content.Imaging.ImageAutoFillProperties
|
||||
.FirstOrDefault(x => x.Alias == p.Alias);
|
||||
|
||||
if (uploadFieldConfigNode != null)
|
||||
if (uploadFieldConfigNode != null)
|
||||
{
|
||||
//now we need to check if there is a value
|
||||
if (p.Value is string && ((string) p.Value).IsNullOrWhiteSpace() == false)
|
||||
{
|
||||
//now we need to check if there is a value
|
||||
if (p.Value is string && ((string) p.Value).IsNullOrWhiteSpace() == false)
|
||||
//there might be multiple, we can only process the first one!
|
||||
var split = ((string) p.Value).Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (split.Any())
|
||||
{
|
||||
//there might be multiple, we can only process the first one!
|
||||
var split = ((string) p.Value).Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (split.Any())
|
||||
{
|
||||
var umbracoFile = new UmbracoMediaFile(IOHelper.MapPath(split[0]));
|
||||
FillProperties(uploadFieldConfigNode, model, umbracoFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//there's no value so need to reset to zero
|
||||
ResetProperties(uploadFieldConfigNode, model);
|
||||
var umbracoFile = new UmbracoMediaFile(IOHelper.MapPath(split[0]));
|
||||
FillProperties(uploadFieldConfigNode, model, umbracoFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//there's no value so need to reset to zero
|
||||
ResetProperties(uploadFieldConfigNode, model);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ResetProperties(XmlNode uploadFieldConfigNode, IContentBase content)
|
||||
private static void ResetProperties(IContentImagingAutoFillUploadField uploadFieldConfigNode, IContentBase content)
|
||||
{
|
||||
// only add dimensions to web images
|
||||
UpdateContentProperty(uploadFieldConfigNode, content, "widthFieldAlias", string.Empty);
|
||||
UpdateContentProperty(uploadFieldConfigNode, content, "heightFieldAlias", string.Empty);
|
||||
if (content.Properties[uploadFieldConfigNode.WidthFieldAlias] != null)
|
||||
content.Properties[uploadFieldConfigNode.WidthFieldAlias].Value = string.Empty;
|
||||
|
||||
if (content.Properties[uploadFieldConfigNode.HeightFieldAlias] != null)
|
||||
content.Properties[uploadFieldConfigNode.HeightFieldAlias].Value = string.Empty;
|
||||
|
||||
UpdateContentProperty(uploadFieldConfigNode, content, "lengthFieldAlias", string.Empty);
|
||||
UpdateContentProperty(uploadFieldConfigNode, content, "extensionFieldAlias", string.Empty);
|
||||
if (content.Properties[uploadFieldConfigNode.LengthFieldAlias] != null)
|
||||
content.Properties[uploadFieldConfigNode.LengthFieldAlias].Value = string.Empty;
|
||||
|
||||
if (content.Properties[uploadFieldConfigNode.ExtensionFieldAlias] != null)
|
||||
content.Properties[uploadFieldConfigNode.ExtensionFieldAlias].Value = string.Empty;
|
||||
}
|
||||
|
||||
private static void FillProperties(XmlNode uploadFieldConfigNode, IContentBase content, UmbracoMediaFile um)
|
||||
private static void FillProperties(IContentImagingAutoFillUploadField uploadFieldConfigNode, IContentBase content, UmbracoMediaFile um)
|
||||
{
|
||||
var size = um.SupportsResizing ? (Size?)um.GetDimensions() : null;
|
||||
|
||||
// only add dimensions to web images
|
||||
UpdateContentProperty(uploadFieldConfigNode, content, "widthFieldAlias", size.HasValue ? size.Value.Width.ToInvariantString() : string.Empty);
|
||||
UpdateContentProperty(uploadFieldConfigNode, content, "heightFieldAlias", size.HasValue ? size.Value.Height.ToInvariantString() : string.Empty);
|
||||
if (content.Properties[uploadFieldConfigNode.WidthFieldAlias] != null)
|
||||
content.Properties[uploadFieldConfigNode.WidthFieldAlias].Value = size.HasValue ? size.Value.Width.ToInvariantString() : string.Empty;
|
||||
|
||||
UpdateContentProperty(uploadFieldConfigNode, content, "lengthFieldAlias", um.Length);
|
||||
UpdateContentProperty(uploadFieldConfigNode, content, "extensionFieldAlias", um.Extension);
|
||||
}
|
||||
if (content.Properties[uploadFieldConfigNode.HeightFieldAlias] != null)
|
||||
content.Properties[uploadFieldConfigNode.HeightFieldAlias].Value = size.HasValue ? size.Value.Height.ToInvariantString() : string.Empty;
|
||||
|
||||
private static void UpdateContentProperty(XmlNode uploadFieldConfigNode, IContentBase content, string configPropertyAlias, object propertyValue)
|
||||
{
|
||||
var propertyNode = uploadFieldConfigNode.SelectSingleNode(configPropertyAlias);
|
||||
if (propertyNode != null
|
||||
&& string.IsNullOrEmpty(propertyNode.FirstChild.Value) == false
|
||||
&& content.Properties.Contains(propertyNode.FirstChild.Value))
|
||||
{
|
||||
var property = content.Properties[propertyNode.FirstChild.Value];
|
||||
if (property != null)
|
||||
{
|
||||
property.Value = propertyValue;
|
||||
}
|
||||
}
|
||||
if (content.Properties[uploadFieldConfigNode.LengthFieldAlias] != null)
|
||||
content.Properties[uploadFieldConfigNode.LengthFieldAlias].Value = um.Length;
|
||||
|
||||
if (content.Properties[uploadFieldConfigNode.ExtensionFieldAlias] != null)
|
||||
content.Properties[uploadFieldConfigNode.ExtensionFieldAlias].Value = um.Extension;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Umbraco.Web.PropertyEditors
|
||||
|
||||
var name = IOHelper.SafeFileName(file.FileName.Substring(file.FileName.LastIndexOf(IOHelper.DirSepChar) + 1, file.FileName.Length - file.FileName.LastIndexOf(IOHelper.DirSepChar) - 1).ToLower());
|
||||
|
||||
var subfolder = LegacyUmbracoSettings.UploadAllowDirectories
|
||||
var subfolder = UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories
|
||||
? currentPersistedFile.Replace(fs.GetUrl("/"), "").Split('/')[0]
|
||||
: currentPersistedFile.Substring(currentPersistedFile.LastIndexOf("/", StringComparison.Ordinal) + 1).Split('-')[0];
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Umbraco.Web.PropertyEditors
|
||||
? subfolderId.ToString(CultureInfo.InvariantCulture)
|
||||
: MediaSubfolderCounter.Current.Increment().ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
var fileName = LegacyUmbracoSettings.UploadAllowDirectories
|
||||
var fileName = UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories
|
||||
? Path.Combine(numberedFolder, name)
|
||||
: numberedFolder + "-" + name;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
@@ -105,14 +106,14 @@ namespace Umbraco.Web.Routing
|
||||
|
||||
if (mode == UrlProviderMode.AutoLegacy)
|
||||
{
|
||||
mode = Core.Configuration.LegacyUmbracoSettings.UseDomainPrefixes
|
||||
mode = UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.UseDomainPrefixes
|
||||
? UrlProviderMode.Absolute
|
||||
: UrlProviderMode.Auto;
|
||||
}
|
||||
|
||||
if (mode == UrlProviderMode.AutoLegacy)
|
||||
{
|
||||
mode = Core.Configuration.LegacyUmbracoSettings.UseDomainPrefixes
|
||||
mode = UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.UseDomainPrefixes
|
||||
? UrlProviderMode.Absolute
|
||||
: UrlProviderMode.Auto;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Globalization;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.Configuration;
|
||||
|
||||
using umbraco;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using RenderingEngine = Umbraco.Core.RenderingEngine;
|
||||
@@ -164,7 +164,7 @@ namespace Umbraco.Web.Routing
|
||||
IsInternalRedirectPublishedContent = isInternalRedirect;
|
||||
|
||||
// must restore the template if it's an internal redirect & the config option is set
|
||||
if (isInternalRedirect && LegacyUmbracoSettings.For<WebRouting>().InternalRedirectPreservesTemplate)
|
||||
if (isInternalRedirect && UmbracoConfiguration.Current.UmbracoSettings.WebRouting.InternalRedirectPreservesTemplate)
|
||||
{
|
||||
// restore
|
||||
_template = template;
|
||||
|
||||
@@ -8,7 +8,6 @@ using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Web.Configuration;
|
||||
|
||||
using umbraco;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
@@ -533,7 +532,7 @@ namespace Umbraco.Web.Routing
|
||||
// does not apply
|
||||
// + optionnally, apply the alternate template on internal redirects
|
||||
var useAltTemplate = _pcr.IsInitialPublishedContent
|
||||
|| (LegacyUmbracoSettings.For<WebRouting>().InternalRedirectPreservesTemplate && _pcr.IsInternalRedirectPublishedContent);
|
||||
|| (UmbracoConfiguration.Current.UmbracoSettings.WebRouting.InternalRedirectPreservesTemplate && _pcr.IsInternalRedirectPublishedContent);
|
||||
string altTemplate = useAltTemplate
|
||||
? _routingContext.UmbracoContext.HttpContext.Request[Constants.Conventions.Url.AltTemplate]
|
||||
: null;
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Web.Routing
|
||||
{
|
||||
@@ -22,7 +23,13 @@ namespace Umbraco.Web.Routing
|
||||
{
|
||||
_umbracoContext = umbracoContext;
|
||||
_urlProviders = urlProviders;
|
||||
Mode = LegacyUmbracoSettings.For<Configuration.WebRouting>().UrlProviderMode;
|
||||
|
||||
var provider = UrlProviderMode.Auto;
|
||||
Mode = provider;
|
||||
if (Enum<UrlProviderMode>.TryParse(UmbracoConfiguration.Current.UmbracoSettings.WebRouting.UrlProviderMode, out provider))
|
||||
{
|
||||
Mode = provider;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly UmbracoContext _umbracoContext;
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace Umbraco.Web.Security
|
||||
/// <returns></returns>
|
||||
internal bool ValidateBackOfficeCredentials(string username, string password)
|
||||
{
|
||||
var membershipProvider = Membership.Providers[LegacyUmbracoSettings.DefaultBackofficeProvider];
|
||||
var membershipProvider = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider];
|
||||
return membershipProvider != null && membershipProvider.ValidateUser(username, password);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,17 +17,17 @@ namespace Umbraco.Web.Strategies.DataTypes
|
||||
/// This is an intermediate fix for the legacy DataTypeUploadField and the FileHandlerData, so that properties
|
||||
/// are saved correctly when using the Upload field on a (legacy) Document or Media class.
|
||||
/// </remarks>
|
||||
public class LegacyUploadFieldWorkaround : IApplicationStartupHandler
|
||||
public class LegacyUploadFieldWorkaround : ApplicationEventHandler
|
||||
{
|
||||
public LegacyUploadFieldWorkaround()
|
||||
{
|
||||
global::umbraco.cms.businesslogic.media.Media.BeforeSave += MediaBeforeSave;
|
||||
global::umbraco.cms.businesslogic.web.Document.BeforeSave += DocumentBeforeSave;
|
||||
}
|
||||
|
||||
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
|
||||
{
|
||||
global::umbraco.cms.businesslogic.media.Media.BeforeSave += MediaBeforeSave;
|
||||
global::umbraco.cms.businesslogic.web.Document.BeforeSave += DocumentBeforeSave;
|
||||
}
|
||||
|
||||
void DocumentBeforeSave(global::umbraco.cms.businesslogic.web.Document sender, global::umbraco.cms.businesslogic.SaveEventArgs e)
|
||||
{
|
||||
if (LegacyUmbracoSettings.ImageAutoFillImageProperties != null)
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Content.Imaging.ImageAutoFillProperties.Any())
|
||||
{
|
||||
var property = sender.GenericProperties.FirstOrDefault(x => x.PropertyType.DataTypeDefinition.DataType.Id == new Guid(Constants.PropertyEditors.UploadField));
|
||||
if (property == null)
|
||||
@@ -40,7 +40,7 @@ namespace Umbraco.Web.Strategies.DataTypes
|
||||
|
||||
void MediaBeforeSave(global::umbraco.cms.businesslogic.media.Media sender, global::umbraco.cms.businesslogic.SaveEventArgs e)
|
||||
{
|
||||
if (LegacyUmbracoSettings.ImageAutoFillImageProperties != null)
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Content.Imaging.ImageAutoFillProperties.Any())
|
||||
{
|
||||
var property = sender.GenericProperties.FirstOrDefault(x => x.PropertyType.DataTypeDefinition.DataType.Id == new Guid(Constants.PropertyEditors.UploadField));
|
||||
if (property == null)
|
||||
@@ -52,8 +52,9 @@ namespace Umbraco.Web.Strategies.DataTypes
|
||||
}
|
||||
|
||||
private void FillProperties(global::umbraco.cms.businesslogic.Content content, global::umbraco.cms.businesslogic.property.Property property)
|
||||
{
|
||||
XmlNode uploadFieldConfigNode = global::umbraco.UmbracoSettings.ImageAutoFillImageProperties.SelectSingleNode(string.Format("uploadField [@alias = \"{0}\"]", property.PropertyType.Alias));
|
||||
{
|
||||
var uploadFieldConfigNode = UmbracoConfiguration.Current.UmbracoSettings.Content.Imaging.ImageAutoFillProperties
|
||||
.FirstOrDefault(x => x.Alias == property.PropertyType.Alias);
|
||||
|
||||
if (uploadFieldConfigNode != null)
|
||||
{
|
||||
@@ -76,31 +77,20 @@ namespace Umbraco.Web.Strategies.DataTypes
|
||||
? fileSystem.GetExtension(path).Substring(1).ToLowerInvariant()
|
||||
: "";
|
||||
|
||||
var isImageType = ("," + LegacyUmbracoSettings.ImageFileTypes + ",").Contains(string.Format(",{0},", extension));
|
||||
var isImageType = UmbracoConfiguration.Current.UmbracoSettings.Content.Imaging.ImageFileTypes.InvariantContains(extension);
|
||||
|
||||
var dimensions = isImageType ? GetDimensions(path, fileSystem) : null;
|
||||
|
||||
// only add dimensions to web images
|
||||
UpdateProperty(uploadFieldConfigNode, content, "widthFieldAlias", isImageType ? dimensions.Item1.ToString(CultureInfo.InvariantCulture) : string.Empty);
|
||||
UpdateProperty(uploadFieldConfigNode, content, "heightFieldAlias", isImageType ? dimensions.Item2.ToString(CultureInfo.InvariantCulture) : string.Empty);
|
||||
content.getProperty(uploadFieldConfigNode.WidthFieldAlias).Value = isImageType ? dimensions.Item1.ToString(CultureInfo.InvariantCulture) : string.Empty;
|
||||
content.getProperty(uploadFieldConfigNode.HeightFieldAlias).Value = isImageType ? dimensions.Item2.ToString(CultureInfo.InvariantCulture) : string.Empty;
|
||||
content.getProperty(uploadFieldConfigNode.LengthFieldAlias).Value = size == default(long) ? string.Empty : size.ToString(CultureInfo.InvariantCulture);
|
||||
content.getProperty(uploadFieldConfigNode.ExtensionFieldAlias).Value = string.IsNullOrEmpty(extension) ? string.Empty : extension;
|
||||
|
||||
UpdateProperty(uploadFieldConfigNode, content, "lengthFieldAlias", size == default(long) ? string.Empty : size.ToString(CultureInfo.InvariantCulture));
|
||||
UpdateProperty(uploadFieldConfigNode, content, "extensionFieldAlias", string.IsNullOrEmpty(extension) ? string.Empty : extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateProperty(XmlNode uploadFieldConfigNode, global::umbraco.cms.businesslogic.Content content, string propertyAlias, object propertyValue)
|
||||
{
|
||||
XmlNode propertyNode = uploadFieldConfigNode.SelectSingleNode(propertyAlias);
|
||||
if (propertyNode != null && !String.IsNullOrEmpty(propertyNode.FirstChild.Value))
|
||||
{
|
||||
if (content.GenericProperties.Any(x => x.PropertyType.Alias == propertyNode.FirstChild.Value) && content.getProperty(propertyNode.FirstChild.Value) != null)
|
||||
{
|
||||
content.getProperty(propertyNode.FirstChild.Value).Value = propertyValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Tuple<int, int> GetDimensions(string path, IFileSystem fs)
|
||||
{
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Umbraco.Web.Templates
|
||||
/// </remarks>
|
||||
public static string ResolveUrlsFromTextString(string text)
|
||||
{
|
||||
if (LegacyUmbracoSettings.ResolveUrlsFromTextString)
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Content.ResolveUrlsFromTextString)
|
||||
{
|
||||
using (var timer = DisposableTimer.DebugDuration(typeof(IOHelper), "ResolveUrlsFromTextString starting", "ResolveUrlsFromTextString complete"))
|
||||
{
|
||||
|
||||
@@ -295,7 +295,6 @@
|
||||
<Compile Include="Cache\UserCacheRefresher.cs" />
|
||||
<Compile Include="Cache\UserPermissionsCacheRefresher.cs" />
|
||||
<Compile Include="Cache\UserTypeCacheRefresher.cs" />
|
||||
<Compile Include="Configuration\WebRouting.cs" />
|
||||
<Compile Include="Editors\AuthenticationController.cs" />
|
||||
<Compile Include="Editors\ContentController.cs" />
|
||||
<Compile Include="Controllers\ProfileController.cs" />
|
||||
@@ -481,11 +480,7 @@
|
||||
<Compile Include="Models\PartialViewMacroModel.cs" />
|
||||
<Compile Include="Models\PublishedContentBase.cs" />
|
||||
<Compile Include="Mvc\AreaRegistrationExtensions.cs" />
|
||||
<Compile Include="BaseRest\Configuration\BaseRestSection.cs" />
|
||||
<Compile Include="BaseRest\BaseRestHandler.cs" />
|
||||
<Compile Include="BaseRest\Configuration\ExtensionElement.cs" />
|
||||
<Compile Include="BaseRest\Configuration\ExtensionElementCollection.cs" />
|
||||
<Compile Include="BaseRest\Configuration\MethodElement.cs" />
|
||||
<Compile Include="BaseRest\MemberRest.cs" />
|
||||
<Compile Include="BaseRest\RestExtensionAttribute.cs" />
|
||||
<Compile Include="BaseRest\RestExtensionMethodAttribute.cs" />
|
||||
|
||||
@@ -17,7 +17,6 @@ using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Security;
|
||||
using umbraco;
|
||||
using GlobalSettings = Umbraco.Core.Configuration.GlobalSettings;
|
||||
using Umbraco.Web.Configuration;
|
||||
using ObjectExtensions = Umbraco.Core.ObjectExtensions;
|
||||
using RenderingEngine = Umbraco.Core.RenderingEngine;
|
||||
|
||||
@@ -320,7 +319,7 @@ namespace Umbraco.Web
|
||||
{
|
||||
LogHelper.Warn<UmbracoModule>("Umbraco is not ready");
|
||||
|
||||
if (!LegacyUmbracoSettings.EnableSplashWhileLoading)
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Content.EnableSplashWhileLoading == false)
|
||||
{
|
||||
// let requests pile up and wait for 10s then show the splash anyway
|
||||
ready = ApplicationContext.Current.WaitForReady(10 * 1000);
|
||||
@@ -330,9 +329,8 @@ namespace Umbraco.Web
|
||||
{
|
||||
httpContext.Response.StatusCode = 503;
|
||||
|
||||
var bootUrl = LegacyUmbracoSettings.BootSplashPage;
|
||||
if (string.IsNullOrWhiteSpace(bootUrl))
|
||||
bootUrl = "~/config/splashes/booting.aspx";
|
||||
var bootUrl = "~/config/splashes/booting.aspx";
|
||||
|
||||
httpContext.RewritePath(UriUtility.ToAbsolute(bootUrl) + "?url=" + HttpUtility.UrlEncode(uri.ToString()));
|
||||
|
||||
return false;
|
||||
@@ -399,7 +397,7 @@ namespace Umbraco.Web
|
||||
else if (pcr.Is404)
|
||||
{
|
||||
response.StatusCode = 404;
|
||||
response.TrySkipIisCustomErrors = LegacyUmbracoSettings.For<WebRouting>().TrySkipIisCustomErrors;
|
||||
response.TrySkipIisCustomErrors = UmbracoConfiguration.Current.UmbracoSettings.WebRouting.TrySkipIisCustomErrors;
|
||||
}
|
||||
|
||||
if (pcr.ResponseStatusCode > 0)
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace Umbraco.Web
|
||||
{
|
||||
try
|
||||
{
|
||||
var user = User.GetUser(LegacyUmbracoSettings.DistributedCallUser);
|
||||
var user = User.GetUser(UmbracoConfiguration.Current.UmbracoSettings.DistributedCall.UserId);
|
||||
return new System.Tuple<string, string>(user.LoginName, user.GetPassword());
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Web;
|
||||
using System.Xml;
|
||||
using System.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.businesslogic;
|
||||
@@ -193,8 +194,8 @@ namespace umbraco
|
||||
xNode.Text = t.Text;
|
||||
xNode.Source = GetTreeServiceUrl(t.Id);
|
||||
xNode.HasChildren = t.HasChildren;
|
||||
|
||||
if (Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc && ViewHelper.ViewExists(t))
|
||||
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc && ViewHelper.ViewExists(t))
|
||||
{
|
||||
xNode.Action = "javascript:openView(" + t.Id + ");";
|
||||
xNode.Icon = "icon-newspaper-alt";
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Data;
|
||||
using System.Web.Security;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Web.UI;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.DataLayer;
|
||||
@@ -19,7 +20,7 @@ namespace umbraco
|
||||
var masterId = ParentID;
|
||||
|
||||
var editor = "settings/editTemplate.aspx";
|
||||
if(Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc)
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc)
|
||||
editor = "settings/views/editView.aspx";
|
||||
|
||||
if (masterId > 0)
|
||||
|
||||
@@ -11,6 +11,7 @@ using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.IO;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using System.Linq;
|
||||
@@ -49,34 +50,34 @@ namespace umbraco.cms.presentation.settings.scripts
|
||||
|
||||
string path = "";
|
||||
if (file.StartsWith("~/"))
|
||||
path = Umbraco.Core.IO.IOHelper.ResolveUrl(file);
|
||||
path = IOHelper.ResolveUrl(file);
|
||||
else
|
||||
path = Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Scripts + "/" + file);
|
||||
path = IOHelper.ResolveUrl(SystemDirectories.Scripts + "/" + file);
|
||||
|
||||
|
||||
lttPath.Text = "<a target='_blank' href='" + path + "'>" + path + "</a>";
|
||||
|
||||
var exts = UmbracoSettings.ScriptFileTypes.Split(',').ToList();
|
||||
if (Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc)
|
||||
var exts = UmbracoConfiguration.Current.UmbracoSettings.Content.ScriptEditor.ScriptFileTypes.ToList();
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc)
|
||||
{
|
||||
exts.Add("cshtml");
|
||||
exts.Add("vbhtml");
|
||||
}
|
||||
|
||||
var dirs = Umbraco.Core.IO.SystemDirectories.Scripts;
|
||||
if (Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc)
|
||||
dirs += "," + Umbraco.Core.IO.SystemDirectories.MvcViews;
|
||||
var dirs = SystemDirectories.Scripts;
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc)
|
||||
dirs += "," + SystemDirectories.MvcViews;
|
||||
|
||||
// validate file
|
||||
Umbraco.Core.IO.IOHelper.ValidateEditPath(Umbraco.Core.IO.IOHelper.MapPath(path), dirs.Split(','));
|
||||
IOHelper.ValidateEditPath(IOHelper.MapPath(path), dirs.Split(','));
|
||||
|
||||
// validate extension
|
||||
Umbraco.Core.IO.IOHelper.ValidateFileExtension(Umbraco.Core.IO.IOHelper.MapPath(path), exts);
|
||||
IOHelper.ValidateFileExtension(IOHelper.MapPath(path), exts);
|
||||
|
||||
|
||||
StreamReader SR;
|
||||
string S;
|
||||
SR = File.OpenText(Umbraco.Core.IO.IOHelper.MapPath(path));
|
||||
SR = File.OpenText(IOHelper.MapPath(path));
|
||||
S = SR.ReadToEnd();
|
||||
SR.Close();
|
||||
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Caching;
|
||||
using System.Xml;
|
||||
using Umbraco.Core;
|
||||
using System.Collections.Generic;
|
||||
using umbraco.MacroEngines;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using RazorDataTypeModelStaticMappingItem = umbraco.MacroEngines.RazorDataTypeModelStaticMappingItem;
|
||||
|
||||
namespace umbraco
|
||||
{
|
||||
/// <summary>
|
||||
/// The UmbracoSettings Class contains general settings information for the entire Umbraco instance based on information from the /config/umbracoSettings.config file
|
||||
/// </summary>
|
||||
[Obsolete("Use UmbracoConfiguration.Current.UmbracoSettings instead, it offers all settings in strongly typed formats. This class will be removed in future versions.")]
|
||||
public class UmbracoSettings
|
||||
{
|
||||
public const string TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME = ""; // "children";
|
||||
@@ -20,36 +26,11 @@ namespace umbraco
|
||||
/// <value>The _umbraco settings.</value>
|
||||
public static XmlDocument _umbracoSettings
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UmbracoSettingsXmlDoc; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the settings file path, the setter can be used in unit tests
|
||||
/// </summary>
|
||||
internal static string SettingsFilePath
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.SettingsFilePath; }
|
||||
set { Umbraco.Core.Configuration.LegacyUmbracoSettings.SettingsFilePath = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects a xml node in the umbraco settings config file.
|
||||
/// </summary>
|
||||
/// <param name="Key">The xpath query to the specific node.</param>
|
||||
/// <returns>If found, it returns the specific configuration xml node.</returns>
|
||||
public static XmlNode GetKeyAsNode(string Key)
|
||||
{
|
||||
return Umbraco.Core.Configuration.LegacyUmbracoSettings.GetKeyAsNode(Key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of configuration xml node with the specified key.
|
||||
/// </summary>
|
||||
/// <param name="Key">The key.</param>
|
||||
/// <returns></returns>
|
||||
public static string GetKey(string Key)
|
||||
{
|
||||
return Umbraco.Core.Configuration.LegacyUmbracoSettings.GetKey(Key);
|
||||
get
|
||||
{
|
||||
var us = (XmlDocument)HttpRuntime.Cache["umbracoSettingsFile"] ?? EnsureSettingsDocument();
|
||||
return us;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -60,7 +41,7 @@ namespace umbraco
|
||||
/// </value>
|
||||
public static bool UploadAllowDirectories
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UploadAllowDirectories; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -69,7 +50,7 @@ namespace umbraco
|
||||
/// <value><c>true</c> if logging is enabled; otherwise, <c>false</c>.</value>
|
||||
public static bool EnableLogging
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.EnableLogging; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.EnableLogging; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -78,7 +59,7 @@ namespace umbraco
|
||||
/// <value><c>true</c> if async logging is enabled; otherwise, <c>false</c>.</value>
|
||||
public static bool EnableAsyncLogging
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.EnableAsyncLogging; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.EnableAsyncLogging; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -86,14 +67,14 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static string ExternalLoggerAssembly
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ExternalLoggerAssembly; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.ExternalLogger.Assembly; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the type of an external logger that can be used to store log items in 3rd party systems
|
||||
/// </summary>
|
||||
public static string ExternalLoggerType
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ExternalLoggerType; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.ExternalLogger.ExternalLoggerType; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -101,7 +82,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static bool ExternalLoggerLogAuditTrail
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ExternalLoggerLogAuditTrail; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.ExternalLogger.LogAuditTrail; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -109,7 +90,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static bool KeepUserLoggedIn
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.KeepUserLoggedIn; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Security.KeepUserLoggedIn; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -117,7 +98,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static bool EnableCanvasEditing
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.EnableCanvasEditing; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.EnableCanvasEditing; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -125,7 +106,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static bool HideDisabledUsersInBackoffice
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.HideDisabledUsersInBackoffice; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Security.HideDisabledUsersInBackoffice; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -134,7 +115,7 @@ namespace umbraco
|
||||
/// <value><c>true</c> if logs are to be automatically cleaned; otherwise, <c>false</c></value>
|
||||
public static bool AutoCleanLogs
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.AutoCleanLogs; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.AutoCleanLogs; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -142,12 +123,12 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static int CleaningMiliseconds
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.CleaningMiliseconds; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.CleaningMiliseconds; }
|
||||
}
|
||||
|
||||
public static int MaxLogAge
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.MaxLogAge; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.MaxLogAge; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -156,7 +137,7 @@ namespace umbraco
|
||||
/// <value>The disabled log types.</value>
|
||||
public static XmlNode DisabledLogTypes
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.DisabledLogTypes; }
|
||||
get { return GetKeyAsNode("/settings/logging/disabledLogTypes"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -165,7 +146,7 @@ namespace umbraco
|
||||
/// <value>The package server url.</value>
|
||||
public static string PackageServer
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.PackageServer; }
|
||||
get { return "packages.umbraco.org"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -174,7 +155,7 @@ namespace umbraco
|
||||
/// <value><c>true</c> if umbraco will use domain prefixes; otherwise, <c>false</c>.</value>
|
||||
public static bool UseDomainPrefixes
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UseDomainPrefixes; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.UseDomainPrefixes; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -183,7 +164,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static bool AddTrailingSlash
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.AddTrailingSlash; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.AddTrailingSlash; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -192,7 +173,7 @@ namespace umbraco
|
||||
/// <value><c>true</c> if umbraco will use ASP.NET MasterPages; otherwise, <c>false</c>.</value>
|
||||
public static bool UseAspNetMasterPages
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UseAspNetMasterPages; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages; }
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +183,7 @@ namespace umbraco
|
||||
/// <value><c>true</c> if umbraco will override templates with skins if present and configured <c>false</c>.</value>
|
||||
public static bool EnableTemplateFolders
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.EnableTemplateFolders; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Templates.EnableTemplateFolders; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -210,14 +191,14 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static List<string> NotDynamicXmlDocumentElements
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.NotDynamicXmlDocumentElements.ToList(); }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Scripting.Razor.NotDynamicXmlDocumentElements.Select(x => x.Element).ToList(); }
|
||||
}
|
||||
|
||||
public static List<RazorDataTypeModelStaticMappingItem> RazorDataTypeModelStaticMapping
|
||||
{
|
||||
get
|
||||
{
|
||||
var mapping = Umbraco.Core.Configuration.LegacyUmbracoSettings.RazorDataTypeModelStaticMapping;
|
||||
var mapping = UmbracoConfiguration.Current.UmbracoSettings.Scripting.Razor.DataTypeModelStaticMappings;
|
||||
|
||||
//now we need to map to the old object until we can clean all this nonsense up
|
||||
return mapping.Select(x => new RazorDataTypeModelStaticMappingItem()
|
||||
@@ -225,8 +206,8 @@ namespace umbraco
|
||||
DataTypeGuid = x.DataTypeGuid,
|
||||
NodeTypeAlias = x.NodeTypeAlias,
|
||||
PropertyTypeAlias = x.PropertyTypeAlias,
|
||||
Raw = x.Raw,
|
||||
TypeName = x.TypeName
|
||||
Raw = string.Empty,
|
||||
TypeName = x.MappingName
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
@@ -239,7 +220,7 @@ namespace umbraco
|
||||
/// </value>
|
||||
public static bool CloneXmlCacheOnPublish
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.CloneXmlCacheOnPublish; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.CloneXmlContent; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -248,7 +229,7 @@ namespace umbraco
|
||||
/// <value><c>true</c> if content is parsed; otherwise, <c>false</c>.</value>
|
||||
public static bool TidyEditorContent
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.TidyEditorContent; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.TidyEditorContent; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -257,7 +238,7 @@ namespace umbraco
|
||||
/// <value>The encoding type as string.</value>
|
||||
public static string TidyCharEncoding
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.TidyCharEncoding; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.TidyCharEncoding; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -266,12 +247,12 @@ namespace umbraco
|
||||
/// <value>The property context help option.</value>
|
||||
public static string PropertyContextHelpOption
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.PropertyContextHelpOption; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.PropertyContextHelpOption; }
|
||||
}
|
||||
|
||||
public static string DefaultBackofficeProvider
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultBackofficeProvider; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -279,7 +260,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static bool ForceSafeAliases
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ForceSafeAliases; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.ForceSafeAliases; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -287,7 +268,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static IEnumerable<string> DisallowedUploadFiles
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.DisallowedUploadFiles; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.DisallowedUploadFiles; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -296,7 +277,7 @@ namespace umbraco
|
||||
/// <value>The allowed image file types.</value>
|
||||
public static string ImageFileTypes
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ImageFileTypes; }
|
||||
get { return string.Join(",", UmbracoConfiguration.Current.UmbracoSettings.Content.Imaging.ImageFileTypes.Select(x => x.ToLowerInvariant())); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -305,7 +286,7 @@ namespace umbraco
|
||||
/// <value>The allowed script file types.</value>
|
||||
public static string ScriptFileTypes
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ScriptFileTypes; }
|
||||
get { return string.Join(",", UmbracoConfiguration.Current.UmbracoSettings.Content.ScriptEditor.ScriptFileTypes); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -314,7 +295,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static int UmbracoLibraryCacheDuration
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UmbracoLibraryCacheDuration; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.UmbracoLibraryCacheDuration; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -323,7 +304,7 @@ namespace umbraco
|
||||
/// <value>The script folder path.</value>
|
||||
public static string ScriptFolderPath
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ScriptFolderPath; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.ScriptEditor.ScriptFolderPath; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -331,7 +312,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static bool ScriptDisableEditor
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ScriptDisableEditor; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.ScriptEditor.DisableScriptEditor; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -342,7 +323,7 @@ namespace umbraco
|
||||
/// <value><c>true</c> if umbraco ensures unique node naming; otherwise, <c>false</c>.</value>
|
||||
public static bool EnsureUniqueNaming
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.EnsureUniqueNaming; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.EnsureUniqueNaming; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -351,7 +332,7 @@ namespace umbraco
|
||||
/// <value>The notification email sender.</value>
|
||||
public static string NotificationEmailSender
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.NotificationEmailSender; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.Notifications.EmailAddress; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -362,7 +343,7 @@ namespace umbraco
|
||||
/// </value>
|
||||
public static bool NotificationDisableHtmlEmail
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.NotificationDisableHtmlEmail; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.Notifications.DisableHtmlEmail; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -371,12 +352,12 @@ namespace umbraco
|
||||
/// <value>The allowed attributes on images.</value>
|
||||
public static string ImageAllowedAttributes
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ImageAllowedAttributes; }
|
||||
get { return string.Join(",", UmbracoConfiguration.Current.UmbracoSettings.Content.Imaging.AllowedAttributes); }
|
||||
}
|
||||
|
||||
public static XmlNode ImageAutoFillImageProperties
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ImageAutoFillImageProperties; }
|
||||
get { return GetKeyAsNode("/settings/content/imaging/autoFillImageProperties"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -385,7 +366,7 @@ namespace umbraco
|
||||
/// <value>The scheduled tasks.</value>
|
||||
public static XmlNode ScheduledTasks
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ScheduledTasks; }
|
||||
get { return GetKeyAsNode("/settings/scheduledTasks"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -394,7 +375,7 @@ namespace umbraco
|
||||
/// <value>The URL replacement characters.</value>
|
||||
public static XmlNode UrlReplaceCharacters
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UrlReplaceCharacters; }
|
||||
get { return GetKeyAsNode("/settings/requestHandler/urlReplacing"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -402,7 +383,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static bool RemoveDoubleDashesFromUrlReplacing
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.RemoveDoubleDashesFromUrlReplacing; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.UrlReplacing.RemoveDoubleDashes; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -413,7 +394,7 @@ namespace umbraco
|
||||
/// <value><c>true</c> if umbraco uses distributed calls; otherwise, <c>false</c>.</value>
|
||||
public static bool UseDistributedCalls
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UseDistributedCalls; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.DistributedCall.Enabled; }
|
||||
}
|
||||
|
||||
|
||||
@@ -423,7 +404,7 @@ namespace umbraco
|
||||
/// <value>The distributed call user.</value>
|
||||
public static int DistributedCallUser
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.DistributedCallUser; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.DistributedCall.UserId; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -431,7 +412,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static string PreviewBadge
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.PreviewBadge; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.PreviewBadge; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -442,7 +423,17 @@ namespace umbraco
|
||||
/// <value>The distribution servers.</value>
|
||||
public static XmlNode DistributionServers
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.DistributionServers; }
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return GetKeyAsNode("/settings/distributedCall/servers");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -452,7 +443,17 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static XmlNode HelpPages
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.HelpPages; }
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return GetKeyAsNode("/settings/help");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -464,7 +465,17 @@ namespace umbraco
|
||||
/// <value>The repository servers.</value>
|
||||
public static XmlNode Repositories
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.Repositories; }
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return GetKeyAsNode("/settings/repositories");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -477,7 +488,7 @@ namespace umbraco
|
||||
/// </value>
|
||||
public static bool UseViewstateMoverModule
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UseViewstateMoverModule; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.ViewstateMoverModule.Enable; }
|
||||
}
|
||||
|
||||
|
||||
@@ -487,7 +498,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static bool isXmlContentCacheDisabled
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.IsXmlContentCacheDisabled; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.XmlCacheEnabled; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -497,7 +508,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static bool XmlContentCheckForDiskChanges
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.XmlContentCheckForDiskChanges; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.XmlContentCheckForDiskChanges; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -507,7 +518,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static bool EnableGlobalPreviewStorage
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.EnableGlobalPreviewStorage; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.GlobalPreviewStorageEnabled; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -518,18 +529,31 @@ namespace umbraco
|
||||
/// </value>
|
||||
public static bool UseLegacyXmlSchema
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UseLegacyXmlSchema; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema; }
|
||||
}
|
||||
|
||||
public static IEnumerable<string> AppCodeFileExtensionsList
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.AppCodeFileExtensionsList; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Developer.AppCodeFileExtensions.Select(x => x.Extension); }
|
||||
}
|
||||
|
||||
[Obsolete("Use AppCodeFileExtensionsList instead")]
|
||||
public static XmlNode AppCodeFileExtensions
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.AppCodeFileExtensions; }
|
||||
get
|
||||
{
|
||||
XmlNode value = GetKeyAsNode("/settings/developer/appCodeFileExtensions");
|
||||
if (value != null)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
// default is .cs and .vb
|
||||
value = _umbracoSettings.CreateElement("appCodeFileExtensions");
|
||||
value.AppendChild(XmlHelper.AddTextNode(_umbracoSettings, "ext", "cs"));
|
||||
value.AppendChild(XmlHelper.AddTextNode(_umbracoSettings, "ext", "vb"));
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -538,7 +562,7 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static bool continouslyUpdateXmlDiskCache
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ContinouslyUpdateXmlDiskCache; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.ContinouslyUpdateXmlDiskCache; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -549,12 +573,12 @@ namespace umbraco
|
||||
/// </summary>
|
||||
public static bool EnableSplashWhileLoading
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.EnableSplashWhileLoading; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.EnableSplashWhileLoading; }
|
||||
}
|
||||
|
||||
public static bool ResolveUrlsFromTextString
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ResolveUrlsFromTextString; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.ResolveUrlsFromTextString; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -566,7 +590,7 @@ namespace umbraco
|
||||
/// <value>MacroErrorBehaviour enum defining how to handle macro errors.</value>
|
||||
public static MacroErrorBehaviour MacroErrorBehaviour
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.MacroErrorBehaviour; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.MacroErrorBehaviour; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -578,7 +602,7 @@ namespace umbraco
|
||||
/// <value>MacroErrorBehaviour enum defining how to show icons in the document type editor.</value>
|
||||
public static IconPickerBehaviour IconPickerBehaviour
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.IconPickerBehaviour; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.IconPickerBehaviour; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -588,7 +612,107 @@ namespace umbraco
|
||||
/// <remarks>If undefined, 'Textstring' is the default</remarks>
|
||||
public static string DefaultDocumentTypeProperty
|
||||
{
|
||||
get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultDocumentTypeProperty; }
|
||||
get { return UmbracoConfiguration.Current.UmbracoSettings.Content.DefaultDocumentTypeProperty; }
|
||||
}
|
||||
|
||||
private static string _path;
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the settings file path, the setter can be used in unit tests
|
||||
/// </summary>
|
||||
internal static string SettingsFilePath
|
||||
{
|
||||
get { return _path ?? (_path = GlobalSettings.FullpathToRoot + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar); }
|
||||
set { _path = value; }
|
||||
}
|
||||
|
||||
internal const string Filename = "umbracoSettings.config";
|
||||
|
||||
internal static XmlDocument EnsureSettingsDocument()
|
||||
{
|
||||
var settingsFile = HttpRuntime.Cache["umbracoSettingsFile"];
|
||||
|
||||
// Check for language file in cache
|
||||
if (settingsFile == null)
|
||||
{
|
||||
var temp = new XmlDocument();
|
||||
var settingsReader = new XmlTextReader(SettingsFilePath + Filename);
|
||||
try
|
||||
{
|
||||
temp.Load(settingsReader);
|
||||
HttpRuntime.Cache.Insert("umbracoSettingsFile", temp,
|
||||
new CacheDependency(SettingsFilePath + Filename));
|
||||
}
|
||||
catch (XmlException e)
|
||||
{
|
||||
throw new XmlException("Your umbracoSettings.config file fails to pass as valid XML. Refer to the InnerException for more information", e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHelper.Error<UmbracoSettings>("Error reading umbracoSettings file: " + e.ToString(), e);
|
||||
}
|
||||
settingsReader.Close();
|
||||
return temp;
|
||||
}
|
||||
else
|
||||
return (XmlDocument)settingsFile;
|
||||
}
|
||||
|
||||
internal static void Save()
|
||||
{
|
||||
_umbracoSettings.Save(SettingsFilePath + Filename);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Selects a xml node in the umbraco settings config file.
|
||||
/// </summary>
|
||||
/// <param name="key">The xpath query to the specific node.</param>
|
||||
/// <returns>If found, it returns the specific configuration xml node.</returns>
|
||||
internal static XmlNode GetKeyAsNode(string key)
|
||||
{
|
||||
if (key == null)
|
||||
throw new ArgumentException("Key cannot be null");
|
||||
EnsureSettingsDocument();
|
||||
if (_umbracoSettings == null || _umbracoSettings.DocumentElement == null)
|
||||
return null;
|
||||
return _umbracoSettings.DocumentElement.SelectSingleNode(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of configuration xml node with the specified key.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns></returns>
|
||||
internal static string GetKey(string key)
|
||||
{
|
||||
EnsureSettingsDocument();
|
||||
|
||||
string attrName = null;
|
||||
var pos = key.IndexOf('@');
|
||||
if (pos > 0)
|
||||
{
|
||||
attrName = key.Substring(pos + 1);
|
||||
key = key.Substring(0, pos - 1);
|
||||
}
|
||||
|
||||
var node = _umbracoSettings.DocumentElement.SelectSingleNode(key);
|
||||
if (node == null)
|
||||
return string.Empty;
|
||||
|
||||
if (pos < 0)
|
||||
{
|
||||
if (node.FirstChild == null || node.FirstChild.Value == null)
|
||||
return string.Empty;
|
||||
return node.FirstChild.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
var attr = node.Attributes[attrName];
|
||||
if (attr == null)
|
||||
return string.Empty;
|
||||
return attr.Value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Collections;
|
||||
using System.Xml;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.DataLayer;
|
||||
@@ -154,7 +155,7 @@ namespace umbraco.cms.businesslogic.template
|
||||
}
|
||||
dr.Close();
|
||||
|
||||
if (Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc && ViewHelper.ViewExists(this))
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc && ViewHelper.ViewExists(this))
|
||||
_design = ViewHelper.GetFileContents(this);
|
||||
else
|
||||
_design = MasterPageHelper.GetFileContents(this);
|
||||
@@ -265,7 +266,7 @@ namespace umbraco.cms.businesslogic.template
|
||||
_design = value.Trim(NewLineChars);
|
||||
|
||||
//we only switch to MVC View editing if the template has a view file, and MVC editing is enabled
|
||||
if (Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc && !MasterPageHelper.IsMasterPageSyntax(_design))
|
||||
if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc && !MasterPageHelper.IsMasterPageSyntax(_design))
|
||||
{
|
||||
MasterPageHelper.RemoveMasterPageFile(this.Alias);
|
||||
MasterPageHelper.RemoveMasterPageFile(_oldAlias);
|
||||
@@ -351,7 +352,7 @@ namespace umbraco.cms.businesslogic.template
|
||||
/// </remarks>
|
||||
private static RenderingEngine DetermineRenderingEngine(Template t, string design = null)
|
||||
{
|
||||
var engine = Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultRenderingEngine;
|
||||
var engine = UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine;
|
||||
|
||||
if (!design.IsNullOrWhiteSpace() && MasterPageHelper.IsMasterPageSyntax(design))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user