diff --git a/src/Umbraco.Abstractions/IO/IIOHelper.cs b/src/Umbraco.Abstractions/IO/IIOHelper.cs index 3266426cc5..b4a1007c2d 100644 --- a/src/Umbraco.Abstractions/IO/IIOHelper.cs +++ b/src/Umbraco.Abstractions/IO/IIOHelper.cs @@ -80,12 +80,6 @@ namespace Umbraco.Core.IO /// string GetRelativePath(string path); - string Media { get; } - string Scripts { get; } - string Css { get; } - string Umbraco { get; } - - /// /// Gets the root path of the application /// diff --git a/src/Umbraco.Core/Composing/CompositionExtensions/FileSystems.cs b/src/Umbraco.Core/Composing/CompositionExtensions/FileSystems.cs index 661c96a32f..37754f296b 100644 --- a/src/Umbraco.Core/Composing/CompositionExtensions/FileSystems.cs +++ b/src/Umbraco.Core/Composing/CompositionExtensions/FileSystems.cs @@ -90,7 +90,7 @@ namespace Umbraco.Core.Composing.CompositionExtensions // register the IFileSystem supporting the IMediaFileSystem // THIS IS THE ONLY THING THAT NEEDS TO CHANGE, IN ORDER TO REPLACE THE UNDERLYING FILESYSTEM // and, SupportingFileSystem.For() returns the underlying filesystem - composition.SetMediaFileSystem(() => new PhysicalFileSystem(Current.IOHelper.Media)); + composition.SetMediaFileSystem(() => new PhysicalFileSystem(Current.Configs.Global().UmbracoMediaPath)); return composition; } diff --git a/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs b/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs index b8fc37941a..74cbab715f 100644 --- a/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs +++ b/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs @@ -89,7 +89,7 @@ namespace Umbraco.Core.Composing.CompositionExtensions private static LocalizedTextServiceFileSources SourcesFactory(IFactory container) { - var mainLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(IOHelper.Default.Umbraco + "/config/lang/")); + var mainLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(Current.Configs.Global().UmbracoPath + "/config/lang/")); var appPlugins = new DirectoryInfo(Current.IOHelper.MapPath(Constants.SystemDirectories.AppPlugins)); var configLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(Constants.SystemDirectories.Config + "/lang/")); diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index 00168cf028..fa46bfbfbf 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -386,13 +386,13 @@ namespace Umbraco.Core.Configuration } private string _umbracoMediaPath = null; - public string UmbracoMediaPath => GetterWithDefaultValue(Constants.AppSettings.UmbracoMediaPath, "~/umbraco", ref _umbracoMediaPath); + public string UmbracoMediaPath => GetterWithDefaultValue(Constants.AppSettings.UmbracoMediaPath, "~/media", ref _umbracoMediaPath); private string _umbracoScriptsPath = null; - public string UmbracoScriptsPath => GetterWithDefaultValue(Constants.AppSettings.UmbracoScriptsPath, "~/umbraco", ref _umbracoScriptsPath); + public string UmbracoScriptsPath => GetterWithDefaultValue(Constants.AppSettings.UmbracoScriptsPath, "~/scripts", ref _umbracoScriptsPath); private string _umbracoCssPath = null; - public string UmbracoCssPath => GetterWithDefaultValue(Constants.AppSettings.UmbracoCssPath, "~/umbraco", ref _umbracoCssPath); + public string UmbracoCssPath => GetterWithDefaultValue(Constants.AppSettings.UmbracoCssPath, "~/css", ref _umbracoCssPath); private string _umbracoPath = null; public string UmbracoPath => GetterWithDefaultValue(Constants.AppSettings.UmbracoPath, "~/umbraco", ref _umbracoPath); diff --git a/src/Umbraco.Core/IO/FileSystems.cs b/src/Umbraco.Core/IO/FileSystems.cs index b50e53180c..08f56b5869 100644 --- a/src/Umbraco.Core/IO/FileSystems.cs +++ b/src/Umbraco.Core/IO/FileSystems.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Threading; using Umbraco.Core.Logging; using Umbraco.Core.Composing; +using Umbraco.Core.Configuration; namespace Umbraco.Core.IO { @@ -34,11 +35,12 @@ namespace Umbraco.Core.IO #region Constructor // DI wants a public ctor - public FileSystems(IFactory container, ILogger logger, IIOHelper ioHelper) + public FileSystems(IFactory container, ILogger logger, IIOHelper ioHelper, IGlobalSettings globalSettings) { _container = container; _logger = logger; _ioHelper = ioHelper; + _globalSettings = globalSettings; } // for tests only, totally unsafe @@ -124,8 +126,8 @@ namespace Umbraco.Core.IO { var macroPartialFileSystem = new PhysicalFileSystem(Constants.SystemDirectories.MacroPartials); var partialViewsFileSystem = new PhysicalFileSystem(Constants.SystemDirectories.PartialViews); - var stylesheetsFileSystem = new PhysicalFileSystem(_ioHelper.Css); - var scriptsFileSystem = new PhysicalFileSystem(_ioHelper.Scripts); + var stylesheetsFileSystem = new PhysicalFileSystem(_globalSettings.UmbracoCssPath); + var scriptsFileSystem = new PhysicalFileSystem(_globalSettings.UmbracoScriptsPath); var mvcViewsFileSystem = new PhysicalFileSystem(Constants.SystemDirectories.MvcViews); _macroPartialFileSystem = new ShadowWrapper(macroPartialFileSystem, "macro-partials", IsScoped); @@ -149,6 +151,7 @@ namespace Umbraco.Core.IO #region Providers private readonly Dictionary _paths = new Dictionary(); + private IGlobalSettings _globalSettings; // internal for tests internal IReadOnlyDictionary Paths => _paths; diff --git a/src/Umbraco.Core/IO/IOHelper.cs b/src/Umbraco.Core/IO/IOHelper.cs index 8ab9c93b31..0c15ac1b26 100644 --- a/src/Umbraco.Core/IO/IOHelper.cs +++ b/src/Umbraco.Core/IO/IOHelper.cs @@ -12,13 +12,8 @@ namespace Umbraco.Core.IO { public class IOHelper : IIOHelper { - private readonly IGlobalSettings _globalSettings; - internal static IIOHelper Default { get; } = new IOHelper(new GlobalSettings()); + internal static IIOHelper Default { get; } = new IOHelper(); - public IOHelper(IGlobalSettings globalSettings) - { - _globalSettings = globalSettings; - } /// /// Gets or sets a value forcing Umbraco to consider it is non-hosted. @@ -292,15 +287,6 @@ namespace Umbraco.Core.IO return path.EnsurePathIsApplicationRootPrefixed(); } - - public string Media => _globalSettings.UmbracoMediaPath; - - public string Scripts => _globalSettings.UmbracoScriptsPath; - - public string Css => _globalSettings.UmbracoCssPath; - - public string Umbraco => _globalSettings.UmbracoPath; - private string _root; /// diff --git a/src/Umbraco.Core/Packaging/CompiledPackageXmlParser.cs b/src/Umbraco.Core/Packaging/CompiledPackageXmlParser.cs index f53fb872a0..c8b5720c21 100644 --- a/src/Umbraco.Core/Packaging/CompiledPackageXmlParser.cs +++ b/src/Umbraco.Core/Packaging/CompiledPackageXmlParser.cs @@ -138,7 +138,7 @@ namespace Umbraco.Core.Packaging if (path.Contains("[$")) { //this is experimental and undocumented... - path = path.Replace("[$UMBRACO]", Current.IOHelper.Umbraco); + path = path.Replace("[$UMBRACO]", Current.Configs.Global().UmbracoPath); path = path.Replace("[$CONFIG]", Constants.SystemDirectories.Config); path = path.Replace("[$DATA]", Constants.SystemDirectories.Data); } diff --git a/src/Umbraco.Core/Packaging/PackagesRepository.cs b/src/Umbraco.Core/Packaging/PackagesRepository.cs index e4ff8dbf4b..cdfb532a39 100644 --- a/src/Umbraco.Core/Packaging/PackagesRepository.cs +++ b/src/Umbraco.Core/Packaging/PackagesRepository.cs @@ -72,7 +72,7 @@ namespace Umbraco.Core.Packaging _tempFolderPath = tempFolderPath ?? Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "PackageFiles"; _packagesFolderPath = packagesFolderPath ?? Constants.SystemDirectories.Packages; - _mediaFolderPath = mediaFolderPath ?? Current.IOHelper.Media + "/created-packages"; + _mediaFolderPath = mediaFolderPath ?? Current.Configs.Global().UmbracoMediaPath + "/created-packages"; _parser = new PackageDefinitionXmlParser(logger); } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ScriptRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ScriptRepository.cs index 6ae1dea5c6..22c3ff3067 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ScriptRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ScriptRepository.cs @@ -104,7 +104,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement } // validate path & extension - var validDir = _ioHelper.Scripts; + var validDir = Current.Configs.Global().UmbracoScriptsPath; var isValidPath = _ioHelper.VerifyEditPath(fullPath, validDir); var validExts = new[] {"js"}; var isValidExtension = _ioHelper.VerifyFileExtension(script.Path, validExts); diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/StylesheetRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/StylesheetRepository.cs index b722434ad1..dc60c332cd 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/StylesheetRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/StylesheetRepository.cs @@ -121,7 +121,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement } // validate path and extension - var validDir = _ioHelper.Css; + var validDir = Current.Configs.Global().UmbracoCssPath; var isValidPath = _ioHelper.VerifyEditPath(fullPath, validDir); var isValidExtension = _ioHelper.VerifyFileExtension(stylesheet.Path, ValidExtensions); return isValidPath && isValidExtension; diff --git a/src/Umbraco.Core/Runtime/CoreInitialComponent.cs b/src/Umbraco.Core/Runtime/CoreInitialComponent.cs index 132deb8c8c..ac390a4e1e 100644 --- a/src/Umbraco.Core/Runtime/CoreInitialComponent.cs +++ b/src/Umbraco.Core/Runtime/CoreInitialComponent.cs @@ -10,7 +10,7 @@ namespace Umbraco.Core.Runtime // ensure we have some essential directories // every other component can then initialize safely Current.IOHelper.EnsurePathExists(Constants.SystemDirectories.Data); - Current.IOHelper.EnsurePathExists(Current.IOHelper.Media); + Current.IOHelper.EnsurePathExists(Current.Configs.Global().UmbracoMediaPath); Current.IOHelper.EnsurePathExists(Constants.SystemDirectories.MvcViews); Current.IOHelper.EnsurePathExists(Constants.SystemDirectories.PartialViews); Current.IOHelper.EnsurePathExists(Constants.SystemDirectories.MacroPartials); diff --git a/src/Umbraco.Core/Services/Implement/FileService.cs b/src/Umbraco.Core/Services/Implement/FileService.cs index 8c038d72d9..1d2694b18a 100644 --- a/src/Umbraco.Core/Services/Implement/FileService.cs +++ b/src/Umbraco.Core/Services/Implement/FileService.cs @@ -664,7 +664,7 @@ namespace Umbraco.Core.Services.Implement public IEnumerable GetPartialViewSnippetNames(params string[] filterNames) { - var snippetPath = Current.IOHelper.MapPath($"{Current.IOHelper.Umbraco}/PartialViewMacros/Templates/"); + var snippetPath = Current.IOHelper.MapPath($"{Current.Configs.Global().UmbracoPath}/PartialViewMacros/Templates/"); var files = Directory.GetFiles(snippetPath, "*.cshtml") .Select(Path.GetFileNameWithoutExtension) .Except(filterNames, StringComparer.InvariantCultureIgnoreCase) @@ -898,7 +898,7 @@ namespace Umbraco.Core.Services.Implement fileName += ".cshtml"; } - var snippetPath = Current.IOHelper.MapPath($"{Current.IOHelper.Umbraco}/PartialViewMacros/Templates/{fileName}"); + var snippetPath = Current.IOHelper.MapPath($"{Current.Configs.Global().UmbracoPath}/PartialViewMacros/Templates/{fileName}"); return System.IO.File.Exists(snippetPath) ? Attempt.Succeed(snippetPath) : Attempt.Fail(); diff --git a/src/Umbraco.Core/Services/Implement/NotificationService.cs b/src/Umbraco.Core/Services/Implement/NotificationService.cs index 874e92ef86..a57b3a6d29 100644 --- a/src/Umbraco.Core/Services/Implement/NotificationService.cs +++ b/src/Umbraco.Core/Services/Implement/NotificationService.cs @@ -384,7 +384,7 @@ namespace Umbraco.Core.Services.Implement var protocol = _globalSettings.UseHttps ? "https" : "http"; var subjectVars = new NotificationEmailSubjectParams( - string.Concat(siteUri.Authority, Current.IOHelper.ResolveUrl(Current.IOHelper.Umbraco)), + string.Concat(siteUri.Authority, Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoPath)), actionName, content.Name); @@ -400,7 +400,7 @@ namespace Umbraco.Core.Services.Implement string.Concat(content.Id, ".aspx"), protocol), performingUser.Name, - string.Concat(siteUri.Authority, Current.IOHelper.ResolveUrl(Current.IOHelper.Umbraco)), + string.Concat(siteUri.Authority, Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoPath)), summary.ToString()); // create the mail message diff --git a/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs b/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs index 1668476d96..1b451e80d5 100644 --- a/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs +++ b/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs @@ -98,7 +98,7 @@ namespace Umbraco.Core.Sync : ""; var ssl = globalSettings.UseHttps ? "s" : ""; // force, whatever the first request - var url = "http" + ssl + "://" + request.ServerVariables["SERVER_NAME"] + port + Current.IOHelper.ResolveUrl(Current.IOHelper.Umbraco); + var url = "http" + ssl + "://" + request.ServerVariables["SERVER_NAME"] + port + Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoPath); return url.TrimEnd('/'); } diff --git a/src/Umbraco.Tests/Components/ComponentTests.cs b/src/Umbraco.Tests/Components/ComponentTests.cs index 05eb350bb5..9904be67cb 100644 --- a/src/Umbraco.Tests/Components/ComponentTests.cs +++ b/src/Umbraco.Tests/Components/ComponentTests.cs @@ -37,7 +37,7 @@ namespace Umbraco.Tests.Components var logger = Mock.Of(); var typeFinder = new TypeFinder(logger); var f = new UmbracoDatabaseFactory(logger, new Lazy(() => new MapperCollection(Enumerable.Empty()))); - var fs = new FileSystems(mock.Object, logger, IOHelper.Default); + var fs = new FileSystems(mock.Object, logger, IOHelper.Default, SettingsForTests.GenerateMockGlobalSettings()); var p = new ScopeProvider(f, fs, logger, typeFinder); mock.Setup(x => x.GetInstance(typeof (ILogger))).Returns(logger); diff --git a/src/Umbraco.Tests/IO/IoHelperTests.cs b/src/Umbraco.Tests/IO/IoHelperTests.cs index 3b3af2d4ce..6c45f416b9 100644 --- a/src/Umbraco.Tests/IO/IoHelperTests.cs +++ b/src/Umbraco.Tests/IO/IoHelperTests.cs @@ -3,6 +3,8 @@ using NUnit.Framework; using Umbraco.Core.IO; using Umbraco.Core; using Umbraco.Core.Composing; +using Umbraco.Core.Configuration; +using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.IO { @@ -34,18 +36,19 @@ namespace Umbraco.Tests.IO public void IOHelper_MapPathTestVDirTraversal() { //System.Diagnostics.Debugger.Break(); + var globalSettings = SettingsForTests.GenerateMockGlobalSettings(); Assert.AreEqual(Current.IOHelper.MapPath(Constants.SystemDirectories.Bin, true), Current.IOHelper.MapPath(Constants.SystemDirectories.Bin, false)); Assert.AreEqual(Current.IOHelper.MapPath(Constants.SystemDirectories.Config, true), Current.IOHelper.MapPath(Constants.SystemDirectories.Config, false)); - Assert.AreEqual(Current.IOHelper.MapPath(_ioHelper.Css, true), Current.IOHelper.MapPath(_ioHelper.Css, false)); + Assert.AreEqual(Current.IOHelper.MapPath(globalSettings.UmbracoCssPath, true), Current.IOHelper.MapPath(globalSettings.UmbracoCssPath, false)); Assert.AreEqual(Current.IOHelper.MapPath(Constants.SystemDirectories.Data, true), Current.IOHelper.MapPath(Constants.SystemDirectories.Data, false)); Assert.AreEqual(Current.IOHelper.MapPath(Constants.SystemDirectories.Install, true), Current.IOHelper.MapPath(Constants.SystemDirectories.Install, false)); - Assert.AreEqual(Current.IOHelper.MapPath(_ioHelper.Media, true), Current.IOHelper.MapPath(_ioHelper.Media, false)); + Assert.AreEqual(Current.IOHelper.MapPath(globalSettings.UmbracoMediaPath, true), Current.IOHelper.MapPath(globalSettings.UmbracoMediaPath, false)); Assert.AreEqual(Current.IOHelper.MapPath(Constants.SystemDirectories.Packages, true), Current.IOHelper.MapPath(Constants.SystemDirectories.Packages, false)); Assert.AreEqual(Current.IOHelper.MapPath(Constants.SystemDirectories.Preview, true), Current.IOHelper.MapPath(Constants.SystemDirectories.Preview, false)); Assert.AreEqual(Current.IOHelper.MapPath(_ioHelper.Root, true), Current.IOHelper.MapPath(_ioHelper.Root, false)); - Assert.AreEqual(Current.IOHelper.MapPath(_ioHelper.Scripts, true), Current.IOHelper.MapPath(_ioHelper.Scripts, false)); - Assert.AreEqual(Current.IOHelper.MapPath(_ioHelper.Umbraco, true), Current.IOHelper.MapPath(_ioHelper.Umbraco, false)); + Assert.AreEqual(Current.IOHelper.MapPath(globalSettings.UmbracoScriptsPath, true), Current.IOHelper.MapPath(globalSettings.UmbracoScriptsPath, false)); + Assert.AreEqual(Current.IOHelper.MapPath(globalSettings.UmbracoPath, true), Current.IOHelper.MapPath(globalSettings.UmbracoPath, false)); } [Test] diff --git a/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs b/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs index af7cfca41f..163619ec05 100644 --- a/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs +++ b/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs @@ -397,7 +397,7 @@ namespace Umbraco.Tests.IO var phy = new PhysicalFileSystem(path, "ignore"); var container = Mock.Of(); - var fileSystems = new FileSystems(container, logger, IOHelper.Default) { IsScoped = () => scopedFileSystems }; + var fileSystems = new FileSystems(container, logger, IOHelper.Default, SettingsForTests.GenerateMockGlobalSettings()) { IsScoped = () => scopedFileSystems }; var fs = fileSystems.GetFileSystem(phy); var sw = (ShadowWrapper) fs.InnerFileSystem; @@ -491,7 +491,7 @@ namespace Umbraco.Tests.IO var phy = new PhysicalFileSystem(path, "ignore"); var container = Mock.Of(); - var fileSystems = new FileSystems(container, logger, IOHelper.Default) { IsScoped = () => scopedFileSystems }; + var fileSystems = new FileSystems(container, logger, IOHelper.Default, SettingsForTests.GenerateMockGlobalSettings()) { IsScoped = () => scopedFileSystems }; var fs = fileSystems.GetFileSystem( phy); var sw = (ShadowWrapper) fs.InnerFileSystem; @@ -544,7 +544,7 @@ namespace Umbraco.Tests.IO var phy = new PhysicalFileSystem(path, "ignore"); var container = Mock.Of(); - var fileSystems = new FileSystems(container, logger, IOHelper.Default) { IsScoped = () => scopedFileSystems }; + var fileSystems = new FileSystems(container, logger, IOHelper.Default, SettingsForTests.GenerateMockGlobalSettings()) { IsScoped = () => scopedFileSystems }; var fs = fileSystems.GetFileSystem( phy); var sw = (ShadowWrapper)fs.InnerFileSystem; diff --git a/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs index 41a3e9cb03..1c82287842 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs @@ -3,7 +3,9 @@ using System.Linq; using System.Text; using Moq; using NUnit.Framework; +using Umbraco.Core; using Umbraco.Core.Composing; +using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Core.IO; using Umbraco.Core.Models; @@ -27,7 +29,7 @@ namespace Umbraco.Tests.Persistence.Repositories base.SetUp(); _fileSystems = Mock.Of(); - _fileSystem = new PhysicalFileSystem(Current.IOHelper.Scripts); + _fileSystem = new PhysicalFileSystem(new GlobalSettings().UmbracoScriptsPath); Mock.Get(_fileSystems).Setup(x => x.ScriptsFileSystem).Returns(_fileSystem); using (var stream = CreateStream("Umbraco.Sys.registerNamespace(\"Umbraco.Utils\");")) { diff --git a/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs index 97b411806d..ef28b42f05 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs @@ -4,7 +4,9 @@ using System.Linq; using System.Text; using Moq; using NUnit.Framework; +using Umbraco.Core; using Umbraco.Core.Composing; +using Umbraco.Core.Configuration; using Umbraco.Core.IO; using Umbraco.Core.Models; using Umbraco.Core.Persistence.Repositories; @@ -26,7 +28,7 @@ namespace Umbraco.Tests.Persistence.Repositories base.SetUp(); _fileSystems = Mock.Of(); - _fileSystem = new PhysicalFileSystem(Current.IOHelper.Css); + _fileSystem = new PhysicalFileSystem(new GlobalSettings().UmbracoCssPath); Mock.Get(_fileSystems).Setup(x => x.StylesheetsFileSystem).Returns(_fileSystem); var stream = CreateStream("body {background:#EE7600; color:#FFF;}"); _fileSystem.AddFile("styles.css", stream); diff --git a/src/Umbraco.Tests/Scoping/ScopeEventDispatcherTests.cs b/src/Umbraco.Tests/Scoping/ScopeEventDispatcherTests.cs index ce9b334549..d8af1af09d 100644 --- a/src/Umbraco.Tests/Scoping/ScopeEventDispatcherTests.cs +++ b/src/Umbraco.Tests/Scoping/ScopeEventDispatcherTests.cs @@ -36,7 +36,7 @@ namespace Umbraco.Tests.Scoping _testObjects = new TestObjects(register); - composition.RegisterUnique(factory => new FileSystems(factory, factory.TryGetInstance(), IOHelper.Default)); + composition.RegisterUnique(factory => new FileSystems(factory, factory.TryGetInstance(), IOHelper.Default, SettingsForTests.GenerateMockGlobalSettings())); composition.WithCollectionBuilder(); composition.Configs.Add(SettingsForTests.GetDefaultGlobalSettings); diff --git a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs index 98ae816317..d04ad98f6d 100644 --- a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs +++ b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs @@ -24,7 +24,15 @@ namespace Umbraco.Tests.TestHelpers settings.LocalTempStorageLocation == LocalTempStorage.Default && settings.LocalTempPath == Current.IOHelper.MapPath("~/App_Data/TEMP") && settings.ReservedPaths == (GlobalSettings.StaticReservedPaths + "~/umbraco") && - settings.ReservedUrls == GlobalSettings.StaticReservedUrls); + settings.ReservedUrls == GlobalSettings.StaticReservedUrls && + settings.UmbracoPath == "~/umbraco" && + settings.UmbracoMediaPath == "~/media" && + settings.UmbracoCssPath == "~/css" && + settings.UmbracoScriptsPath == "~/scripts" + ); + + + return config; } diff --git a/src/Umbraco.Tests/TestHelpers/TestHelper.cs b/src/Umbraco.Tests/TestHelpers/TestHelper.cs index 6551ebf87a..6ee0bd70c9 100644 --- a/src/Umbraco.Tests/TestHelpers/TestHelper.cs +++ b/src/Umbraco.Tests/TestHelpers/TestHelper.cs @@ -74,12 +74,12 @@ namespace Umbraco.Tests.TestHelpers public static void InitializeContentDirectories() { - CreateDirectories(new[] { Constants.SystemDirectories.MvcViews, Current.IOHelper.Media, Constants.SystemDirectories.AppPlugins }); + CreateDirectories(new[] { Constants.SystemDirectories.MvcViews, new GlobalSettings().UmbracoMediaPath, Constants.SystemDirectories.AppPlugins }); } public static void CleanContentDirectories() { - CleanDirectories(new[] { Constants.SystemDirectories.MvcViews, Current.IOHelper.Media }); + CleanDirectories(new[] { Constants.SystemDirectories.MvcViews, new GlobalSettings().UmbracoMediaPath }); } public static void CreateDirectories(string[] directories) diff --git a/src/Umbraco.Tests/TestHelpers/TestObjects.cs b/src/Umbraco.Tests/TestHelpers/TestObjects.cs index d030d7e22c..6d90d2e7d0 100644 --- a/src/Umbraco.Tests/TestHelpers/TestObjects.cs +++ b/src/Umbraco.Tests/TestHelpers/TestObjects.cs @@ -118,7 +118,7 @@ namespace Umbraco.Tests.TestHelpers var localizedTextService = GetLazyService(factory, c => new LocalizedTextService( new Lazy(() => { - var mainLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(Current.IOHelper.Umbraco + "/config/lang/")); + var mainLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(Current.Configs.Global().UmbracoPath + "/config/lang/")); var appPlugins = new DirectoryInfo(Current.IOHelper.MapPath(Constants.SystemDirectories.AppPlugins)); var configLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(Constants.SystemDirectories.Config + "/lang/")); @@ -242,7 +242,7 @@ namespace Umbraco.Tests.TestHelpers } typeFinder = typeFinder ?? new TypeFinder(logger); - fileSystems = fileSystems ?? new FileSystems(Current.Factory, logger, IOHelper.Default); + fileSystems = fileSystems ?? new FileSystems(Current.Factory, logger, IOHelper.Default, SettingsForTests.GenerateMockGlobalSettings()); var scopeProvider = new ScopeProvider(databaseFactory, fileSystems, logger, typeFinder); return scopeProvider; } diff --git a/src/Umbraco.Web.UI/Umbraco/Views/AuthorizeUpgrade.cshtml b/src/Umbraco.Web.UI/Umbraco/Views/AuthorizeUpgrade.cshtml index 8f0a31850e..2eca580097 100644 --- a/src/Umbraco.Web.UI/Umbraco/Views/AuthorizeUpgrade.cshtml +++ b/src/Umbraco.Web.UI/Umbraco/Views/AuthorizeUpgrade.cshtml @@ -33,7 +33,7 @@ Umbraco @Html.RenderCssHere( - new BasicPath("Umbraco", Current.IOHelper.ResolveUrl(Current.IOHelper.Umbraco))) + new BasicPath("Umbraco", Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoPath))) @*Because we're lazy loading angular js, the embedded cloak style will not be loaded initially, but we need it*@