Fixes build and fixes how published media cache gets root nodes - if people have done this in the past it would have been horrible for site performance
This commit is contained in:
@@ -18,8 +18,6 @@ using Umbraco.Core.Xml;
|
||||
using Umbraco.Web.Models;
|
||||
using UmbracoExamine;
|
||||
using umbraco;
|
||||
using umbraco.cms.businesslogic;
|
||||
using ContentType = umbraco.cms.businesslogic.ContentType;
|
||||
|
||||
namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
{
|
||||
@@ -31,21 +29,30 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
/// </remarks>
|
||||
internal class PublishedMediaCache : IPublishedMediaCache
|
||||
{
|
||||
public PublishedMediaCache()
|
||||
{
|
||||
}
|
||||
public PublishedMediaCache(ApplicationContext applicationContext)
|
||||
{
|
||||
if (applicationContext == null) throw new ArgumentNullException("applicationContext");
|
||||
_applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generally used for unit testing to use an explicit examine searcher
|
||||
/// </summary>
|
||||
/// <param name="applicationContext"></param>
|
||||
/// <param name="searchProvider"></param>
|
||||
/// <param name="indexProvider"></param>
|
||||
internal PublishedMediaCache(BaseSearchProvider searchProvider, BaseIndexProvider indexProvider)
|
||||
internal PublishedMediaCache(ApplicationContext applicationContext, BaseSearchProvider searchProvider, BaseIndexProvider indexProvider)
|
||||
{
|
||||
_searchProvider = searchProvider;
|
||||
if (applicationContext == null) throw new ArgumentNullException("applicationContext");
|
||||
if (searchProvider == null) throw new ArgumentNullException("searchProvider");
|
||||
if (indexProvider == null) throw new ArgumentNullException("indexProvider");
|
||||
|
||||
_applicationContext = applicationContext;
|
||||
_searchProvider = searchProvider;
|
||||
_indexProvider = indexProvider;
|
||||
}
|
||||
|
||||
private readonly ApplicationContext _applicationContext;
|
||||
private readonly BaseSearchProvider _searchProvider;
|
||||
private readonly BaseIndexProvider _indexProvider;
|
||||
|
||||
@@ -56,17 +63,10 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
|
||||
public virtual IEnumerable<IPublishedContent> GetAtRoot(UmbracoContext umbracoContext, bool preview)
|
||||
{
|
||||
var rootMedia = global::umbraco.cms.businesslogic.media.Media.GetRootMedias();
|
||||
var result = new List<IPublishedContent>();
|
||||
//TODO: need to get a ConvertFromMedia method but we'll just use this for now.
|
||||
foreach (var media in rootMedia
|
||||
.Select(m => global::umbraco.library.GetMedia(m.Id, true))
|
||||
.Where(media => media != null && media.Current != null))
|
||||
{
|
||||
media.MoveNext();
|
||||
result.Add(ConvertFromXPathNavigator(media.Current));
|
||||
}
|
||||
return result;
|
||||
//TODO: We should be able to look these ids first in Examine!
|
||||
|
||||
var rootMedia = _applicationContext.Services.MediaService.GetRootMedia();
|
||||
return rootMedia.Select(m => GetUmbracoMedia(m.Id));
|
||||
}
|
||||
|
||||
public virtual IPublishedContent GetSingleByXPath(UmbracoContext umbracoContext, bool preview, string xpath, XPathVariable[] vars)
|
||||
@@ -96,7 +96,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
|
||||
public bool XPathNavigatorIsNavigable { get { return false; } }
|
||||
|
||||
public virtual bool HasContent(UmbracoContext context, bool preview) { throw new NotImplementedException(); }
|
||||
public virtual bool HasContent(UmbracoContext context, bool preview) { throw new NotImplementedException(); }
|
||||
|
||||
private ExamineManager GetExamineManagerSafe()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user