Merge remote-tracking branch 'origin/6.2.0' into 7.1.2
Conflicts: build/Build.bat build/NuSpecs/UmbracoCms.Core.nuspec build/NuSpecs/build/UmbracoCms.targets src/Umbraco.Core/Models/IPublishedContentProperty.cs src/Umbraco.Core/Models/PublishedContent/IPublishedContentExtended.cs src/Umbraco.Core/Models/PublishedContent/PublishedContentExtended.cs src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs src/Umbraco.Core/Models/PublishedContent/PublishedPropertyBase.cs src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs src/Umbraco.Core/Models/Template.cs src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs src/Umbraco.Core/Persistence/Repositories/MemberGroupRepository.cs src/Umbraco.Core/Persistence/Repositories/MemberRepository.cs src/Umbraco.Core/Persistence/Repositories/MemberTypeRepository.cs src/Umbraco.Core/Persistence/Repositories/RecycleBinRepository.cs src/Umbraco.Core/Services/PackagingService.cs src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedFragment.cs src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs src/Umbraco.Web/PublishedContentPropertyExtension.cs src/Umbraco.Web/Search/ExamineEvents.cs src/Umbraco.Web/UmbracoHelper.cs src/Umbraco.Web/umbraco.presentation/CompatibilityHelper.cs src/Umbraco.Web/umbraco.presentation/macro.cs src/umbraco.cms/businesslogic/template/Template.cs
This commit is contained in:
@@ -121,7 +121,12 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
try
|
||||
{
|
||||
//by default use the InternalSearcher
|
||||
return eMgr.IndexProviderCollection["InternalIndexer"];
|
||||
var indexer = eMgr.IndexProviderCollection["InternalIndexer"];
|
||||
if (indexer.IndexerData.IncludeNodeTypes.Any() || indexer.IndexerData.ExcludeNodeTypes.Any())
|
||||
{
|
||||
LogHelper.Warn<PublishedMediaCache>("The InternalIndexer for examine is configured incorrectly, it should not list any include/exclude node types or field names, it should simply be configured as: " + "<IndexSet SetName=\"InternalIndexSet\" IndexPath=\"~/App_Data/TEMP/ExamineIndexes/Internal/\" />");
|
||||
}
|
||||
return indexer;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -177,12 +182,13 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
return ConvertFromSearchResult(results.First());
|
||||
}
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
catch (FileNotFoundException ex)
|
||||
{
|
||||
//Currently examine is throwing FileNotFound exceptions when we have a loadbalanced filestore and a node is published in umbraco
|
||||
//See this thread: http://examine.cdodeplex.com/discussions/264341
|
||||
//Catch the exception here for the time being, and just fallback to GetMedia
|
||||
//TODO: Need to fix examine in LB scenarios!
|
||||
LogHelper.Error<PublishedMediaCache>("Could not load data from Examine index for media", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +265,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
var values = new Dictionary<string, string> {{"nodeName", xpath.GetAttribute("nodeName", "")}};
|
||||
if (!UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema)
|
||||
{
|
||||
values.Add("nodeTypeAlias", xpath.Name);
|
||||
values["nodeTypeAlias"] = xpath.Name;
|
||||
}
|
||||
|
||||
var result = xpath.SelectChildren(XPathNodeType.Element);
|
||||
@@ -271,13 +277,13 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
//checking for duplicate keys because of the 'nodeTypeAlias' might already be added above.
|
||||
if (!values.ContainsKey(result.Current.Name))
|
||||
{
|
||||
values.Add(result.Current.Name, result.Current.Value);
|
||||
values[result.Current.Name] = result.Current.Value;
|
||||
}
|
||||
while (result.Current.MoveToNextAttribute())
|
||||
{
|
||||
if (!values.ContainsKey(result.Current.Name))
|
||||
{
|
||||
values.Add(result.Current.Name, result.Current.Value);
|
||||
values[result.Current.Name] = result.Current.Value;
|
||||
}
|
||||
}
|
||||
result.Current.MoveToParent();
|
||||
@@ -296,7 +302,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
value = result.Current.OuterXml;
|
||||
}
|
||||
}
|
||||
values.Add(result.Current.Name, value);
|
||||
values[result.Current.Name] = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,48 +326,25 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
/// <returns></returns>
|
||||
private IPublishedProperty GetProperty(DictionaryPublishedContent dd, string alias)
|
||||
{
|
||||
if (dd.LoadedFromExamine)
|
||||
{
|
||||
//if this is from Examine, lets check if the alias does not exist on the document
|
||||
if (dd.Properties.All(x => x.PropertyTypeAlias != alias))
|
||||
{
|
||||
//ok it doesn't exist, we might assume now that Examine didn't index this property because the index is not set up correctly
|
||||
//so before we go loading this from the database, we can check if the alias exists on the content type at all, this information
|
||||
//is cached so will be quicker to look up.
|
||||
if (dd.Properties.Any(x => x.PropertyTypeAlias == UmbracoContentIndexer.NodeTypeAliasFieldName))
|
||||
{
|
||||
// so in dd.Properties, there is an IPublishedProperty with property type alias "__NodeTypeAlias" and
|
||||
// that special property would contain the node type alias, which we use to get "aliases & names". That
|
||||
// special property is going to be a PropertyResult (with Value == DataValue) and we
|
||||
// want its value in the most simple way = it is OK to use DataValue here.
|
||||
var aliasesAndNames = ContentType.GetAliasesAndNames(dd.Properties.First(x => x.PropertyTypeAlias.InvariantEquals(UmbracoContentIndexer.NodeTypeAliasFieldName)).DataValue.ToString());
|
||||
if (aliasesAndNames != null)
|
||||
{
|
||||
if (!aliasesAndNames.ContainsKey(alias))
|
||||
{
|
||||
//Ok, now we know it doesn't exist on this content type anyways
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
//lets check if the alias does not exist on the document.
|
||||
//NOTE: Examine will not index empty values and we do not output empty XML Elements to the cache - either of these situations
|
||||
// would mean that the property is missing from the collection whether we are getting the value from Examine or from the library media cache.
|
||||
if (dd.Properties.All(x => x.PropertyTypeAlias != alias))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
//if we've made it here, that means it does exist on the content type but not in examine, we'll need to query the db :(
|
||||
var media = global::umbraco.library.GetMedia(dd.Id, true);
|
||||
if (media != null && media.Current != null)
|
||||
{
|
||||
media.MoveNext();
|
||||
var mediaDoc = ConvertFromXPathNavigator(media.Current);
|
||||
return mediaDoc.Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//We've made it here which means that the value is stored in the Examine index.
|
||||
//We are going to check for a special field however, that is because in some cases we store a 'Raw'
|
||||
//value in the index such as for xml/html.
|
||||
var rawValue = dd.Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(UmbracoContentIndexer.RawFieldPrefix + alias));
|
||||
return rawValue
|
||||
?? dd.Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias));
|
||||
if (dd.LoadedFromExamine)
|
||||
{
|
||||
//We are going to check for a special field however, that is because in some cases we store a 'Raw'
|
||||
//value in the index such as for xml/html.
|
||||
var rawValue = dd.Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(UmbracoContentIndexer.RawFieldPrefix + alias));
|
||||
return rawValue
|
||||
?? dd.Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias));
|
||||
}
|
||||
|
||||
//if its not loaded from examine, then just return the property
|
||||
return dd.Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user