Fix build after rebase
This commit is contained in:
@@ -94,7 +94,7 @@ namespace Umbraco.Core
|
||||
return Attempt<object>.Succeed(null);
|
||||
|
||||
// value type is nok, else can be null, so is ok
|
||||
return Attempt<object>.SucceedIf(destinationType.IsValueType == false, null);
|
||||
return Attempt<object>.If(destinationType.IsValueType == false, null);
|
||||
}
|
||||
|
||||
// easy
|
||||
@@ -251,7 +251,7 @@ namespace Umbraco.Core
|
||||
// makes sense that string "100.01" *also* converts to integer 100.
|
||||
decimal value2;
|
||||
var input2 = NormalizeNumberDecimalSeparator(input);
|
||||
return Attempt<object>.SucceedIf(decimal.TryParse(input2, out value2), Convert.ToInt32(value2));
|
||||
return Attempt<object>.If(decimal.TryParse(input2, out value2), Convert.ToInt32(value2));
|
||||
}
|
||||
|
||||
if (destinationType == typeof(long)) // aka Int64
|
||||
@@ -262,7 +262,7 @@ namespace Umbraco.Core
|
||||
// same as int
|
||||
decimal value2;
|
||||
var input2 = NormalizeNumberDecimalSeparator(input);
|
||||
return Attempt<object>.SucceedIf(decimal.TryParse(input2, out value2), Convert.ToInt64(value2));
|
||||
return Attempt<object>.If(decimal.TryParse(input2, out value2), Convert.ToInt64(value2));
|
||||
}
|
||||
|
||||
// fixme - should we do the decimal trick for short, byte, unsigned?
|
||||
@@ -278,63 +278,63 @@ namespace Umbraco.Core
|
||||
if (destinationType == typeof(short)) // aka Int16
|
||||
{
|
||||
short value;
|
||||
return Attempt<object>.SucceedIf(short.TryParse(input, out value), value);
|
||||
return Attempt<object>.If(short.TryParse(input, out value), value);
|
||||
}
|
||||
|
||||
if (destinationType == typeof(double)) // aka Double
|
||||
{
|
||||
double value;
|
||||
var input2 = NormalizeNumberDecimalSeparator(input);
|
||||
return Attempt<object>.SucceedIf(double.TryParse(input2, out value), value);
|
||||
return Attempt<object>.If(double.TryParse(input2, out value), value);
|
||||
}
|
||||
|
||||
if (destinationType == typeof(float)) // aka Single
|
||||
{
|
||||
float value;
|
||||
var input2 = NormalizeNumberDecimalSeparator(input);
|
||||
return Attempt<object>.SucceedIf(float.TryParse(input2, out value), value);
|
||||
return Attempt<object>.If(float.TryParse(input2, out value), value);
|
||||
}
|
||||
|
||||
if (destinationType == typeof(char)) // aka Char
|
||||
{
|
||||
char value;
|
||||
return Attempt<object>.SucceedIf(char.TryParse(input, out value), value);
|
||||
return Attempt<object>.If(char.TryParse(input, out value), value);
|
||||
}
|
||||
|
||||
if (destinationType == typeof(byte)) // aka Byte
|
||||
{
|
||||
byte value;
|
||||
return Attempt<object>.SucceedIf(byte.TryParse(input, out value), value);
|
||||
return Attempt<object>.If(byte.TryParse(input, out value), value);
|
||||
}
|
||||
|
||||
if (destinationType == typeof(sbyte)) // aka SByte
|
||||
{
|
||||
sbyte value;
|
||||
return Attempt<object>.SucceedIf(sbyte.TryParse(input, out value), value);
|
||||
return Attempt<object>.If(sbyte.TryParse(input, out value), value);
|
||||
}
|
||||
|
||||
if (destinationType == typeof(uint)) // aka UInt32
|
||||
{
|
||||
uint value;
|
||||
return Attempt<object>.SucceedIf(uint.TryParse(input, out value), value);
|
||||
return Attempt<object>.If(uint.TryParse(input, out value), value);
|
||||
}
|
||||
|
||||
if (destinationType == typeof(ushort)) // aka UInt16
|
||||
{
|
||||
ushort value;
|
||||
return Attempt<object>.SucceedIf(ushort.TryParse(input, out value), value);
|
||||
return Attempt<object>.If(ushort.TryParse(input, out value), value);
|
||||
}
|
||||
|
||||
if (destinationType == typeof(ulong)) // aka UInt64
|
||||
{
|
||||
ulong value;
|
||||
return Attempt<object>.SucceedIf(ulong.TryParse(input, out value), value);
|
||||
return Attempt<object>.If(ulong.TryParse(input, out value), value);
|
||||
}
|
||||
}
|
||||
else if (destinationType == typeof(Guid))
|
||||
{
|
||||
Guid value;
|
||||
return Attempt<object>.SucceedIf(Guid.TryParse(input, out value), value);
|
||||
return Attempt<object>.If(Guid.TryParse(input, out value), value);
|
||||
}
|
||||
else if (destinationType == typeof(DateTime))
|
||||
{
|
||||
@@ -357,23 +357,23 @@ namespace Umbraco.Core
|
||||
else if (destinationType == typeof(DateTimeOffset))
|
||||
{
|
||||
DateTimeOffset value;
|
||||
return Attempt<object>.SucceedIf(DateTimeOffset.TryParse(input, out value), value);
|
||||
return Attempt<object>.If(DateTimeOffset.TryParse(input, out value), value);
|
||||
}
|
||||
else if (destinationType == typeof(TimeSpan))
|
||||
{
|
||||
TimeSpan value;
|
||||
return Attempt<object>.SucceedIf(TimeSpan.TryParse(input, out value), value);
|
||||
return Attempt<object>.If(TimeSpan.TryParse(input, out value), value);
|
||||
}
|
||||
else if (destinationType == typeof(decimal)) // aka Decimal
|
||||
{
|
||||
decimal value;
|
||||
var input2 = NormalizeNumberDecimalSeparator(input);
|
||||
return Attempt<object>.SucceedIf(decimal.TryParse(input2, out value), value);
|
||||
return Attempt<object>.If(decimal.TryParse(input2, out value), value);
|
||||
}
|
||||
else if (destinationType == typeof(Version))
|
||||
{
|
||||
Version value;
|
||||
return Attempt<object>.SucceedIf(Version.TryParse(input, out value), value);
|
||||
return Attempt<object>.If(Version.TryParse(input, out value), value);
|
||||
}
|
||||
// E_NOTIMPL IPAddress, BigInteger
|
||||
|
||||
|
||||
@@ -264,8 +264,8 @@ namespace Umbraco.Core.Persistence
|
||||
// this method provides a way to force-reset the variable
|
||||
internal void ResetForTests()
|
||||
{
|
||||
var db = _scopeContextAdapter.Get(HttpItemKey) as UmbracoDatabase;
|
||||
_scopeContextAdapter.Clear(HttpItemKey);
|
||||
var db = _umbracoDatabaseAccessor.UmbracoDatabase;
|
||||
_umbracoDatabaseAccessor.UmbracoDatabase = null;
|
||||
db?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,10 +78,10 @@ namespace Umbraco.Web.HealthCheck.Checks.Permissions
|
||||
};
|
||||
|
||||
// Run checks for required and optional paths for modify permission
|
||||
List<string> requiredFailedPaths;
|
||||
List<string> optionalFailedPaths;
|
||||
var requiredPathCheckResult = FilePermissionHelper.TestDirectories(GetPathsToCheck(pathsToCheck, PermissionCheckRequirement.Required), out requiredFailedPaths);
|
||||
var optionalPathCheckResult = FilePermissionHelper.TestDirectories(GetPathsToCheck(pathsToCheck, PermissionCheckRequirement.Optional), out optionalFailedPaths);
|
||||
IEnumerable<string> requiredFailedPaths;
|
||||
IEnumerable<string> optionalFailedPaths;
|
||||
var requiredPathCheckResult = FilePermissionHelper.EnsureDirectories(GetPathsToCheck(pathsToCheck, PermissionCheckRequirement.Required), out requiredFailedPaths);
|
||||
var optionalPathCheckResult = FilePermissionHelper.EnsureDirectories(GetPathsToCheck(pathsToCheck, PermissionCheckRequirement.Optional), out optionalFailedPaths);
|
||||
|
||||
return GetStatus(requiredPathCheckResult, requiredFailedPaths, optionalPathCheckResult, optionalFailedPaths, PermissionCheckFor.Folder);
|
||||
}
|
||||
@@ -96,10 +96,10 @@ namespace Umbraco.Web.HealthCheck.Checks.Permissions
|
||||
};
|
||||
|
||||
// Run checks for required and optional paths for modify permission
|
||||
List<string> requiredFailedPaths;
|
||||
List<string> optionalFailedPaths;
|
||||
var requiredPathCheckResult = FilePermissionHelper.TestFiles(GetPathsToCheck(pathsToCheck, PermissionCheckRequirement.Required), out requiredFailedPaths);
|
||||
var optionalPathCheckResult = FilePermissionHelper.TestFiles(GetPathsToCheck(pathsToCheck, PermissionCheckRequirement.Optional), out optionalFailedPaths);
|
||||
IEnumerable<string> requiredFailedPaths;
|
||||
IEnumerable<string> optionalFailedPaths;
|
||||
var requiredPathCheckResult = FilePermissionHelper.EnsureFiles(GetPathsToCheck(pathsToCheck, PermissionCheckRequirement.Required), out requiredFailedPaths);
|
||||
var optionalPathCheckResult = FilePermissionHelper.EnsureFiles(GetPathsToCheck(pathsToCheck, PermissionCheckRequirement.Optional), out optionalFailedPaths);
|
||||
|
||||
return GetStatus(requiredPathCheckResult, requiredFailedPaths, optionalPathCheckResult, optionalFailedPaths, PermissionCheckFor.File);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Permissions
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private HealthCheckStatus GetStatus(bool requiredPathCheckResult, List<string> requiredFailedPaths,
|
||||
private HealthCheckStatus GetStatus(bool requiredPathCheckResult, IEnumerable<string> requiredFailedPaths,
|
||||
bool optionalPathCheckResult, IEnumerable<string> optionalFailedPaths,
|
||||
PermissionCheckFor checkingFor)
|
||||
{
|
||||
|
||||
@@ -267,13 +267,13 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
|
||||
private IPublishedContent ConvertToDocument(XmlNode xmlNode, bool isPreviewing)
|
||||
{
|
||||
return xmlNode == null ? null : XmlPublishedContent.Get(xmlNode, isPreviewing, cacheProvider, _contentTypeCache);
|
||||
return xmlNode == null ? null : XmlPublishedContent.Get(xmlNode, isPreviewing, _cacheProvider, _contentTypeCache);
|
||||
}
|
||||
|
||||
private IEnumerable<IPublishedContent> ConvertToDocuments(XmlNodeList xmlNodes, bool isPreviewing)
|
||||
{
|
||||
return xmlNodes.Cast<XmlNode>()
|
||||
.Select(xmlNode => XmlPublishedContent.Get(xmlNode, isPreviewing, cacheProvider, _contentTypeCache));
|
||||
.Select(xmlNode => XmlPublishedContent.Get(xmlNode, isPreviewing, _cacheProvider, _contentTypeCache));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -19,11 +19,16 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
[XmlType(Namespace = "http://umbraco.org/webservices/")]
|
||||
internal class XmlPublishedContent : PublishedContentBase
|
||||
{
|
||||
private XmlPublishedContent(XmlNode xmlNode, bool isPreviewing, ICacheProvider cacheProvider, PublishedContentTypeCache contentTypeCache)
|
||||
{
|
||||
_xmlNode = xmlNode;
|
||||
_isPreviewing = isPreviewing;
|
||||
private readonly XmlNode _xmlNode;
|
||||
private XmlPublishedContent(XmlNode xmlNode, bool isPreviewing, ICacheProvider cacheProvider, PublishedContentTypeCache contentTypeCache)
|
||||
{
|
||||
_xmlNode = xmlNode;
|
||||
_isPreviewing = isPreviewing;
|
||||
|
||||
_cacheProvider = cacheProvider;
|
||||
_contentTypeCache = contentTypeCache;
|
||||
}
|
||||
|
||||
private readonly XmlNode _xmlNode;
|
||||
private readonly bool _isPreviewing;
|
||||
private readonly ICacheProvider _cacheProvider; // at facade/request level (see PublishedContentCache)
|
||||
private readonly PublishedContentTypeCache _contentTypeCache;
|
||||
|
||||
@@ -134,29 +134,13 @@ namespace Umbraco.Web.Redirects
|
||||
{
|
||||
var route = contentCache.GetRouteById(x.Id);
|
||||
if (IsNotRoute(route)) continue;
|
||||
var wk = UnwrapToKey(x);
|
||||
if (wk == null) continue;
|
||||
OldRoutes[x.Id] = Tuple.Create(wk.Key, route);
|
||||
OldRoutes[x.Id] = Tuple.Create(x.Key, route);
|
||||
}
|
||||
}
|
||||
|
||||
LockedEvents = true; // we only want to see the "first batch"
|
||||
}
|
||||
|
||||
private static IPublishedContentWithKey UnwrapToKey(IPublishedContent content)
|
||||
{
|
||||
if (content == null) return null;
|
||||
var withKey = content as IPublishedContentWithKey;
|
||||
if (withKey != null) return withKey;
|
||||
|
||||
var extended = content as PublishedContentExtended;
|
||||
while (extended != null)
|
||||
extended = (content = extended.Unwrap()) as PublishedContentExtended;
|
||||
|
||||
withKey = content as IPublishedContentWithKey;
|
||||
return withKey;
|
||||
}
|
||||
|
||||
private static void ContentService_Published(IContentService sender, PublishEventArgs<IContent> e)
|
||||
{
|
||||
// look note in CacheUpdated
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Umbraco.Web.Routing
|
||||
public bool TryFindContent(PublishedContentRequest contentRequest)
|
||||
{
|
||||
var route = contentRequest.HasDomain
|
||||
? contentRequest.Domain.ContentId + DomainHelper.PathRelativeToDomain(contentRequest.DomainUri, contentRequest.Uri.GetAbsolutePathDecoded())
|
||||
? contentRequest.Domain.ContentId + DomainHelper.PathRelativeToDomain(contentRequest.Domain.Uri, contentRequest.Uri.GetAbsolutePathDecoded())
|
||||
: contentRequest.Uri.GetAbsolutePathDecoded();
|
||||
|
||||
var service = contentRequest.RoutingContext.UmbracoContext.Application.Services.RedirectUrlService;
|
||||
|
||||
Reference in New Issue
Block a user