Merge remote-tracking branch 'origin/dev-v7' into dev-v7.6
# Conflicts: # build/UmbracoVersion.txt # src/SolutionInfo.cs # src/Umbraco.Core/Configuration/UmbracoVersion.cs # src/Umbraco.Core/Persistence/Repositories/DataTypeDefinitionRepository.cs # src/Umbraco.Web.UI/Umbraco.Web.UI.csproj # src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs # src/UmbracoExamine/UmbracoMemberIndexer.cs
This commit is contained in:
@@ -103,13 +103,13 @@ namespace Umbraco.Web.Cache
|
||||
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.IdToKeyCacheKey);
|
||||
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.KeyToIdCacheKey);
|
||||
|
||||
var dataTypeCache = ApplicationContext.Current.ApplicationCache.IsolatedRuntimeCache.GetCache<IDataTypeDefinition>();
|
||||
payloads.ForEach(payload =>
|
||||
{
|
||||
//clears the prevalue cache
|
||||
var dataTypeCache = ApplicationContext.Current.ApplicationCache.IsolatedRuntimeCache.GetCache<IDataTypeDefinition>();
|
||||
if (dataTypeCache)
|
||||
dataTypeCache.Result.ClearCacheByKeySearch(string.Format("{0}{1}", CacheKeys.DataTypePreValuesCacheKey, payload.Id));
|
||||
|
||||
dataTypeCache.Result.ClearCacheByKeySearch(string.Format("{0}_{1}", CacheKeys.DataTypePreValuesCacheKey, payload.Id));
|
||||
|
||||
PublishedContentType.ClearDataType(payload.Id);
|
||||
});
|
||||
|
||||
|
||||
@@ -64,7 +64,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
|
||||
var url = HealthCheckContext.HttpContext.Request.Url;
|
||||
|
||||
// Access the site home page and check for the click-jack protection header or meta tag
|
||||
var useSsl = GlobalSettings.UseSSL || HealthCheckContext.HttpContext.Request.ServerVariables["SERVER_PORT"] == "443";
|
||||
var serverVariables = HealthCheckContext.HttpContext.Request.ServerVariables;
|
||||
var useSsl = GlobalSettings.UseSSL || serverVariables["SERVER_PORT"] == "443";
|
||||
var address = string.Format("http{0}://{1}:{2}", useSsl ? "s" : "", url.Host.ToLower(), url.Port);
|
||||
var request = WebRequest.Create(address);
|
||||
request.Method = "GET";
|
||||
|
||||
@@ -49,7 +49,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
|
||||
var url = HealthCheckContext.HttpContext.Request.Url;
|
||||
|
||||
// Access the site home page and check for the headers
|
||||
var useSsl = GlobalSettings.UseSSL || HealthCheckContext.HttpContext.Request.ServerVariables["SERVER_PORT"] == "443";
|
||||
var serverVariables = HealthCheckContext.HttpContext.Request.ServerVariables;
|
||||
var useSsl = GlobalSettings.UseSSL || serverVariables["SERVER_PORT"] == "443";
|
||||
var address = string.Format("http{0}://{1}:{2}", useSsl ? "s" : "", url.Host.ToLower(), url.Port);
|
||||
var request = WebRequest.Create(address);
|
||||
request.Method = "HEAD";
|
||||
|
||||
@@ -48,12 +48,22 @@ namespace Umbraco.Web.HealthCheck
|
||||
return healthCheckGroups;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public object GetStatus(Guid id)
|
||||
{
|
||||
var check = _healthCheckResolver.HealthChecks.FirstOrDefault(x => x.Id == id);
|
||||
if (check == null) throw new InvalidOperationException("No health check found with ID " + id);
|
||||
|
||||
return check.GetStatus();
|
||||
try
|
||||
{
|
||||
//Core.Logging.LogHelper.Debug<HealthCheckController>("Running health check: " + check.Name);
|
||||
return check.GetStatus();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Core.Logging.LogHelper.Error<HealthCheckController>("Exception in health check: " + check.Name, e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Umbraco.Web.HealthCheck
|
||||
/// </remarks>
|
||||
internal class HealthCheckResolver : LazyManyObjectsResolverBase<HealthCheckResolver, HealthCheck>, IHealthCheckResolver
|
||||
{
|
||||
public HealthCheckResolver(ILogger logger, Func<IEnumerable<Type>> lazyTypeList)
|
||||
public HealthCheckResolver(ILogger logger, Func<IEnumerable<Type>> lazyTypeList)
|
||||
: base(new HealthCheckServiceProvider(), logger, lazyTypeList, ObjectLifetimeScope.HttpRequest)
|
||||
{
|
||||
}
|
||||
@@ -51,7 +51,7 @@ namespace Umbraco.Web.HealthCheck
|
||||
new HealthCheckContext(new HttpContextWrapper(HttpContext.Current), UmbracoContext.Current)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//use normal ctor
|
||||
return Activator.CreateInstance(serviceType);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
.ForMember(display => display.IsContainer, expression => expression.MapFrom(content => content.ContentType.IsContainer))
|
||||
.ForMember(display => display.IsChildOfListView, expression => expression.Ignore())
|
||||
.ForMember(display => display.Trashed, expression => expression.MapFrom(content => content.Trashed))
|
||||
.ForMember(display => display.PublishDate, expression => expression.MapFrom(content => GetPublishedDate(content, applicationContext)))
|
||||
.ForMember(display => display.PublishDate, expression => expression.MapFrom(content => GetPublishedDate(content)))
|
||||
.ForMember(display => display.TemplateAlias, expression => expression.MapFrom(content => content.Template.Alias))
|
||||
.ForMember(display => display.HasPublishedVersion, expression => expression.MapFrom(content => content.HasPublishedVersion))
|
||||
.ForMember(display => display.Urls,
|
||||
@@ -78,6 +78,12 @@ namespace Umbraco.Web.Models.Mapping
|
||||
.ForMember(dto => dto.Alias, expression => expression.Ignore());
|
||||
}
|
||||
|
||||
private static DateTime? GetPublishedDate(IContent content)
|
||||
{
|
||||
var date = ((Content) content).PublishedDate;
|
||||
return date == default (DateTime) ? (DateTime?) null : date;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps the generic tab with custom properties for content
|
||||
/// </summary>
|
||||
@@ -89,31 +95,9 @@ namespace Umbraco.Web.Models.Mapping
|
||||
private static void AfterMap(IContent content, ContentItemDisplay display, IDataTypeService dataTypeService,
|
||||
ILocalizedTextService localizedText, IContentTypeService contentTypeService)
|
||||
{
|
||||
//map the IsChildOfListView (this is actually if it is a descendant of a list view!)
|
||||
//TODO: Fix this shorthand .Ancestors() lookup, at least have an overload to use the current
|
||||
if (content.HasIdentity)
|
||||
{
|
||||
var ancesctorListView = content.Ancestors().FirstOrDefault(x => x.ContentType.IsContainer);
|
||||
display.IsChildOfListView = ancesctorListView != null;
|
||||
}
|
||||
else
|
||||
{
|
||||
//it's new so it doesn't have a path, so we need to look this up by it's parent + ancestors
|
||||
var parent = content.Parent();
|
||||
if (parent == null)
|
||||
{
|
||||
display.IsChildOfListView = false;
|
||||
}
|
||||
else if (parent.ContentType.IsContainer)
|
||||
{
|
||||
display.IsChildOfListView = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
var ancesctorListView = parent.Ancestors().FirstOrDefault(x => x.ContentType.IsContainer);
|
||||
display.IsChildOfListView = ancesctorListView != null;
|
||||
}
|
||||
}
|
||||
// map the IsChildOfListView (this is actually if it is a descendant of a list view!)
|
||||
var parent = content.Parent();
|
||||
display.IsChildOfListView = parent != null && (parent.ContentType.IsContainer || contentTypeService.HasContainerInPath(parent.Path));
|
||||
|
||||
//map the tree node url
|
||||
if (HttpContext.Current != null)
|
||||
@@ -229,26 +213,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the published date value for the IContent object
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="applicationContext"></param>
|
||||
/// <returns></returns>
|
||||
private static DateTime? GetPublishedDate(IContent content, ApplicationContext applicationContext)
|
||||
{
|
||||
if (content.Published)
|
||||
{
|
||||
return content.UpdateDate;
|
||||
}
|
||||
if (content.HasPublishedVersion)
|
||||
{
|
||||
var published = applicationContext.Services.ContentService.GetPublishedVersion(content.Id);
|
||||
return published.UpdateDate;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
//TODO: This is horribly inneficient
|
||||
/// Creates the list of action buttons allowed for this user - Publish, Send to publish, save, unpublish returned as the button's 'letter'
|
||||
/// </summary>
|
||||
private class ActionButtonsResolver : ValueResolver<IContent, IEnumerable<char>>
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
.ForMember(display => display.IsContainer, expression => expression.Ignore())
|
||||
.ForMember(display => display.HasPublishedVersion, expression => expression.Ignore())
|
||||
.ForMember(display => display.Tabs, expression => expression.ResolveUsing(new TabsAndPropertiesResolver(applicationContext.Services.TextService)))
|
||||
.AfterMap((media, display) => AfterMap(media, display, applicationContext.Services.DataTypeService, applicationContext.Services.TextService, applicationContext.ProfilingLogger.Logger));
|
||||
.AfterMap((media, display) => AfterMap(media, display, applicationContext.Services.DataTypeService, applicationContext.Services.TextService, applicationContext.Services.ContentTypeService, applicationContext.ProfilingLogger.Logger));
|
||||
|
||||
//FROM IMedia TO ContentItemBasic<ContentPropertyBasic, IMedia>
|
||||
config.CreateMap<IMedia, ContentItemBasic<ContentPropertyBasic, IMedia>>()
|
||||
@@ -67,34 +67,12 @@ namespace Umbraco.Web.Models.Mapping
|
||||
.ForMember(dto => dto.HasPublishedVersion, expression => expression.Ignore());
|
||||
}
|
||||
|
||||
private static void AfterMap(IMedia media, MediaItemDisplay display, IDataTypeService dataTypeService, ILocalizedTextService localizedText, ILogger logger)
|
||||
private static void AfterMap(IMedia media, MediaItemDisplay display, IDataTypeService dataTypeService, ILocalizedTextService localizedText, IContentTypeService contentTypeService, ILogger logger)
|
||||
{
|
||||
// Adapted from ContentModelMapper
|
||||
//map the IsChildOfListView (this is actually if it is a descendant of a list view!)
|
||||
//TODO: Fix this shorthand .Ancestors() lookup, at least have an overload to use the current
|
||||
if (media.HasIdentity)
|
||||
{
|
||||
var ancesctorListView = media.Ancestors().FirstOrDefault(x => x.ContentType.IsContainer);
|
||||
display.IsChildOfListView = ancesctorListView != null;
|
||||
}
|
||||
else
|
||||
{
|
||||
//it's new so it doesn't have a path, so we need to look this up by it's parent + ancestors
|
||||
var parent = media.Parent();
|
||||
if (parent == null)
|
||||
{
|
||||
display.IsChildOfListView = false;
|
||||
}
|
||||
else if (parent.ContentType.IsContainer)
|
||||
{
|
||||
display.IsChildOfListView = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
var ancesctorListView = parent.Ancestors().FirstOrDefault(x => x.ContentType.IsContainer);
|
||||
display.IsChildOfListView = ancesctorListView != null;
|
||||
}
|
||||
}
|
||||
var parent = media.Parent();
|
||||
display.IsChildOfListView = parent != null && (parent.ContentType.IsContainer || contentTypeService.HasContainerInPath(parent.Path));
|
||||
|
||||
//map the tree node url
|
||||
if (HttpContext.Current != null)
|
||||
|
||||
@@ -1389,10 +1389,15 @@ namespace Umbraco.Web
|
||||
return test ? new HtmlString(valueIfTrue) : new HtmlString(string.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Prevalues
|
||||
|
||||
/// <summary>
|
||||
/// Gets a specific PreValue by its Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the PreValue to retrieve the value from</param>
|
||||
/// <returns>PreValue as a string</returns>
|
||||
public string GetPreValueAsString(int id)
|
||||
{
|
||||
return DataTypeService.GetPreValueAsString(id);
|
||||
|
||||
Reference in New Issue
Block a user