Merge remote-tracking branch 'origin/6.2.0' into 7.0.0
Conflicts: src/Umbraco.Core/ObjectResolution/Resolution.cs
This commit is contained in:
@@ -316,14 +316,17 @@ namespace Umbraco.Core
|
||||
PropertyValueConvertersResolver.Current = new PropertyValueConvertersResolver(
|
||||
PluginManager.Current.ResolvePropertyValueConverters());
|
||||
|
||||
// this is how we'd switch over to DefaultShortStringHelper _and_ still use
|
||||
// UmbracoSettings UrlReplaceCharacters...
|
||||
//ShortStringHelperResolver.Current = new ShortStringHelperResolver(
|
||||
// new DefaultShortStringHelper().WithConfig(DefaultShortStringHelper.ApplyUrlReplaceCharacters));
|
||||
|
||||
// use the Legacy one for now
|
||||
// use the new DefaultShortStringHelper but sort-of remain compatible
|
||||
// - use UmbracoSettings UrlReplaceCharacters
|
||||
// - allow underscores in terms, allow leading digits
|
||||
ShortStringHelperResolver.Current = new ShortStringHelperResolver(
|
||||
new LegacyShortStringHelper());
|
||||
new DefaultShortStringHelper()
|
||||
.WithConfig(CleanStringType.Url, DefaultShortStringHelper.ApplyUrlReplaceCharacters,
|
||||
allowUnderscoreInTerm: true, allowLeadingDigits: true));
|
||||
|
||||
// that was the old one
|
||||
//ShortStringHelperResolver.Current = new ShortStringHelperResolver(
|
||||
// new LegacyShortStringHelper());
|
||||
|
||||
UrlSegmentProviderResolver.Current = new UrlSegmentProviderResolver(
|
||||
typeof (DefaultUrlSegmentProvider));
|
||||
|
||||
@@ -13,14 +13,23 @@ namespace Umbraco.Core
|
||||
{
|
||||
public static IEnumerable<IEnumerable<T>> InGroupsOf<T>(this IEnumerable<T> source, int groupSize)
|
||||
{
|
||||
var i = 0;
|
||||
var length = source.Count();
|
||||
if (source == null)
|
||||
throw new NullReferenceException("source");
|
||||
|
||||
while ((i * groupSize) < length)
|
||||
// enumerate the source only once!
|
||||
var enumerator = source.GetEnumerator();
|
||||
|
||||
while (enumerator.MoveNext())
|
||||
yield return EnumerateGroup(enumerator, groupSize);
|
||||
}
|
||||
|
||||
private static IEnumerable<T> EnumerateGroup<T>(IEnumerator<T> enumerator, int count)
|
||||
{
|
||||
var c = 1;
|
||||
do
|
||||
{
|
||||
yield return source.Skip(i * groupSize).Take(groupSize);
|
||||
i++;
|
||||
}
|
||||
yield return enumerator.Current;
|
||||
} while (c++ < count && enumerator.MoveNext());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
@@ -128,6 +129,14 @@ namespace Umbraco.Core.ObjectResolution
|
||||
{
|
||||
LogHelper.Debug(typeof(Resolution), "Resetting resolution");
|
||||
|
||||
/*
|
||||
var trace = new System.Diagnostics.StackTrace();
|
||||
var testing = trace.GetFrames().Any(frame =>
|
||||
frame.GetMethod().DeclaringType.FullName.StartsWith("Umbraco.Tests"));
|
||||
if (testing == false)
|
||||
throw new InvalidOperationException("Only unit tests can reset configuration.");
|
||||
*/
|
||||
|
||||
using (new WriteLock(ConfigurationLock))
|
||||
{
|
||||
_isFrozen = false;
|
||||
|
||||
@@ -846,8 +846,21 @@ namespace Umbraco.Core
|
||||
/// does initialise the resolver.</remarks>
|
||||
private static IShortStringHelper ShortStringHelper
|
||||
{
|
||||
get { return ShortStringHelperResolver.HasCurrent ? ShortStringHelperResolver.Current.Helper : new LegacyShortStringHelper(); }
|
||||
get
|
||||
{
|
||||
if (ShortStringHelperResolver.HasCurrent)
|
||||
return ShortStringHelperResolver.Current.Helper;
|
||||
if (_helper != null)
|
||||
return _helper;
|
||||
|
||||
// there *has* to be a short string helper, even if the resolver has not
|
||||
// been initialized - used the default one with default configuration.
|
||||
_helper = new DefaultShortStringHelper().WithConfig(allowLeadingDigits: true);
|
||||
_helper.Freeze();
|
||||
return _helper;
|
||||
}
|
||||
}
|
||||
private static IShortStringHelper _helper;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a new string in which all occurences of specified strings are replaced by other specified strings.
|
||||
|
||||
@@ -1190,8 +1190,11 @@ namespace umbraco
|
||||
break;
|
||||
|
||||
case "mediaCurrent":
|
||||
var c = new Content(int.Parse(macroPropertyValue));
|
||||
macroXmlNode.AppendChild(macroXml.ImportNode(c.ToXml(umbraco.content.Instance.XmlContent, false), true));
|
||||
if (string.IsNullOrEmpty(macroPropertyValue) == false)
|
||||
{
|
||||
var c = new Content(int.Parse(macroPropertyValue));
|
||||
macroXmlNode.AppendChild(macroXml.ImportNode(c.ToXml(umbraco.content.Instance.XmlContent, false), true));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user