Merge remote-tracking branch 'origin/temp8' into temp8-packaging-view-3996
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
interface IDataTypeContainerRepository : IEntityContainerRepository
|
||||
public interface IDataTypeContainerRepository : IEntityContainerRepository
|
||||
{ }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
interface IDocumentTypeContainerRepository : IEntityContainerRepository
|
||||
public interface IDocumentTypeContainerRepository : IEntityContainerRepository
|
||||
{ }
|
||||
}
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
interface IEntityContainerRepository : IReadRepository<int, EntityContainer>, IWriteRepository<EntityContainer>
|
||||
public interface IEntityContainerRepository : IReadRepository<int, EntityContainer>, IWriteRepository<EntityContainer>
|
||||
{ }
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
interface IMediaTypeContainerRepository : IEntityContainerRepository
|
||||
public interface IMediaTypeContainerRepository : IEntityContainerRepository
|
||||
{ }
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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>
|
||||
{
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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>
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
|
||||
InstallBusinessLogic(packageId);
|
||||
|
||||
Current.RestartAppPool(_httContext);
|
||||
UmbracoApplication.Restart(_httContext);
|
||||
|
||||
return Task.FromResult<InstallSetupResult>(null);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user