diff --git a/src/Umbraco.Abstractions/Hosting/IHostingEnvironment.cs b/src/Umbraco.Abstractions/Hosting/IHostingEnvironment.cs
new file mode 100644
index 0000000000..d8a07d7bbc
--- /dev/null
+++ b/src/Umbraco.Abstractions/Hosting/IHostingEnvironment.cs
@@ -0,0 +1,11 @@
+namespace Umbraco.Core.Hosting
+{
+ public interface IHostingEnvironment
+ {
+ string SiteName { get; }
+ string ApplicationId { get; }
+ string ApplicationPhysicalPath { get; }
+
+ string LocalTempPath { get; }
+ }
+}
diff --git a/src/Umbraco.Core/Configuration/GlobalSettingsExtensions.cs b/src/Umbraco.Core/Configuration/GlobalSettingsExtensions.cs
deleted file mode 100644
index 65b1a0d9ea..0000000000
--- a/src/Umbraco.Core/Configuration/GlobalSettingsExtensions.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using System;
-using System.Web;
-using System.Web.Hosting;
-using Umbraco.Core.IO;
-
-namespace Umbraco.Core.Configuration
-{
-
- public static class GlobalSettingsExtensions
- {
- private static string _localTempPath;
-
- ///
- /// Gets the location of temporary files.
- ///
- public static string LocalTempPath(this IGlobalSettings globalSettings, IIOHelper ioHelper)
- {
-
- if (_localTempPath != null)
- return _localTempPath;
-
- switch (globalSettings.LocalTempStorageLocation)
- {
- case LocalTempStorage.AspNetTemp:
- return _localTempPath = System.IO.Path.Combine(HttpRuntime.CodegenDir, "UmbracoData");
-
- case LocalTempStorage.EnvironmentTemp:
-
- // environment temp is unique, we need a folder per site
-
- // use a hash
- // combine site name and application id
- // site name is a Guid on Cloud
- // application id is eg /LM/W3SVC/123456/ROOT
- // the combination is unique on one server
- // and, if a site moves from worker A to B and then back to A...
- // hopefully it gets a new Guid or new application id?
-
- var siteName = HostingEnvironment.SiteName;
- var applicationId = HostingEnvironment.ApplicationID; // ie HttpRuntime.AppDomainAppId
-
- var hashString = siteName + "::" + applicationId;
- var hash = hashString.GenerateHash();
- var siteTemp = System.IO.Path.Combine(Environment.ExpandEnvironmentVariables("%temp%"), "UmbracoData", hash);
-
- return _localTempPath = siteTemp;
-
- //case LocalTempStorage.Default:
- //case LocalTempStorage.Unknown:
- default:
- return _localTempPath = ioHelper.MapPath("~/App_Data/TEMP");
- }
-
- }
-
- }
-}
diff --git a/src/Umbraco.Core/IO/SystemFiles.cs b/src/Umbraco.Core/IO/SystemFiles.cs
index 5025a5b01f..92e9156f2f 100644
--- a/src/Umbraco.Core/IO/SystemFiles.cs
+++ b/src/Umbraco.Core/IO/SystemFiles.cs
@@ -1,6 +1,7 @@
using System.IO;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Hosting;
namespace Umbraco.Core.IO
{
@@ -9,9 +10,9 @@ namespace Umbraco.Core.IO
public static string TinyMceConfig => Constants.SystemDirectories.Config + "/tinyMceConfig.config";
// TODO: Kill this off we don't have umbraco.config XML cache we now have NuCache
- public static string GetContentCacheXml(IGlobalSettings globalSettings)
+ public static string GetContentCacheXml(IHostingEnvironment hostingEnvironment)
{
- return Path.Combine(globalSettings.LocalTempPath(Current.IOHelper), "umbraco.config");
+ return Path.Combine(hostingEnvironment.LocalTempPath, "umbraco.config");
}
}
}
diff --git a/src/Umbraco.Core/MainDom.cs b/src/Umbraco.Core/MainDom.cs
index 5da1062275..440025a042 100644
--- a/src/Umbraco.Core/MainDom.cs
+++ b/src/Umbraco.Core/MainDom.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Security.Cryptography;
using System.Threading;
using System.Web.Hosting;
+using Umbraco.Core.Hosting;
using Umbraco.Core.Logging;
namespace Umbraco.Core
@@ -46,14 +47,14 @@ namespace Umbraco.Core
#region Ctor
// initializes a new instance of MainDom
- public MainDom(ILogger logger)
+ public MainDom(ILogger logger, IHostingEnvironment hostingEnvironment)
{
_logger = logger;
var appId = string.Empty;
// HostingEnvironment.ApplicationID is null in unit tests, making ReplaceNonAlphanumericChars fail
- if (HostingEnvironment.ApplicationID != null)
- appId = HostingEnvironment.ApplicationID.ReplaceNonAlphanumericChars(string.Empty);
+ if (hostingEnvironment.ApplicationId != null)
+ appId = hostingEnvironment.ApplicationId.ReplaceNonAlphanumericChars(string.Empty);
// combining with the physical path because if running on eg IIS Express,
// two sites could have the same appId even though they are different.
@@ -64,7 +65,7 @@ namespace Umbraco.Core
// we *cannot* use the process ID here because when an AppPool restarts it is
// a new process for the same application path
- var appPath = HostingEnvironment.ApplicationPhysicalPath;
+ var appPath = hostingEnvironment.ApplicationPhysicalPath;
var hash = (appId + ":::" + appPath).GenerateHash();
var lockName = "UMBRACO-" + hash + "-MAINDOM-LCK";
diff --git a/src/Umbraco.Core/Runtime/CoreInitialComposer.cs b/src/Umbraco.Core/Runtime/CoreInitialComposer.cs
index 2ab0de14ce..143e22943b 100644
--- a/src/Umbraco.Core/Runtime/CoreInitialComposer.cs
+++ b/src/Umbraco.Core/Runtime/CoreInitialComposer.cs
@@ -4,6 +4,7 @@ using Umbraco.Core.Composing;
using Umbraco.Core.Composing.CompositionExtensions;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Manifest;
@@ -102,9 +103,10 @@ namespace Umbraco.Core.Runtime
factory.GetInstance(),
factory.GetInstance(),
factory.GetInstance(),
- factory.GetInstance(),
true, new DatabaseServerMessengerOptions(),
- factory.GetInstance()));
+ factory.GetInstance(),
+ factory.GetInstance()
+ ));
composition.WithCollectionBuilder()
.Add(() => composition.TypeLoader.GetCacheRefreshers());
diff --git a/src/Umbraco.Core/Runtime/CoreRuntime.cs b/src/Umbraco.Core/Runtime/CoreRuntime.cs
index c24df00167..d7313ab86d 100644
--- a/src/Umbraco.Core/Runtime/CoreRuntime.cs
+++ b/src/Umbraco.Core/Runtime/CoreRuntime.cs
@@ -6,6 +6,7 @@ using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Exceptions;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
@@ -27,12 +28,13 @@ namespace Umbraco.Core.Runtime
private readonly IUmbracoBootPermissionChecker _umbracoBootPermissionChecker;
- public CoreRuntime(Configs configs, IUmbracoVersion umbracoVersion, IIOHelper ioHelper, ILogger logger, IProfiler profiler, IUmbracoBootPermissionChecker umbracoBootPermissionChecker)
+ public CoreRuntime(Configs configs, IUmbracoVersion umbracoVersion, IIOHelper ioHelper, ILogger logger, IProfiler profiler, IUmbracoBootPermissionChecker umbracoBootPermissionChecker, IHostingEnvironment hostingEnvironment)
{
IOHelper = ioHelper;
Configs = configs;
UmbracoVersion = umbracoVersion ;
Profiler = profiler;
+ HostingEnvironment = hostingEnvironment;
_umbracoBootPermissionChecker = umbracoBootPermissionChecker;
@@ -74,6 +76,7 @@ namespace Umbraco.Core.Runtime
/// Gets the
///
protected IIOHelper IOHelper { get; }
+ protected IHostingEnvironment HostingEnvironment { get; }
protected Configs Configs { get; }
protected IUmbracoVersion UmbracoVersion { get; }
@@ -142,10 +145,10 @@ namespace Umbraco.Core.Runtime
var databaseFactory = GetDatabaseFactory();
// type finder/loader
- var typeLoader = new TypeLoader(IOHelper, TypeFinder, appCaches.RuntimeCache, new DirectoryInfo(Configs.Global().LocalTempPath(IOHelper)), ProfilingLogger);
+ var typeLoader = new TypeLoader(IOHelper, TypeFinder, appCaches.RuntimeCache, new DirectoryInfo(HostingEnvironment.LocalTempPath), ProfilingLogger);
// main dom
- var mainDom = new MainDom(Logger);
+ var mainDom = new MainDom(Logger, HostingEnvironment);
// create the composition
composition = new Composition(register, typeLoader, ProfilingLogger, _state, Configs);
diff --git a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs
index f616007f73..04bd838e39 100644
--- a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs
+++ b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs
@@ -16,6 +16,7 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Hosting;
using Umbraco.Core.Scoping;
namespace Umbraco.Core.Sync
@@ -35,6 +36,7 @@ namespace Umbraco.Core.Sync
private readonly object _locko = new object();
private readonly IProfilingLogger _profilingLogger;
private readonly IIOHelper _ioHelper;
+ private readonly IHostingEnvironment _hostingEnvironment;
private readonly ISqlContext _sqlContext;
private readonly Lazy _distCacheFilePath;
private int _lastId = -1;
@@ -47,8 +49,8 @@ namespace Umbraco.Core.Sync
public DatabaseServerMessengerOptions Options { get; }
public DatabaseServerMessenger(
- IRuntimeState runtime, IScopeProvider scopeProvider, ISqlContext sqlContext, IProfilingLogger proflog, IGlobalSettings globalSettings,
- bool distributedEnabled, DatabaseServerMessengerOptions options, IIOHelper ioHelper)
+ IRuntimeState runtime, IScopeProvider scopeProvider, ISqlContext sqlContext, IProfilingLogger proflog,
+ bool distributedEnabled, DatabaseServerMessengerOptions options, IIOHelper ioHelper, IHostingEnvironment hostingEnvironment)
: base(distributedEnabled)
{
ScopeProvider = scopeProvider ?? throw new ArgumentNullException(nameof(scopeProvider));
@@ -56,11 +58,12 @@ namespace Umbraco.Core.Sync
_runtime = runtime;
_profilingLogger = proflog ?? throw new ArgumentNullException(nameof(proflog));
_ioHelper = ioHelper;
+ _hostingEnvironment = hostingEnvironment;
Logger = proflog;
Options = options ?? throw new ArgumentNullException(nameof(options));
_lastPruned = _lastSync = DateTime.UtcNow;
_syncIdle = new ManualResetEvent(true);
- _distCacheFilePath = new Lazy(() => GetDistCacheFilePath(globalSettings));
+ _distCacheFilePath = new Lazy(() => GetDistCacheFilePath(hostingEnvironment));
}
protected ILogger Logger { get; }
@@ -532,11 +535,11 @@ namespace Umbraco.Core.Sync
+ "/D" + AppDomain.CurrentDomain.Id // eg 22
+ "] " + Guid.NewGuid().ToString("N").ToUpper(); // make it truly unique
- private string GetDistCacheFilePath(IGlobalSettings globalSettings)
+ private string GetDistCacheFilePath(IHostingEnvironment hostingEnvironment)
{
var fileName = HttpRuntime.AppDomainAppId.ReplaceNonAlphanumericChars(string.Empty) + "-lastsynced.txt";
- var distCacheFilePath = Path.Combine(globalSettings.LocalTempPath(_ioHelper), "DistCache", fileName);
+ var distCacheFilePath = Path.Combine(hostingEnvironment.LocalTempPath, "DistCache", fileName);
//ensure the folder exists
var folder = Path.GetDirectoryName(distCacheFilePath);
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 10dc253789..cb05675879 100755
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -149,7 +149,6 @@
-
diff --git a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs
index be160a483c..1bd6391f0e 100644
--- a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs
+++ b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs
@@ -7,6 +7,7 @@ using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Hosting;
using Umbraco.Core.Services;
using Umbraco.Tests.LegacyXmlPublishedCache;
using Umbraco.Tests.TestHelpers;
@@ -64,7 +65,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
_xml = new XmlDocument();
_xml.LoadXml(GetXml());
- var xmlStore = new XmlStore(() => _xml, null, null, null);
+ var xmlStore = new XmlStore(() => _xml, null, null, null, HostingEnvironment);
var appCache = new DictionaryAppCache();
var domainCache = new DomainCache(ServiceContext.DomainService, DefaultCultureAccessor);
var publishedShapshot = new PublishedSnapshot(
diff --git a/src/Umbraco.Tests/Cache/PublishedCache/PublishedMediaCacheTests.cs b/src/Umbraco.Tests/Cache/PublishedCache/PublishedMediaCacheTests.cs
index f3d9f895ef..de64ac4e48 100644
--- a/src/Umbraco.Tests/Cache/PublishedCache/PublishedMediaCacheTests.cs
+++ b/src/Umbraco.Tests/Cache/PublishedCache/PublishedMediaCacheTests.cs
@@ -79,7 +79,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
var mChild2 = MakeNewMedia("Child2", mType, user, mRoot2.Id);
var ctx = GetUmbracoContext("/test");
- var cache = new PublishedMediaCache(new XmlStore((XmlDocument) null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance(), Factory.GetInstance());
+ var cache = new PublishedMediaCache(new XmlStore((XmlDocument) null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance(), Factory.GetInstance());
var roots = cache.GetAtRoot();
Assert.AreEqual(2, roots.Count());
Assert.IsTrue(roots.Select(x => x.Id).ContainsAll(new[] {mRoot1.Id, mRoot2.Id}));
@@ -97,7 +97,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
//var publishedMedia = PublishedMediaTests.GetNode(mRoot.Id, GetUmbracoContext("/test", 1234));
var umbracoContext = GetUmbracoContext("/test");
- var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), Current.Services.MediaService, Current.Services.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance(), Factory.GetInstance());
+ var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), Current.Services.MediaService, Current.Services.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance(), Factory.GetInstance());
var publishedMedia = cache.GetById(mRoot.Id);
Assert.IsNotNull(publishedMedia);
@@ -208,7 +208,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
var result = new SearchResult("1234", 1, () => fields.ToDictionary(x => x.Key, x => new List { x.Value }));
- var store = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance(), Factory.GetInstance());
+ var store = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance(), Factory.GetInstance());
var doc = store.CreateFromCacheValues(store.ConvertFromSearchResult(result));
DoAssert(doc, 1234, key, null, 0, "/media/test.jpg", "Image", 23, "Shannon", "Shannon", 0, 0, "-1,1234", DateTime.Parse("2012-07-17T10:34:09"), DateTime.Parse("2012-07-16T10:34:09"), 2);
@@ -224,7 +224,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
var xmlDoc = GetMediaXml();
((XmlElement)xmlDoc.DocumentElement.FirstChild).SetAttribute("key", key.ToString());
var navigator = xmlDoc.SelectSingleNode("/root/Image").CreateNavigator();
- var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance(), Factory.GetInstance());
+ var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance(), Factory.GetInstance());
var doc = cache.CreateFromCacheValues(cache.ConvertFromXPathNavigator(navigator, true));
DoAssert(doc, 2000, key, null, 2, "image1", "Image", 23, "Shannon", "Shannon", 33, 33, "-1,2000", DateTime.Parse("2012-06-12T14:13:17"), DateTime.Parse("2012-07-20T18:50:43"), 1);
diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlPublishedSnapshotService.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlPublishedSnapshotService.cs
index ec6b854a46..aed55f3f49 100644
--- a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlPublishedSnapshotService.cs
+++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlPublishedSnapshotService.cs
@@ -3,6 +3,7 @@ using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -37,6 +38,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
private readonly ISiteDomainHelper _siteDomainHelper;
private readonly IEntityXmlSerializer _entitySerializer;
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
+ private readonly IHostingEnvironment _hostingEnvironment;
#region Constructors
@@ -51,6 +53,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
IDefaultCultureAccessor defaultCultureAccessor,
ILogger logger,
IGlobalSettings globalSettings,
+ IHostingEnvironment hostingEnvironment,
ISiteDomainHelper siteDomainHelper,
IEntityXmlSerializer entitySerializer,
MainDom mainDom,
@@ -59,7 +62,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
publishedSnapshotAccessor, variationContextAccessor, umbracoContextAccessor,
documentRepository, mediaRepository, memberRepository,
defaultCultureAccessor,
- logger, globalSettings, siteDomainHelper, entitySerializer, null, mainDom, testing, enableRepositoryEvents)
+ logger, globalSettings, hostingEnvironment, siteDomainHelper, entitySerializer, null, mainDom, testing, enableRepositoryEvents)
{
_umbracoContextAccessor = umbracoContextAccessor;
}
@@ -75,6 +78,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
IDefaultCultureAccessor defaultCultureAccessor,
ILogger logger,
IGlobalSettings globalSettings,
+ IHostingEnvironment hostingEnvironment,
ISiteDomainHelper siteDomainHelper,
IEntityXmlSerializer entitySerializer,
PublishedContentTypeCache contentTypeCache,
@@ -89,7 +93,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
_xmlStore = new XmlStore(serviceContext.ContentTypeService, serviceContext.ContentService, scopeProvider, _routesCache,
_contentTypeCache, publishedSnapshotAccessor, mainDom, testing, enableRepositoryEvents,
- documentRepository, mediaRepository, memberRepository, globalSettings, entitySerializer);
+ documentRepository, mediaRepository, memberRepository, globalSettings, entitySerializer, hostingEnvironment);
_domainService = serviceContext.DomainService;
_memberService = serviceContext.MemberService;
@@ -102,6 +106,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
_globalSettings = globalSettings;
_siteDomainHelper = siteDomainHelper;
_entitySerializer = entitySerializer;
+ _hostingEnvironment = hostingEnvironment;
}
public override void Dispose()
@@ -126,7 +131,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
}
catch
{
- errors = new[] { SystemFiles.GetContentCacheXml(_globalSettings) };
+ errors = new[] { SystemFiles.GetContentCacheXml(_hostingEnvironment) };
return false;
}
}
diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs
index a9ae5a1955..f10a3975c7 100644
--- a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs
+++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs
@@ -8,6 +8,7 @@ using System.Xml;
using NPoco;
using Umbraco.Core;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -43,6 +44,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
private readonly IMemberRepository _memberRepository;
private readonly IGlobalSettings _globalSettings;
private readonly IEntityXmlSerializer _entitySerializer;
+ private readonly IHostingEnvironment _hostingEnvironment;
private XmlStoreFilePersister _persisterTask;
private volatile bool _released;
private bool _withRepositoryEvents;
@@ -61,8 +63,8 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
///
/// The default constructor will boot the cache, load data from file or database, /// wire events in order to manage changes, etc.
public XmlStore(IContentTypeService contentTypeService, IContentService contentService, IScopeProvider scopeProvider, RoutesCache routesCache, PublishedContentTypeCache contentTypeCache,
- IPublishedSnapshotAccessor publishedSnapshotAccessor, MainDom mainDom, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, IGlobalSettings globalSettings, IEntityXmlSerializer entitySerializer)
- : this(contentTypeService, contentService, scopeProvider, routesCache, contentTypeCache, publishedSnapshotAccessor, mainDom, false, false, documentRepository, mediaRepository, memberRepository, globalSettings, entitySerializer)
+ IPublishedSnapshotAccessor publishedSnapshotAccessor, MainDom mainDom, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, IGlobalSettings globalSettings, IEntityXmlSerializer entitySerializer, IHostingEnvironment hostingEnvironment)
+ : this(contentTypeService, contentService, scopeProvider, routesCache, contentTypeCache, publishedSnapshotAccessor, mainDom, false, false, documentRepository, mediaRepository, memberRepository, globalSettings, entitySerializer, hostingEnvironment)
{ }
// internal for unit tests
@@ -70,7 +72,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
// TODO: er, we DO have a DB?
internal XmlStore(IContentTypeService contentTypeService, IContentService contentService, IScopeProvider scopeProvider, RoutesCache routesCache, PublishedContentTypeCache contentTypeCache,
IPublishedSnapshotAccessor publishedSnapshotAccessor, MainDom mainDom,
- bool testing, bool enableRepositoryEvents, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, IGlobalSettings globalSettings, IEntityXmlSerializer entitySerializer)
+ bool testing, bool enableRepositoryEvents, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, IGlobalSettings globalSettings, IEntityXmlSerializer entitySerializer, IHostingEnvironment hostingEnvironment)
{
if (testing == false)
EnsureConfigurationIsValid();
@@ -86,7 +88,9 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
_memberRepository = memberRepository;
_globalSettings = globalSettings;
_entitySerializer = entitySerializer;
- _xmlFileName = Current.IOHelper.MapPath(SystemFiles.GetContentCacheXml(_globalSettings));
+ _hostingEnvironment = hostingEnvironment;
+
+ _xmlFileName = Current.IOHelper.MapPath(SystemFiles.GetContentCacheXml(_hostingEnvironment));
if (testing)
{
@@ -103,28 +107,28 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
// internal for unit tests
// initialize with an xml document
// no events, no file nor db, no config check
- internal XmlStore(XmlDocument xmlDocument, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository)
+ internal XmlStore(XmlDocument xmlDocument, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, IHostingEnvironment hostingEnvironment)
{
_xmlDocument = xmlDocument;
_documentRepository = documentRepository;
_mediaRepository = mediaRepository;
_memberRepository = memberRepository;
_xmlFileEnabled = false;
- _xmlFileName = Current.IOHelper.MapPath(SystemFiles.GetContentCacheXml(Current.Configs.Global()));
+ _xmlFileName = Current.IOHelper.MapPath(SystemFiles.GetContentCacheXml(hostingEnvironment));
// do not plug events, we may not have what it takes to handle them
}
// internal for unit tests
// initialize with a function returning an xml document
// no events, no file nor db, no config check
- internal XmlStore(Func getXmlDocument, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository)
+ internal XmlStore(Func getXmlDocument, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, IHostingEnvironment hostingEnvironment)
{
_documentRepository = documentRepository;
_mediaRepository = mediaRepository;
_memberRepository = memberRepository;
GetXmlDocument = getXmlDocument ?? throw new ArgumentNullException(nameof(getXmlDocument));
_xmlFileEnabled = false;
- _xmlFileName = Current.IOHelper.MapPath(SystemFiles.GetContentCacheXml(Current.Configs.Global()));
+ _xmlFileName = Current.IOHelper.MapPath(SystemFiles.GetContentCacheXml(hostingEnvironment));
// do not plug events, we may not have what it takes to handle them
}
diff --git a/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs b/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs
index 31cfcb7dc8..8c7b64aec7 100644
--- a/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs
+++ b/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs
@@ -10,6 +10,7 @@ using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Events;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -58,6 +59,7 @@ namespace Umbraco.Tests.PublishedContent
var configs = TestHelper.GetConfigs();
Mock.Get(factory).Setup(x => x.GetInstance(typeof(Configs))).Returns(configs);
var globalSettings = new GlobalSettings(IOHelper.Default);
+ var hostingEnvironment = Mock.Of();
configs.Add(SettingsForTests.GenerateMockUmbracoSettings);
configs.Add(() => globalSettings);
@@ -162,7 +164,8 @@ namespace Umbraco.Tests.PublishedContent
Mock.Of(),
Mock.Of(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider() }),
- typeFinder);
+ typeFinder,
+ hostingEnvironment);
// invariant is the current default
_variationAccesor.VariationContext = new VariationContext();
diff --git a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs
index 25ff5e233b..d34aaa7dfb 100644
--- a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs
+++ b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs
@@ -205,7 +205,8 @@ namespace Umbraco.Tests.PublishedContent
Mock.Of(),
Mock.Of(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider() }),
- typeFinder);
+ typeFinder,
+ TestHelper.GetHostingEnvironment());
// invariant is the current default
_variationAccesor.VariationContext = new VariationContext();
diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentSnapshotTestBase.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentSnapshotTestBase.cs
index 882db8112c..da89e76033 100644
--- a/src/Umbraco.Tests/PublishedContent/PublishedContentSnapshotTestBase.cs
+++ b/src/Umbraco.Tests/PublishedContent/PublishedContentSnapshotTestBase.cs
@@ -14,6 +14,7 @@ using Umbraco.Core.Composing;
using Current = Umbraco.Core.Composing.Current;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -44,11 +45,11 @@ namespace Umbraco.Tests.PublishedContent
Composition.RegisterUnique(f => new PublishedModelFactory(f.GetInstance().GetTypes()));
}
- protected override TypeLoader CreateTypeLoader(IIOHelper ioHelper, ITypeFinder typeFinder, IAppPolicyCache runtimeCache, IGlobalSettings globalSettings, IProfilingLogger logger)
+ protected override TypeLoader CreateTypeLoader(IIOHelper ioHelper, ITypeFinder typeFinder, IAppPolicyCache runtimeCache,IProfilingLogger logger, IHostingEnvironment hostingEnvironment)
{
- var baseLoader = base.CreateTypeLoader(ioHelper, typeFinder, runtimeCache, globalSettings, logger);
+ var baseLoader = base.CreateTypeLoader(ioHelper, typeFinder, runtimeCache, logger, hostingEnvironment);
- return new TypeLoader(ioHelper, typeFinder, runtimeCache, new DirectoryInfo(globalSettings.LocalTempPath(ioHelper)), logger, false,
+ return new TypeLoader(ioHelper, typeFinder, runtimeCache, new DirectoryInfo(hostingEnvironment.LocalTempPath), logger, false,
// this is so the model factory looks into the test assembly
baseLoader.AssembliesToScan
.Union(new[] {typeof(PublishedContentMoreTests).Assembly})
diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs
index de4dd45f64..3786963675 100644
--- a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs
+++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs
@@ -15,6 +15,7 @@ using Moq;
using Newtonsoft.Json;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -87,11 +88,11 @@ namespace Umbraco.Tests.PublishedContent
}
- protected override TypeLoader CreateTypeLoader(IIOHelper ioHelper, ITypeFinder typeFinder, IAppPolicyCache runtimeCache, IGlobalSettings globalSettings, IProfilingLogger logger)
+ protected override TypeLoader CreateTypeLoader(IIOHelper ioHelper, ITypeFinder typeFinder, IAppPolicyCache runtimeCache, IProfilingLogger logger, IHostingEnvironment hostingEnvironment)
{
- var baseLoader = base.CreateTypeLoader(ioHelper, typeFinder, runtimeCache, globalSettings, logger);
+ var baseLoader = base.CreateTypeLoader(ioHelper, typeFinder, runtimeCache, logger, hostingEnvironment);
- return new TypeLoader(ioHelper, typeFinder, runtimeCache, new DirectoryInfo(globalSettings.LocalTempPath(ioHelper)), logger, false,
+ return new TypeLoader(ioHelper, typeFinder, runtimeCache, new DirectoryInfo(hostingEnvironment.LocalTempPath), logger, false,
// this is so the model factory looks into the test assembly
baseLoader.AssembliesToScan
.Union(new[] { typeof(PublishedContentTests).Assembly })
diff --git a/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs
index 8122113516..62941e6154 100644
--- a/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs
+++ b/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs
@@ -70,7 +70,7 @@ namespace Umbraco.Tests.PublishedContent
///
internal IPublishedContent GetNode(int id, UmbracoContext umbracoContext)
{
- var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null),
+ var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment),
ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache,
Factory.GetInstance(), Factory.GetInstance());
var doc = cache.GetById(id);
@@ -485,7 +485,7 @@ namespace Umbraco.Tests.PublishedContent
");
var node = xml.DescendantsAndSelf("Image").Single(x => (int)x.Attribute("id") == nodeId);
- var publishedMedia = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance(), Factory.GetInstance());
+ var publishedMedia = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance(), Factory.GetInstance());
var nav = node.CreateNavigator();
@@ -505,7 +505,7 @@ namespace Umbraco.Tests.PublishedContent
var errorXml = new XElement("error", string.Format("No media is maching '{0}'", 1234));
var nav = errorXml.CreateNavigator();
- var publishedMedia = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance(), Factory.GetInstance());
+ var publishedMedia = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance(), Factory.GetInstance());
var converted = publishedMedia.ConvertFromXPathNodeIterator(nav.Select("/"), 1234);
Assert.IsNull(converted);
diff --git a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs
index 2f446b36d5..32e2541763 100644
--- a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs
+++ b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs
@@ -19,6 +19,7 @@ using Umbraco.Core.Strings;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Dictionary;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Persistence;
@@ -50,8 +51,8 @@ namespace Umbraco.Tests.Routing
public class TestRuntime : WebRuntime
{
- public TestRuntime(UmbracoApplicationBase umbracoApplication, Configs configs, IUmbracoVersion umbracoVersion, IIOHelper ioHelper, ILogger logger)
- : base(umbracoApplication, configs, umbracoVersion, ioHelper, Mock.Of(), Mock.Of())
+ public TestRuntime(UmbracoApplicationBase umbracoApplication, Configs configs, IUmbracoVersion umbracoVersion, IIOHelper ioHelper, ILogger logger, IHostingEnvironment hostingEnvironment)
+ : base(umbracoApplication, configs, umbracoVersion, ioHelper, Mock.Of(), Mock.Of(), hostingEnvironment)
{
}
diff --git a/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs b/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs
index 564a98a4b3..fbcfd62b04 100644
--- a/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs
+++ b/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs
@@ -12,6 +12,7 @@ using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Events;
using Umbraco.Core.Exceptions;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
@@ -20,6 +21,7 @@ using Umbraco.Core.Scoping;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.TestHelpers.Stubs;
using Umbraco.Web;
+using Umbraco.Web.Hosting;
using Umbraco.Web.Runtime;
namespace Umbraco.Tests.Runtimes
@@ -81,7 +83,7 @@ namespace Umbraco.Tests.Runtimes
// test application
public class TestUmbracoApplication : UmbracoApplicationBase
{
- public TestUmbracoApplication() : base(new DebugDiagnosticsLogger(new MessageTemplates()), GetConfigs(), IOHelper.Default, GetProfiler())
+ public TestUmbracoApplication() : base(new DebugDiagnosticsLogger(new MessageTemplates()), GetConfigs(), IOHelper.Default, GetProfiler(), new AspNetHostingEnvironment(GetConfigs().Global(), IOHelper.Default))
{
}
@@ -100,17 +102,17 @@ namespace Umbraco.Tests.Runtimes
public IRuntime Runtime { get; private set; }
- protected override IRuntime GetRuntime(Configs configs, IUmbracoVersion umbracoVersion, IIOHelper ioHelper, ILogger logger, IProfiler profiler)
+ protected override IRuntime GetRuntime(Configs configs, IUmbracoVersion umbracoVersion, IIOHelper ioHelper, ILogger logger, IProfiler profiler, IHostingEnvironment hostingEnvironment)
{
- return Runtime = new TestRuntime(configs, umbracoVersion, ioHelper, logger, profiler);
+ return Runtime = new TestRuntime(configs, umbracoVersion, ioHelper, logger, profiler, hostingEnvironment);
}
}
// test runtime
public class TestRuntime : CoreRuntime
{
- public TestRuntime(Configs configs, IUmbracoVersion umbracoVersion, IIOHelper ioHelper, ILogger logger, IProfiler profiler)
- :base(configs, umbracoVersion, ioHelper, logger, profiler, new AspNetUmbracoBootPermissionChecker())
+ public TestRuntime(Configs configs, IUmbracoVersion umbracoVersion, IIOHelper ioHelper, ILogger logger, IProfiler profiler, IHostingEnvironment hostingEnvironment)
+ :base(configs, umbracoVersion, ioHelper, logger, profiler, new AspNetUmbracoBootPermissionChecker(), hostingEnvironment)
{
}
diff --git a/src/Umbraco.Tests/Runtimes/StandaloneTests.cs b/src/Umbraco.Tests/Runtimes/StandaloneTests.cs
index 4ad97cafc3..0db566a829 100644
--- a/src/Umbraco.Tests/Runtimes/StandaloneTests.cs
+++ b/src/Umbraco.Tests/Runtimes/StandaloneTests.cs
@@ -13,6 +13,7 @@ using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Migrations.Install;
@@ -63,6 +64,7 @@ namespace Umbraco.Tests.Runtimes
var databaseFactory = new UmbracoDatabaseFactory(logger, new Lazy(() => factory.GetInstance()), TestHelper.GetConfigs());
var typeFinder = new TypeFinder(logger);
var ioHelper = IOHelper.Default;
+ var hostingEnvironment = Mock.Of();
var typeLoader = new TypeLoader(ioHelper, typeFinder, appCaches.RuntimeCache, new DirectoryInfo(ioHelper.MapPath("~/App_Data/TEMP")), profilingLogger);
var mainDom = new SimpleMainDom();
var umbracoVersion = TestHelper.GetUmbracoVersion();
@@ -75,7 +77,7 @@ namespace Umbraco.Tests.Runtimes
composition.RegisterEssentials(logger, profiler, profilingLogger, mainDom, appCaches, databaseFactory, typeLoader, runtimeState, typeFinder, ioHelper, umbracoVersion);
// create the core runtime and have it compose itself
- var coreRuntime = new CoreRuntime(configs, umbracoVersion, ioHelper, logger, profiler, new AspNetUmbracoBootPermissionChecker());coreRuntime.Compose(composition);
+ var coreRuntime = new CoreRuntime(configs, umbracoVersion, ioHelper, logger, profiler, new AspNetUmbracoBootPermissionChecker(), hostingEnvironment);coreRuntime.Compose(composition);
// determine actual runtime level
runtimeState.DetermineRuntimeLevel(databaseFactory, logger);
@@ -256,6 +258,7 @@ namespace Umbraco.Tests.Runtimes
var ioHelper = IOHelper.Default;
var typeLoader = new TypeLoader(ioHelper, typeFinder, appCaches.RuntimeCache, new DirectoryInfo(ioHelper.MapPath("~/App_Data/TEMP")), profilingLogger);
var runtimeState = Mock.Of();
+ var hostingEnvironment = Mock.Of();
Mock.Get(runtimeState).Setup(x => x.Level).Returns(RuntimeLevel.Run);
var mainDom = Mock.Of();
Mock.Get(mainDom).Setup(x => x.IsMainDom).Returns(true);
@@ -268,7 +271,7 @@ namespace Umbraco.Tests.Runtimes
composition.RegisterEssentials(logger, profiler, profilingLogger, mainDom, appCaches, databaseFactory, typeLoader, runtimeState, typeFinder, ioHelper, umbracoVersion);
// create the core runtime and have it compose itself
- var coreRuntime = new CoreRuntime(configs, umbracoVersion, ioHelper, logger, profiler, new AspNetUmbracoBootPermissionChecker());
+ var coreRuntime = new CoreRuntime(configs, umbracoVersion, ioHelper, logger, profiler, new AspNetUmbracoBootPermissionChecker(), hostingEnvironment);
coreRuntime.Compose(composition);
// get the components
diff --git a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs
index 0d2243c6dc..07cbcb2686 100644
--- a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs
+++ b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs
@@ -81,6 +81,7 @@ namespace Umbraco.Tests.Scoping
var documentRepository = Mock.Of();
var mediaRepository = Mock.Of();
var memberRepository = Mock.Of();
+ var hostingEnvironment = TestHelper.GetHostingEnvironment();
var typeFinder = new TypeFinder(Mock.Of());
@@ -102,7 +103,8 @@ namespace Umbraco.Tests.Scoping
Factory.GetInstance(),
Mock.Of(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider() }),
- typeFinder);
+ typeFinder,
+ hostingEnvironment);
}
protected UmbracoContext GetUmbracoContextNu(string url, int templateId = 1234, RouteData routeData = null, bool setSingleton = false, IUmbracoSettingsSection umbracoSettings = null, IEnumerable urlProviders = null)
diff --git a/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs b/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs
index bc515cfea3..d22e5c19e3 100644
--- a/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs
+++ b/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs
@@ -8,6 +8,7 @@ using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Hosting;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
@@ -49,10 +50,12 @@ namespace Umbraco.Tests.Services
var runtimeStateMock = new Mock();
runtimeStateMock.Setup(x => x.Level).Returns(() => RuntimeLevel.Run);
- var contentTypeFactory = Factory.GetInstance();
+ var contentTypeFactory = Factory.GetInstance();
var documentRepository = Factory.GetInstance();
var mediaRepository = Mock.Of();
var memberRepository = Mock.Of();
+ var hostingEnvironment = Mock.Of();
+
var typeFinder = new TypeFinder(Mock.Of());
@@ -74,7 +77,8 @@ namespace Umbraco.Tests.Services
Factory.GetInstance(),
Mock.Of(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider() }),
- typeFinder);
+ typeFinder,
+ hostingEnvironment);
}
public class LocalServerMessenger : ServerMessengerBase
@@ -127,8 +131,8 @@ namespace Umbraco.Tests.Services
[TestCase(ContentVariation.CultureAndSegment, ContentVariation.CultureAndSegment, false)]
public void Change_Content_Type_Variation_Clears_Redirects(ContentVariation startingContentTypeVariation, ContentVariation changedContentTypeVariation, bool shouldUrlRedirectsBeCleared)
{
- var contentType = MockedContentTypes.CreateBasicContentType();
- contentType.Variations = startingContentTypeVariation;
+ var contentType = MockedContentTypes.CreateBasicContentType();
+ contentType.Variations = startingContentTypeVariation;
ServiceContext.ContentTypeService.Save(contentType);
var contentType2 = MockedContentTypes.CreateBasicContentType("test");
ServiceContext.ContentTypeService.Save(contentType2);
@@ -407,7 +411,7 @@ namespace Umbraco.Tests.Services
Assert.AreEqual("hello world", doc.GetValue("title"));
Assert.IsTrue(doc.IsCultureEdited("en-US")); //invariant prop changes show up on default lang
Assert.IsTrue(doc.Edited);
-
+
//change the property type to be variant
contentType.PropertyTypes.First().Variations = variant;
ServiceContext.ContentTypeService.Save(contentType);
@@ -435,7 +439,7 @@ namespace Umbraco.Tests.Services
{
//create content type with a property type that varies by culture
var contentType = MockedContentTypes.CreateBasicContentType();
- // content type supports all variations
+ // content type supports all variations
contentType.Variations = ContentVariation.Culture | ContentVariation.Segment;
var properties = CreatePropertyCollection(("title", variant));
contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "Content" });
@@ -472,7 +476,7 @@ namespace Umbraco.Tests.Services
{
//create content type with a property type that varies by culture
var contentType = MockedContentTypes.CreateBasicContentType();
- // content type supports all variations
+ // content type supports all variations
contentType.Variations = ContentVariation.Culture | ContentVariation.Segment;
var properties = CreatePropertyCollection(("title", variant));
contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "Content" });
@@ -879,14 +883,14 @@ namespace Umbraco.Tests.Services
// switch property type to Invariant
contentType.PropertyTypes.First(x => x.Alias == "value1").Variations = invariant;
ServiceContext.ContentTypeService.Save(contentType); //This is going to have to re-normalize the "Edited" flag
-
+
document = ServiceContext.ContentService.GetById(document.Id);
Assert.IsTrue(document.IsCultureEdited("en")); //This will remain true because there is now a pending change for the invariant property data which is flagged under the default lang
Assert.IsFalse(document.IsCultureEdited("fr")); //This will be false because nothing has changed for this culture and the property no longer reflects variant changes
Assert.IsTrue(document.Edited);
//update the invariant value and publish
- document.SetValue("value1", "v1inv");
+ document.SetValue("value1", "v1inv");
ServiceContext.ContentService.SaveAndPublish(document);
document = ServiceContext.ContentService.GetById(document.Id);
@@ -906,7 +910,7 @@ namespace Umbraco.Tests.Services
// switch property back to Culture
contentType.PropertyTypes.First(x => x.Alias == "value1").Variations = variant;
ServiceContext.ContentTypeService.Save(contentType);
-
+
document = ServiceContext.ContentService.GetById(document.Id);
Assert.AreEqual("v1inv", document.GetValue("value1", "en")); //The invariant property value gets copied over to the default language
Assert.AreEqual("v1inv", document.GetValue("value1", "en", published: true));
@@ -970,9 +974,9 @@ namespace Umbraco.Tests.Services
Assert.AreEqual("doc1en", document.GetCultureName("en"));
Assert.AreEqual("doc1fr", document.GetCultureName("fr"));
Assert.AreEqual("v1en", document.GetValue("value1"));
- Assert.AreEqual("v1en-init", document.GetValue("value1", published: true));
+ Assert.AreEqual("v1en-init", document.GetValue("value1", published: true));
Assert.IsTrue(document.IsCultureEdited("en")); //This is true because the invariant property reflects changes on the default lang
- Assert.IsFalse(document.IsCultureEdited("fr"));
+ Assert.IsFalse(document.IsCultureEdited("fr"));
Assert.IsTrue(document.Edited);
// switch property type to Culture
@@ -980,7 +984,7 @@ namespace Umbraco.Tests.Services
ServiceContext.ContentTypeService.Save(contentType); //This is going to have to re-normalize the "Edited" flag
document = ServiceContext.ContentService.GetById(document.Id);
- Assert.IsTrue(document.IsCultureEdited("en")); //Remains true
+ Assert.IsTrue(document.IsCultureEdited("en")); //Remains true
Assert.IsFalse(document.IsCultureEdited("fr")); //False because no french property has ever been edited
Assert.IsTrue(document.Edited);
@@ -1010,7 +1014,7 @@ namespace Umbraco.Tests.Services
Assert.IsNull(document.GetValue("value1", "fr")); //The values are there but the business logic returns null
Assert.IsNull(document.GetValue("value1", "fr", published: true)); //The values are there but the business logic returns null
Assert.IsFalse(document.IsCultureEdited("en")); //The variant published AND edited values are copied over to the invariant
- Assert.IsFalse(document.IsCultureEdited("fr"));
+ Assert.IsFalse(document.IsCultureEdited("fr"));
Assert.IsFalse(document.Edited);
}
diff --git a/src/Umbraco.Tests/TestHelpers/TestHelper.cs b/src/Umbraco.Tests/TestHelpers/TestHelper.cs
index 64794fcea9..cfc9f179ee 100644
--- a/src/Umbraco.Tests/TestHelpers/TestHelper.cs
+++ b/src/Umbraco.Tests/TestHelpers/TestHelper.cs
@@ -13,6 +13,7 @@ using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -20,6 +21,7 @@ using Umbraco.Core.Models.Entities;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
using Umbraco.Core.Sync;
+using Umbraco.Web.Hosting;
using File = System.IO.File;
namespace Umbraco.Tests.TestHelpers
@@ -296,5 +298,10 @@ namespace Umbraco.Tests.TestHelpers
{
return RegisterFactory.Create(GetConfigs().Global());
}
+
+ public static IHostingEnvironment GetHostingEnvironment()
+ {
+ return new AspNetHostingEnvironment(SettingsForTests.GetDefaultGlobalSettings(), IOHelper.Default);
+ }
}
}
diff --git a/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs b/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs
index 9ced8d8a5d..dcee0cc466 100644
--- a/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs
+++ b/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs
@@ -23,6 +23,7 @@ using Umbraco.Web.Security;
using Umbraco.Web.Routing;
using File = System.IO.File;
using Umbraco.Core.Composing;
+using Umbraco.Core.Hosting;
using Umbraco.Core.Persistence.Mappers;
using Umbraco.Core.Scoping;
using Umbraco.Tests.Testing;
@@ -60,6 +61,7 @@ namespace Umbraco.Tests.TestHelpers
internal ScopeProvider ScopeProvider => Current.ScopeProvider as ScopeProvider;
protected ISqlContext SqlContext => Factory.GetInstance();
+ protected IHostingEnvironment HostingEnvironment => Factory.GetInstance();
public override void SetUp()
{
@@ -268,7 +270,9 @@ namespace Umbraco.Tests.TestHelpers
Factory.GetInstance(), Factory.GetInstance(), Factory.GetInstance(),
DefaultCultureAccessor,
Logger,
- Factory.GetInstance(), new SiteDomainHelper(),
+ Factory.GetInstance(),
+ HostingEnvironment,
+ new SiteDomainHelper(),
Factory.GetInstance(),
ContentTypesCache,
null, true, Options.PublishedRepositoryEvents);
diff --git a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs
index 44f19f4540..e8b44362e9 100644
--- a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs
+++ b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs
@@ -36,9 +36,11 @@ using Umbraco.Web.PublishedCache;
using Umbraco.Web.Routing;
using Umbraco.Web.Trees;
using Umbraco.Core.Composing.CompositionExtensions;
+using Umbraco.Core.Hosting;
using Umbraco.Core.Mapping;
using Umbraco.Core.Serialization;
using Umbraco.Web.Composing.CompositionExtensions;
+using Umbraco.Web.Hosting;
using Umbraco.Web.Sections;
using Current = Umbraco.Core.Composing.Current;
using FileSystems = Umbraco.Core.IO.FileSystems;
@@ -140,8 +142,9 @@ namespace Umbraco.Tests.Testing
TypeFinder = new TypeFinder(logger);
var appCaches = GetAppCaches();
var globalSettings = SettingsForTests.GetDefaultGlobalSettings();
+ IHostingEnvironment hostingEnvironment = new AspNetHostingEnvironment(globalSettings, IOHelper);
UmbracoVersion = new UmbracoVersion(globalSettings);
- var typeLoader = GetTypeLoader(IOHelper, TypeFinder, appCaches.RuntimeCache, globalSettings, proflogger, Options.TypeLoader);
+ var typeLoader = GetTypeLoader(IOHelper, TypeFinder, appCaches.RuntimeCache, hostingEnvironment, proflogger, Options.TypeLoader);
var register = TestHelper.GetRegister();
@@ -156,6 +159,7 @@ namespace Umbraco.Tests.Testing
Composition.RegisterUnique(profiler);
Composition.RegisterUnique(proflogger);
Composition.RegisterUnique(appCaches);
+ Composition.RegisterUnique(hostingEnvironment);
TestObjects = new TestObjects(register);
Compose();
@@ -279,30 +283,30 @@ namespace Umbraco.Tests.Testing
.ComposeWebMappingProfiles();
}
- protected virtual TypeLoader GetTypeLoader(IIOHelper ioHelper, ITypeFinder typeFinder, IAppPolicyCache runtimeCache, IGlobalSettings globalSettings, IProfilingLogger logger, UmbracoTestOptions.TypeLoader option)
+ protected virtual TypeLoader GetTypeLoader(IIOHelper ioHelper, ITypeFinder typeFinder, IAppPolicyCache runtimeCache, IHostingEnvironment hostingEnvironment, IProfilingLogger logger, UmbracoTestOptions.TypeLoader option)
{
switch (option)
{
case UmbracoTestOptions.TypeLoader.Default:
- return _commonTypeLoader ?? (_commonTypeLoader = CreateCommonTypeLoader(ioHelper, typeFinder, runtimeCache, globalSettings, logger));
+ return _commonTypeLoader ?? (_commonTypeLoader = CreateCommonTypeLoader(ioHelper, typeFinder, runtimeCache, logger, hostingEnvironment));
case UmbracoTestOptions.TypeLoader.PerFixture:
- return _featureTypeLoader ?? (_featureTypeLoader = CreateTypeLoader(ioHelper, typeFinder, runtimeCache, globalSettings, logger));
+ return _featureTypeLoader ?? (_featureTypeLoader = CreateTypeLoader(ioHelper, typeFinder, runtimeCache, logger, hostingEnvironment));
case UmbracoTestOptions.TypeLoader.PerTest:
- return CreateTypeLoader(ioHelper, typeFinder, runtimeCache, globalSettings, logger);
+ return CreateTypeLoader(ioHelper, typeFinder, runtimeCache, logger, hostingEnvironment);
default:
throw new ArgumentOutOfRangeException(nameof(option));
}
}
- protected virtual TypeLoader CreateTypeLoader(IIOHelper ioHelper, ITypeFinder typeFinder, IAppPolicyCache runtimeCache, IGlobalSettings globalSettings, IProfilingLogger logger)
+ protected virtual TypeLoader CreateTypeLoader(IIOHelper ioHelper, ITypeFinder typeFinder, IAppPolicyCache runtimeCache, IProfilingLogger logger, IHostingEnvironment hostingEnvironment)
{
- return CreateCommonTypeLoader(ioHelper, typeFinder, runtimeCache, globalSettings, logger);
+ return CreateCommonTypeLoader(ioHelper, typeFinder, runtimeCache, logger, hostingEnvironment);
}
// common to all tests = cannot be overriden
- private static TypeLoader CreateCommonTypeLoader(IIOHelper ioHelper, ITypeFinder typeFinder, IAppPolicyCache runtimeCache, IGlobalSettings globalSettings, IProfilingLogger logger)
+ private static TypeLoader CreateCommonTypeLoader(IIOHelper ioHelper, ITypeFinder typeFinder, IAppPolicyCache runtimeCache, IProfilingLogger logger, IHostingEnvironment hostingEnvironment)
{
- return new TypeLoader(ioHelper, typeFinder, runtimeCache, new DirectoryInfo(globalSettings.LocalTempPath(ioHelper)), logger, false, new[]
+ return new TypeLoader(ioHelper, typeFinder, runtimeCache, new DirectoryInfo(hostingEnvironment.LocalTempPath), logger, false, new[]
{
Assembly.Load("Umbraco.Core"),
Assembly.Load("Umbraco.Web"),
diff --git a/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs b/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs
index 9ca17675af..6ce1eae7fe 100644
--- a/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs
+++ b/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs
@@ -425,7 +425,9 @@ namespace Umbraco.Tests.Web.Mvc
null, null,
umbracoContextAccessor, null, null, null,
new TestDefaultCultureAccessor(),
- Current.Logger, TestObjects.GetGlobalSettings(), new SiteDomainHelper(),
+ Current.Logger, TestObjects.GetGlobalSettings(),
+ TestHelper.GetHostingEnvironment(),
+ new SiteDomainHelper(),
Factory.GetInstance(),
null, true, false
); // no events
diff --git a/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs b/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs
index e9fcd6b305..f3a06c06a2 100644
--- a/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs
+++ b/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs
@@ -14,6 +14,7 @@ using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Scoping;
using Umbraco.Web.Composing;
using System.ComponentModel;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
namespace Umbraco.Web
@@ -29,8 +30,8 @@ namespace Umbraco.Web
private readonly IUmbracoDatabaseFactory _databaseFactory;
public BatchedDatabaseServerMessenger(
- IRuntimeState runtime, IUmbracoDatabaseFactory databaseFactory, IScopeProvider scopeProvider, ISqlContext sqlContext, IProfilingLogger proflog, IGlobalSettings globalSettings, DatabaseServerMessengerOptions options, IIOHelper ioHelper)
- : base(runtime, scopeProvider, sqlContext, proflog, globalSettings, true, options, ioHelper)
+ IRuntimeState runtime, IUmbracoDatabaseFactory databaseFactory, IScopeProvider scopeProvider, ISqlContext sqlContext, IProfilingLogger proflog, DatabaseServerMessengerOptions options, IIOHelper ioHelper, IHostingEnvironment hostingEnvironment)
+ : base(runtime, scopeProvider, sqlContext, proflog, true, options, ioHelper, hostingEnvironment )
{
_databaseFactory = databaseFactory;
}
diff --git a/src/Umbraco.Web/Hosting/AspNetHostingEnvironment.cs b/src/Umbraco.Web/Hosting/AspNetHostingEnvironment.cs
new file mode 100644
index 0000000000..b57a19705f
--- /dev/null
+++ b/src/Umbraco.Web/Hosting/AspNetHostingEnvironment.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Web;
+using System.Web.Hosting;
+using Umbraco.Core;
+using Umbraco.Core.Configuration;
+using Umbraco.Core.Hosting;
+using Umbraco.Core.IO;
+
+namespace Umbraco.Web.Hosting
+{
+ public class AspNetHostingEnvironment : IHostingEnvironment
+ {
+ private readonly IGlobalSettings _globalSettings;
+ private readonly IIOHelper _ioHelper;
+ private string _localTempPath;
+
+ public AspNetHostingEnvironment(IGlobalSettings globalSettings, IIOHelper ioHelper)
+ {
+ _globalSettings = globalSettings ?? throw new ArgumentNullException(nameof(globalSettings));
+ _ioHelper = ioHelper ?? throw new ArgumentNullException(nameof(ioHelper));
+
+ SiteName = HostingEnvironment.SiteName;
+ ApplicationId = HostingEnvironment.ApplicationID;
+ ApplicationPhysicalPath = HostingEnvironment.ApplicationPhysicalPath;
+ }
+
+ public string SiteName { get; }
+ public string ApplicationId { get; }
+ public string ApplicationPhysicalPath { get; }
+
+ public string LocalTempPath
+ {
+ get
+ {
+ if (_localTempPath != null)
+ return _localTempPath;
+
+ switch (_globalSettings.LocalTempStorageLocation)
+ {
+ case LocalTempStorage.AspNetTemp:
+ return _localTempPath = System.IO.Path.Combine(HttpRuntime.CodegenDir, "UmbracoData");
+
+ case LocalTempStorage.EnvironmentTemp:
+
+ // environment temp is unique, we need a folder per site
+
+ // use a hash
+ // combine site name and application id
+ // site name is a Guid on Cloud
+ // application id is eg /LM/W3SVC/123456/ROOT
+ // the combination is unique on one server
+ // and, if a site moves from worker A to B and then back to A...
+ // hopefully it gets a new Guid or new application id?
+
+ var hashString = SiteName + "::" + ApplicationId;
+ var hash = hashString.GenerateHash();
+ var siteTemp = System.IO.Path.Combine(Environment.ExpandEnvironmentVariables("%temp%"), "UmbracoData", hash);
+
+ return _localTempPath = siteTemp;
+
+ //case LocalTempStorage.Default:
+ //case LocalTempStorage.Unknown:
+ default:
+ return _localTempPath = _ioHelper.MapPath("~/App_Data/TEMP");
+ }
+ }
+ }
+ }
+}
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
index 974731b9bd..0ada286f07 100755
--- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
@@ -10,6 +10,7 @@ using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Hosting;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
@@ -48,6 +49,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
private readonly IDefaultCultureAccessor _defaultCultureAccessor;
private readonly UrlSegmentProviderCollection _urlSegmentProviders;
private readonly ITypeFinder _typeFinder;
+ private readonly IHostingEnvironment _hostingEnvironment;
// volatile because we read it with no lock
private volatile bool _isReady;
@@ -80,7 +82,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
IEntityXmlSerializer entitySerializer,
IPublishedModelFactory publishedModelFactory,
UrlSegmentProviderCollection urlSegmentProviders,
- ITypeFinder typeFinder)
+ ITypeFinder typeFinder,
+ IHostingEnvironment hostingEnvironment)
: base(publishedSnapshotAccessor, variationContextAccessor)
{
//if (Interlocked.Increment(ref _singletonCheck) > 1)
@@ -98,6 +101,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
_globalSettings = globalSettings;
_urlSegmentProviders = urlSegmentProviders;
_typeFinder = typeFinder;
+ _hostingEnvironment = hostingEnvironment;
// 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
@@ -299,7 +303,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
private string GetLocalFilesPath()
{
- var path = Path.Combine(_globalSettings.LocalTempPath(Current.IOHelper), "NuCache");
+ var path = Path.Combine(_hostingEnvironment.LocalTempPath, "NuCache");
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
diff --git a/src/Umbraco.Web/Runtime/WebInitialComponent.cs b/src/Umbraco.Web/Runtime/WebInitialComponent.cs
index 380c3915b7..f02a3686ac 100644
--- a/src/Umbraco.Web/Runtime/WebInitialComponent.cs
+++ b/src/Umbraco.Web/Runtime/WebInitialComponent.cs
@@ -14,6 +14,7 @@ using ClientDependency.Core.Config;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Web.Install;
using Umbraco.Web.JavaScript;
@@ -30,13 +31,15 @@ namespace Umbraco.Web.Runtime
private readonly SurfaceControllerTypeCollection _surfaceControllerTypes;
private readonly UmbracoApiControllerTypeCollection _apiControllerTypes;
private readonly IGlobalSettings _globalSettings;
+ private readonly IHostingEnvironment _hostingEnvironment;
- public WebInitialComponent(IUmbracoContextAccessor umbracoContextAccessor, SurfaceControllerTypeCollection surfaceControllerTypes, UmbracoApiControllerTypeCollection apiControllerTypes, IGlobalSettings globalSettings)
+ public WebInitialComponent(IUmbracoContextAccessor umbracoContextAccessor, SurfaceControllerTypeCollection surfaceControllerTypes, UmbracoApiControllerTypeCollection apiControllerTypes, IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
{
_umbracoContextAccessor = umbracoContextAccessor;
_surfaceControllerTypes = surfaceControllerTypes;
_apiControllerTypes = apiControllerTypes;
_globalSettings = globalSettings;
+ _hostingEnvironment = hostingEnvironment;
}
public void Initialize()
@@ -48,7 +51,7 @@ namespace Umbraco.Web.Runtime
// want to access HttpContext.Current, which doesn't exist
if (Current.IOHelper.IsHosted)
{
- ConfigureClientDependency(_globalSettings);
+ ConfigureClientDependency();
}
// Disable the X-AspNetMvc-Version HTTP Header
@@ -109,7 +112,7 @@ namespace Umbraco.Web.Runtime
new NamespaceHttpControllerSelector(GlobalConfiguration.Configuration));
}
- private static void ConfigureClientDependency(IGlobalSettings globalSettings)
+ private void ConfigureClientDependency()
{
// Backwards compatibility - set the path and URL type for ClientDependency 1.5.1 [LK]
XmlFileMapper.FileMapDefaultFolder = Core.Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "ClientDependency";
@@ -117,9 +120,9 @@ namespace Umbraco.Web.Runtime
// Now we need to detect if we are running 'Umbraco.Core.LocalTempStorage' as EnvironmentTemp and in that case we want to change the CDF file
// location to be there
- if (globalSettings.LocalTempStorageLocation == LocalTempStorage.EnvironmentTemp)
+ if (_globalSettings.LocalTempStorageLocation == LocalTempStorage.EnvironmentTemp)
{
- var cachePath = globalSettings.LocalTempPath(Current.IOHelper);
+ var cachePath = _hostingEnvironment.LocalTempPath;
//set the file map and composite file default location to the %temp% location
BaseCompositeFileProcessingProvider.CompositeFilePathDefaultFolder
diff --git a/src/Umbraco.Web/Runtime/WebInitialComposer.cs b/src/Umbraco.Web/Runtime/WebInitialComposer.cs
index e11739d62f..57774e533c 100644
--- a/src/Umbraco.Web/Runtime/WebInitialComposer.cs
+++ b/src/Umbraco.Web/Runtime/WebInitialComposer.cs
@@ -8,6 +8,7 @@ using Umbraco.Core.Composing;
using Umbraco.Core.Dashboards;
using Umbraco.Core.Dictionary;
using Umbraco.Core.Events;
+using Umbraco.Core.Hosting;
using Umbraco.Core.Migrations.PostMigrations;
using Umbraco.Web.Migrations.PostMigrations;
using Umbraco.Core.Models.PublishedContent;
@@ -24,6 +25,7 @@ using Umbraco.Web.Dictionary;
using Umbraco.Web.Editors;
using Umbraco.Web.Features;
using Umbraco.Web.HealthCheck;
+using Umbraco.Web.Hosting;
using Umbraco.Web.Macros;
using Umbraco.Web.Media.EmbedProviders;
using Umbraco.Web.Models.PublishedContent;
@@ -55,6 +57,7 @@ namespace Umbraco.Web.Runtime
composition.Register();
composition.Register();
+ composition.Register();
composition.RegisterUnique(); // required for hybrid accessors
diff --git a/src/Umbraco.Web/Runtime/WebRuntime.cs b/src/Umbraco.Web/Runtime/WebRuntime.cs
index 44e6ba6e9f..05031f67a6 100644
--- a/src/Umbraco.Web/Runtime/WebRuntime.cs
+++ b/src/Umbraco.Web/Runtime/WebRuntime.cs
@@ -1,14 +1,15 @@
using System.Web;
-using System.Web.Hosting;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Runtime;
using Umbraco.Web.Cache;
using Umbraco.Web.Composing;
+using Umbraco.Web.Hosting;
using Umbraco.Web.Logging;
namespace Umbraco.Web.Runtime
@@ -26,8 +27,8 @@ namespace Umbraco.Web.Runtime
/// Initializes a new instance of the class.
///
///
- public WebRuntime(UmbracoApplicationBase umbracoApplication, Configs configs, IUmbracoVersion umbracoVersion, IIOHelper ioHelper, ILogger logger, IProfiler profiler):
- base(configs, umbracoVersion, ioHelper, logger, profiler ,new AspNetUmbracoBootPermissionChecker())
+ public WebRuntime(UmbracoApplicationBase umbracoApplication, Configs configs, IUmbracoVersion umbracoVersion, IIOHelper ioHelper, ILogger logger, IProfiler profiler, IHostingEnvironment hostingEnvironment):
+ base(configs, umbracoVersion, ioHelper, logger, profiler ,new AspNetUmbracoBootPermissionChecker(), hostingEnvironment)
{
_umbracoApplication = umbracoApplication;
@@ -63,7 +64,7 @@ namespace Umbraco.Web.Runtime
{
Logger.Info("Booting site '{HostingSiteName}', app '{HostingApplicationID}', path '{HostingPhysicalPath}', server '{MachineName}'.",
HostingEnvironment.SiteName,
- HostingEnvironment.ApplicationID,
+ HostingEnvironment.ApplicationId,
HostingEnvironment.ApplicationPhysicalPath,
NetworkHelper.MachineName);
Logger.Debug("Runtime: {Runtime}", GetType().FullName);
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index fd4c45a41f..2dbf47c35b 100755
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -163,6 +163,7 @@
+
@@ -1263,7 +1264,6 @@
umbraco_org_umbraco_update_CheckForUpgrade
-