Merge remote-tracking branch 'origin/temp8' into temp8-packaging-view-3996

This commit is contained in:
Shannon
2019-01-16 23:54:28 +11:00
28 changed files with 75 additions and 64 deletions

View File

@@ -1,5 +1,5 @@
namespace Umbraco.Core.Persistence.Repositories
{
interface IDataTypeContainerRepository : IEntityContainerRepository
public interface IDataTypeContainerRepository : IEntityContainerRepository
{ }
}

View File

@@ -1,5 +1,5 @@
namespace Umbraco.Core.Persistence.Repositories
{
interface IDocumentTypeContainerRepository : IEntityContainerRepository
public interface IDocumentTypeContainerRepository : IEntityContainerRepository
{ }
}

View File

@@ -2,6 +2,6 @@
namespace Umbraco.Core.Persistence.Repositories
{
interface IEntityContainerRepository : IReadRepository<int, EntityContainer>, IWriteRepository<EntityContainer>
public interface IEntityContainerRepository : IReadRepository<int, EntityContainer>, IWriteRepository<EntityContainer>
{ }
}

View File

@@ -3,7 +3,7 @@ using Umbraco.Core.Models;
namespace Umbraco.Core.Persistence.Repositories
{
internal interface IMacroRepository : IReadWriteQueryRepository<int, IMacro>, IReadRepository<Guid, IMacro>
public interface IMacroRepository : IReadWriteQueryRepository<int, IMacro>, IReadRepository<Guid, IMacro>
{
//IEnumerable<IMacro> GetAll(params string[] aliases);

View File

@@ -1,5 +1,5 @@
namespace Umbraco.Core.Persistence.Repositories
{
interface IMediaTypeContainerRepository : IEntityContainerRepository
public interface IMediaTypeContainerRepository : IEntityContainerRepository
{ }
}

View File

@@ -4,7 +4,7 @@ using Umbraco.Core.Models;
namespace Umbraco.Core.Services.Changes
{
internal class ContentTypeChange<TItem>
public class ContentTypeChange<TItem>
where TItem : class, IContentTypeComposition
{
public ContentTypeChange(TItem item, ContentTypeChangeTypes changeTypes)

View File

@@ -12,7 +12,7 @@ namespace Umbraco.Core.Services.Implement
/// <summary>
/// Represents the ContentType Service, which is an easy access to operations involving <see cref="IContentType"/>
/// </summary>
internal class ContentTypeService : ContentTypeServiceBase<IContentTypeRepository, IContentType, IContentTypeService>, IContentTypeService
public class ContentTypeService : ContentTypeServiceBase<IContentTypeRepository, IContentType, IContentTypeService>, IContentTypeService
{
public ContentTypeService(IScopeProvider provider, ILogger logger, IEventMessagesFactory eventMessagesFactory, IContentService contentService,
IContentTypeRepository repository, IAuditRepository auditRepository, IDocumentTypeContainerRepository entityContainerRepository, IEntityRepository entityRepository)

View File

@@ -4,7 +4,7 @@ using Umbraco.Core.Scoping;
namespace Umbraco.Core.Services.Implement
{
internal abstract class ContentTypeServiceBase : ScopeRepositoryService
public abstract class ContentTypeServiceBase : ScopeRepositoryService
{
protected ContentTypeServiceBase(IScopeProvider provider, ILogger logger, IEventMessagesFactory eventMessagesFactory)
: base(provider, logger, eventMessagesFactory)

View File

@@ -6,7 +6,7 @@ using Umbraco.Core.Services.Changes;
namespace Umbraco.Core.Services.Implement
{
internal abstract class ContentTypeServiceBase<TItem, TService> : ContentTypeServiceBase
public abstract class ContentTypeServiceBase<TItem, TService> : ContentTypeServiceBase
where TItem : class, IContentTypeComposition
where TService : class, IContentTypeServiceBase<TItem>
{

View File

@@ -13,7 +13,7 @@ using Umbraco.Core.Services.Changes;
namespace Umbraco.Core.Services.Implement
{
internal abstract class ContentTypeServiceBase<TRepository, TItem, TService> : ContentTypeServiceBase<TItem, TService>, IContentTypeServiceBase<TItem>
public abstract class ContentTypeServiceBase<TRepository, TItem, TService> : ContentTypeServiceBase<TItem, TService>, IContentTypeServiceBase<TItem>
where TRepository : IContentTypeRepositoryBase<TItem>
where TItem : class, IContentTypeComposition
where TService : class, IContentTypeServiceBase<TItem>

View File

@@ -16,7 +16,7 @@ namespace Umbraco.Core.Services.Implement
/// <summary>
/// Represents the DataType Service, which is an easy access to operations involving <see cref="IDataType"/>
/// </summary>
internal class DataTypeService : ScopeRepositoryService, IDataTypeService
public class DataTypeService : ScopeRepositoryService, IDataTypeService
{
private readonly IDataTypeRepository _dataTypeRepository;
private readonly IDataTypeContainerRepository _dataTypeContainerRepository;

View File

@@ -22,7 +22,7 @@ namespace Umbraco.Core.Services.Implement
private readonly IDataTypeService _dataTypeService;
private readonly IUserService _userService;
private readonly ILocalizationService _localizationService;
private readonly IEnumerable<IUrlSegmentProvider> _urlSegmentProviders;
private readonly UrlSegmentProviderCollection _urlSegmentProviders;
public EntityXmlSerializer(
IContentService contentService,
@@ -31,7 +31,7 @@ namespace Umbraco.Core.Services.Implement
IUserService userService,
ILocalizationService localizationService,
IContentTypeService contentTypeService,
IEnumerable<IUrlSegmentProvider> urlSegmentProviders)
UrlSegmentProviderCollection urlSegmentProviders)
{
_contentTypeService = contentTypeService;
_mediaService = mediaService;

View File

@@ -12,7 +12,7 @@ namespace Umbraco.Core.Services.Implement
/// <summary>
/// Represents the Macro Service, which is an easy access to operations involving <see cref="IMacro"/>
/// </summary>
internal class MacroService : ScopeRepositoryService, IMacroService
public class MacroService : ScopeRepositoryService, IMacroService
{
private readonly IMacroRepository _macroRepository;
private readonly IAuditRepository _auditRepository;

View File

@@ -8,7 +8,7 @@ using Umbraco.Core.Scoping;
namespace Umbraco.Core.Services.Implement
{
internal class MediaTypeService : ContentTypeServiceBase<IMediaTypeRepository, IMediaType, IMediaTypeService>, IMediaTypeService
public class MediaTypeService : ContentTypeServiceBase<IMediaTypeRepository, IMediaType, IMediaTypeService>, IMediaTypeService
{
public MediaTypeService(IScopeProvider provider, ILogger logger, IEventMessagesFactory eventMessagesFactory, IMediaService mediaService,
IMediaTypeRepository mediaTypeRepository, IAuditRepository auditRepository, IMediaTypeContainerRepository entityContainerRepository,

View File

@@ -8,7 +8,7 @@ using Umbraco.Core.Scoping;
namespace Umbraco.Core.Services.Implement
{
internal class MemberTypeService : ContentTypeServiceBase<IMemberTypeRepository, IMemberType, IMemberTypeService>, IMemberTypeService
public class MemberTypeService : ContentTypeServiceBase<IMemberTypeRepository, IMemberType, IMemberTypeService>, IMemberTypeService
{
private readonly IMemberTypeRepository _memberTypeRepository;

View File

@@ -13,11 +13,11 @@ namespace Umbraco.Examine
/// </summary>
public class ContentValueSetBuilder : BaseValueSetBuilder<IContent>, IContentValueSetBuilder, IPublishedContentValueSetBuilder
{
private readonly IEnumerable<IUrlSegmentProvider> _urlSegmentProviders;
private readonly UrlSegmentProviderCollection _urlSegmentProviders;
private readonly IUserService _userService;
public ContentValueSetBuilder(PropertyEditorCollection propertyEditors,
IEnumerable<IUrlSegmentProvider> urlSegmentProviders,
UrlSegmentProviderCollection urlSegmentProviders,
IUserService userService,
bool publishedValuesOnly)
: base(propertyEditors, publishedValuesOnly)

View File

@@ -10,7 +10,7 @@ namespace Umbraco.Examine
{
public class MediaValueSetBuilder : BaseValueSetBuilder<IMedia>
{
private readonly IEnumerable<IUrlSegmentProvider> _urlSegmentProviders;
private readonly UrlSegmentProviderCollection _urlSegmentProviders;
private readonly IUserService _userService;
public MediaValueSetBuilder(PropertyEditorCollection propertyEditors,

View File

@@ -31,7 +31,7 @@ namespace Umbraco.Tests.UmbracoExamine
{
public static ContentValueSetBuilder GetContentValueSetBuilder(PropertyEditorCollection propertyEditors, bool publishedValuesOnly)
{
var contentValueSetBuilder = new ContentValueSetBuilder(propertyEditors, new[] { new DefaultUrlSegmentProvider() }, GetMockUserService(), publishedValuesOnly);
var contentValueSetBuilder = new ContentValueSetBuilder(propertyEditors, new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider() }), GetMockUserService(), publishedValuesOnly);
return contentValueSetBuilder;
}

View File

@@ -159,41 +159,6 @@ namespace Umbraco.Web.Composing
#endregion
#region Web Actions
internal static void RestartAppPool()
{
// see notes in overload
var httpContext = HttpContext.Current;
if (httpContext != null)
{
httpContext.Application.Add("AppPoolRestarting", true);
httpContext.User = null;
}
Thread.CurrentPrincipal = null;
HttpRuntime.UnloadAppDomain();
}
internal static void RestartAppPool(HttpContextBase httpContext)
{
// we're going to put an application wide flag to show that the application is about to restart.
// we're doing this because if there is a script checking if the app pool is fully restarted, then
// it can check if this flag exists... if it does it means the app pool isn't restarted yet.
httpContext.Application.Add("AppPoolRestarting", true);
// unload app domain - we must null out all identities otherwise we get serialization errors
// http://www.zpqrtbnk.net/posts/custom-iidentity-serialization-issue
httpContext.User = null;
if (HttpContext.Current != null)
HttpContext.Current.User = null;
Thread.CurrentPrincipal = null;
HttpRuntime.UnloadAppDomain();
}
#endregion
#region Core Getters
// proxy Core for convenience

View File

@@ -81,7 +81,7 @@ namespace Umbraco.Core.Components
/// Gets the url providers collection builder.
/// </summary>
/// <param name="composition">The composition.</param>
internal static UrlProviderCollectionBuilder UrlProviders(this Composition composition)
public static UrlProviderCollectionBuilder UrlProviders(this Composition composition)
=> composition.WithCollectionBuilder<UrlProviderCollectionBuilder>();
#endregion

View File

@@ -315,7 +315,7 @@ namespace Umbraco.Web.Editors
var installedFiles = Services.PackagingService.InstallCompiledPackageFiles(definition, zipFile, Security.GetUserId().ResultOr(0));
//set a restarting marker and reset the app pool
Current.RestartAppPool(Request.TryGetHttpContext().Result);
UmbracoApplication.Restart(Request.TryGetHttpContext().Result);
model.IsRestarting = true;

View File

@@ -52,7 +52,7 @@ namespace Umbraco.Web.Install.InstallSteps
var (packageFile, packageId) = await DownloadPackageFilesAsync(starterKitId.Value);
Current.RestartAppPool();
UmbracoApplication.Restart();
return new InstallSetupResult(new Dictionary<string, object>
{

View File

@@ -34,7 +34,7 @@ namespace Umbraco.Web.Install.InstallSteps
InstallBusinessLogic(packageId);
Current.RestartAppPool(_httContext);
UmbracoApplication.Restart(_httContext);
return Task.FromResult<InstallSetupResult>(null);
}

View File

@@ -21,7 +21,7 @@ namespace Umbraco.Web.Models.PublishedContent
/// <inheritdoc />
public VariationContext VariationContext
{
get => (VariationContext) HttpContextAccessor.HttpContext.Items[ContextKey];
get => (VariationContext) HttpContextAccessor.HttpContext?.Items[ContextKey];
set => HttpContextAccessor.HttpContext.Items[ContextKey] = value;
}
}

View File

@@ -150,7 +150,7 @@ namespace Umbraco.Web.Mvc
if (context == null)
AppDomain.Unload(AppDomain.CurrentDomain);
else
Current.RestartAppPool(new HttpContextWrapper(context));
UmbracoApplication.Restart(new HttpContextWrapper(context));
}
throw new ModelBindingException(msg.ToString());

View File

@@ -101,6 +101,9 @@ namespace Umbraco.Web.PublishedCache.NuCache
_defaultCultureAccessor = defaultCultureAccessor;
_globalSettings = globalSettings;
_siteDomainHelper = siteDomainHelper;
// we need an Xml serializer here so that the member cache can support XPath,
// for members this is done by navigating the serialized-to-xml member
_entitySerializer = entitySerializer;
// we always want to handle repository events, configured or not

View File

@@ -33,13 +33,13 @@ namespace Umbraco.Web.Search
composition.RegisterUnique<IPublishedContentValueSetBuilder>(factory =>
new ContentValueSetBuilder(
factory.GetInstance<PropertyEditorCollection>(),
factory.GetInstance<IEnumerable<IUrlSegmentProvider>>(),
factory.GetInstance<UrlSegmentProviderCollection>(),
factory.GetInstance<IUserService>(),
true));
composition.RegisterUnique<IContentValueSetBuilder>(factory =>
new ContentValueSetBuilder(
factory.GetInstance<PropertyEditorCollection>(),
factory.GetInstance<IEnumerable<IUrlSegmentProvider>>(),
factory.GetInstance<UrlSegmentProviderCollection>(),
factory.GetInstance<IUserService>(),
false));
composition.RegisterUnique<IValueSetBuilder<IMedia>, MediaValueSetBuilder>();

View File

@@ -1,4 +1,6 @@
using Umbraco.Core;
using System.Threading;
using System.Web;
using Umbraco.Core;
using Umbraco.Web.Runtime;
namespace Umbraco.Web
@@ -12,5 +14,46 @@ namespace Umbraco.Web
{
return new WebRuntime(this);
}
/// <summary>
/// Restarts the Umbraco application.
/// </summary>
public static void Restart()
{
// see notes in overload
var httpContext = HttpContext.Current;
if (httpContext != null)
{
httpContext.Application.Add("AppPoolRestarting", true);
httpContext.User = null;
}
Thread.CurrentPrincipal = null;
HttpRuntime.UnloadAppDomain();
}
/// <summary>
/// Restarts the Umbraco application.
/// </summary>
public static void Restart(HttpContextBase httpContext)
{
if (httpContext != null)
{
// we're going to put an application wide flag to show that the application is about to restart.
// we're doing this because if there is a script checking if the app pool is fully restarted, then
// it can check if this flag exists... if it does it means the app pool isn't restarted yet.
httpContext.Application.Add("AppPoolRestarting", true);
// unload app domain - we must null out all identities otherwise we get serialization errors
// http://www.zpqrtbnk.net/posts/custom-iidentity-serialization-issue
httpContext.User = null;
}
if (HttpContext.Current != null)
HttpContext.Current.User = null;
Thread.CurrentPrincipal = null;
HttpRuntime.UnloadAppDomain();
}
}
}