From 0fcf8325e31634a9e8063da0335a392cde60e4d1 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Tue, 12 Nov 2019 15:25:21 +0100 Subject: [PATCH] Changed SystemDirectories from static to instance, Added interface in abstractions and create a static property on current. --- .../IO/ISystemDirectories.cs | 33 ++++++++++++++ .../CompositionExtensions/FileSystems.cs | 2 +- .../CompositionExtensions/Services.cs | 7 +-- src/Umbraco.Core/Composing/Current.cs | 3 +- src/Umbraco.Core/ConfigsExtensions.cs | 2 +- .../Configuration/GlobalSettings.cs | 4 +- .../Configuration/GlobalSettingsExtensions.cs | 5 ++- src/Umbraco.Core/IO/FileSystems.cs | 12 ++--- src/Umbraco.Core/IO/IOHelper.cs | 26 ++++++----- src/Umbraco.Core/IO/ShadowWrapper.cs | 2 +- src/Umbraco.Core/IO/SystemDirectories.cs | 44 +++++++++---------- src/Umbraco.Core/IO/SystemFiles.cs | 3 +- .../Migrations/Install/DatabaseBuilder.cs | 4 +- .../Packaging/CompiledPackageXmlParser.cs | 9 ++-- .../Packaging/PackageDataInstallation.cs | 3 +- .../Packaging/PackagesRepository.cs | 6 +-- .../Implement/PartialViewRepository.cs | 2 +- .../Implement/ScriptRepository.cs | 4 +- .../Implement/StylesheetRepository.cs | 2 +- .../Implement/TemplateRepository.cs | 2 +- .../Runtime/CoreInitialComponent.cs | 8 ++-- .../Services/Implement/FileService.cs | 4 +- .../Services/Implement/NotificationService.cs | 4 +- .../Services/Implement/PackagingService.cs | 2 +- src/Umbraco.Core/Sync/ApplicationUrlHelper.cs | 2 +- src/Umbraco.Examine/LuceneIndexCreator.cs | 2 +- src/Umbraco.Examine/LuceneIndexDiagnostics.cs | 2 +- .../Configurations/GlobalSettingsTests.cs | 6 +-- .../CoreThings/UriExtensionsTests.cs | 11 ++--- src/Umbraco.Tests/IO/IoHelperTests.cs | 2 + src/Umbraco.Tests/IO/ShadowFileSystemTests.cs | 8 ++-- .../LegacyXmlPublishedCache/PreviewContent.cs | 4 +- .../PartialViewRepositoryTests.cs | 3 +- .../Repositories/ScriptRepositoryTest.cs | 5 ++- .../Repositories/StylesheetRepositoryTest.cs | 5 ++- .../Repositories/TemplateRepositoryTest.cs | 9 ++-- .../Scoping/ScopeFileSystemsTests.cs | 2 +- src/Umbraco.Tests/TestHelpers/TestHelper.cs | 6 +-- src/Umbraco.Tests/TestHelpers/TestObjects.cs | 6 +-- src/Umbraco.Web/Composing/Current.cs | 1 + .../Editors/BackOfficeAssetsController.cs | 2 +- .../Editors/BackOfficeServerVariables.cs | 6 +-- .../Binders/ContentModelBinderHelper.cs | 3 +- src/Umbraco.Web/Editors/CodeFileController.cs | 28 ++++++------ .../Editors/ContentTypeController.cs | 4 +- src/Umbraco.Web/Editors/MacrosController.cs | 8 ++-- src/Umbraco.Web/Editors/MediaController.cs | 2 +- .../Editors/PackageInstallController.cs | 10 ++--- src/Umbraco.Web/Editors/TinyMceController.cs | 4 +- src/Umbraco.Web/Editors/TourController.cs | 4 +- src/Umbraco.Web/Editors/UsersController.cs | 2 +- .../FolderAndFilePermissionsCheck.cs | 24 +++++----- src/Umbraco.Web/HtmlHelperRenderExtensions.cs | 2 +- .../Install/Controllers/InstallController.cs | 6 +-- .../Install/FilePermissionHelper.cs | 6 +-- .../Install/InstallAuthorizeAttribute.cs | 2 +- .../Install/InstallStatusTracker.cs | 10 ++--- .../InstallSteps/ConfigureMachineKey.cs | 2 +- .../InstallSteps/StarterKitCleanupStep.cs | 2 +- .../ClientDependencyConfiguration.cs | 2 +- .../JavaScript/JsInitialization.cs | 2 +- .../UmbracoClientDependencyLoader.cs | 2 +- src/Umbraco.Web/Mvc/PluginViewEngine.cs | 26 +++++------ .../Mvc/UmbracoViewPageOfTModel.cs | 2 +- .../Runtime/WebInitialComponent.cs | 2 +- .../Scheduling/SchedulerComponent.cs | 2 +- src/Umbraco.Web/Security/WebSecurity.cs | 2 +- src/Umbraco.Web/UmbracoInjectedModule.cs | 6 +-- 68 files changed, 249 insertions(+), 191 deletions(-) create mode 100644 src/Umbraco.Abstractions/IO/ISystemDirectories.cs diff --git a/src/Umbraco.Abstractions/IO/ISystemDirectories.cs b/src/Umbraco.Abstractions/IO/ISystemDirectories.cs new file mode 100644 index 0000000000..4c1499760e --- /dev/null +++ b/src/Umbraco.Abstractions/IO/ISystemDirectories.cs @@ -0,0 +1,33 @@ +namespace Umbraco.Core.IO +{ + public interface ISystemDirectories + { + string Bin { get; } + string Config { get; } + string Data { get; } + string TempData { get; } + string TempFileUploads { get; } + string TempImageUploads { get; } + string Install { get; } + string AppCode { get; } + string AppPlugins { get; } + string MvcViews { get; } + string PartialViews { get; } + string MacroPartials { get; } + string Media { get; } + string Scripts { get; } + string Css { get; } + string Umbraco { get; } + string Packages { get; } + string Preview { get; } + + /// + /// Gets the root path of the application + /// + string Root + { + get; + set; //Only required for unit tests + } + } +} diff --git a/src/Umbraco.Core/Composing/CompositionExtensions/FileSystems.cs b/src/Umbraco.Core/Composing/CompositionExtensions/FileSystems.cs index 8518d907b5..27a8a03323 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(SystemDirectories.Media)); + composition.SetMediaFileSystem(() => new PhysicalFileSystem(Current.SystemDirectories.Media)); return composition; } diff --git a/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs b/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs index 9d7d0a191d..bec5640860 100644 --- a/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs +++ b/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs @@ -89,9 +89,10 @@ namespace Umbraco.Core.Composing.CompositionExtensions private static LocalizedTextServiceFileSources SourcesFactory(IFactory container) { - var mainLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Umbraco + "/config/lang/")); - var appPlugins = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.AppPlugins)); - var configLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Config + "/lang/")); + ISystemDirectories systemDirectories = new SystemDirectories(); + var mainLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(systemDirectories.Umbraco + "/config/lang/")); + var appPlugins = new DirectoryInfo(Current.IOHelper.MapPath(systemDirectories.AppPlugins)); + var configLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(systemDirectories.Config + "/lang/")); var pluginLangFolders = appPlugins.Exists == false ? Enumerable.Empty() diff --git a/src/Umbraco.Core/Composing/Current.cs b/src/Umbraco.Core/Composing/Current.cs index 3f9c4db288..4604590a8f 100644 --- a/src/Umbraco.Core/Composing/Current.cs +++ b/src/Umbraco.Core/Composing/Current.cs @@ -205,7 +205,8 @@ namespace Umbraco.Core.Composing public static IVariationContextAccessor VariationContextAccessor => Factory.GetInstance(); - public static readonly IIOHelper IOHelper = new IOHelper(); + public static readonly IIOHelper IOHelper = Umbraco.Core.IO.IOHelper.Default; + public static readonly ISystemDirectories SystemDirectories = new SystemDirectories(); #endregion } diff --git a/src/Umbraco.Core/ConfigsExtensions.cs b/src/Umbraco.Core/ConfigsExtensions.cs index 10293d1171..a3e60457a2 100644 --- a/src/Umbraco.Core/ConfigsExtensions.cs +++ b/src/Umbraco.Core/ConfigsExtensions.cs @@ -33,7 +33,7 @@ namespace Umbraco.Core public static void AddCoreConfigs(this Configs configs) { - var configDir = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Config)); + var configDir = new DirectoryInfo(Current.IOHelper.MapPath(Current.SystemDirectories.Config)); configs.Add(() => new GlobalSettings()); configs.Add("umbracoConfiguration/settings"); diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index f2438065a4..0e024346af 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -171,7 +171,7 @@ namespace Umbraco.Core.Configuration /// Value of the setting to be saved. internal static void SaveSetting(string key, string value) { - var fileName = Current.IOHelper.MapPath(string.Format("{0}/web.config", SystemDirectories.Root)); + var fileName = Current.IOHelper.MapPath(string.Format("{0}/web.config", Current.SystemDirectories.Root)); var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace); var appSettings = xml.Root.DescendantsAndSelf("appSettings").Single(); @@ -193,7 +193,7 @@ namespace Umbraco.Core.Configuration /// Key of the setting to be removed. internal static void RemoveSetting(string key) { - var fileName = Current.IOHelper.MapPath(string.Format("{0}/web.config", SystemDirectories.Root)); + var fileName = Current.IOHelper.MapPath(string.Format("{0}/web.config", Current.SystemDirectories.Root)); var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace); var appSettings = xml.Root.DescendantsAndSelf("appSettings").Single(); diff --git a/src/Umbraco.Core/Configuration/GlobalSettingsExtensions.cs b/src/Umbraco.Core/Configuration/GlobalSettingsExtensions.cs index bc76caacee..2bc1e8d8c2 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettingsExtensions.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettingsExtensions.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Threading; using System.Web; using System.Web.Routing; +using Umbraco.Core.Composing; using Umbraco.Core.IO; namespace Umbraco.Core.Configuration @@ -42,8 +43,8 @@ namespace Umbraco.Core.Configuration } var path = globalSettings.Path; - if (path.StartsWith(SystemDirectories.Root)) // beware of TrimStart, see U4-2518 - path = path.Substring(SystemDirectories.Root.Length); + if (path.StartsWith(Current.SystemDirectories.Root)) // beware of TrimStart, see U4-2518 + path = path.Substring(Current.SystemDirectories.Root.Length); return path.TrimStart('~').TrimStart('/').Replace('/', '-').Trim().ToLower(); } diff --git a/src/Umbraco.Core/IO/FileSystems.cs b/src/Umbraco.Core/IO/FileSystems.cs index 8906752dd1..88ed3b48ae 100644 --- a/src/Umbraco.Core/IO/FileSystems.cs +++ b/src/Umbraco.Core/IO/FileSystems.cs @@ -11,6 +11,7 @@ namespace Umbraco.Core.IO { private readonly IFactory _container; private readonly ILogger _logger; + private readonly ISystemDirectories _systemDirectories; private readonly ConcurrentDictionary> _filesystems = new ConcurrentDictionary>(); @@ -37,6 +38,7 @@ namespace Umbraco.Core.IO { _container = container; _logger = logger; + _systemDirectories = Current.SystemDirectories; } // for tests only, totally unsafe @@ -120,11 +122,11 @@ namespace Umbraco.Core.IO // but it does not really matter what we return - here, null private object CreateWellKnownFileSystems() { - var macroPartialFileSystem = new PhysicalFileSystem(SystemDirectories.MacroPartials); - var partialViewsFileSystem = new PhysicalFileSystem(SystemDirectories.PartialViews); - var stylesheetsFileSystem = new PhysicalFileSystem(SystemDirectories.Css); - var scriptsFileSystem = new PhysicalFileSystem(SystemDirectories.Scripts); - var mvcViewsFileSystem = new PhysicalFileSystem(SystemDirectories.MvcViews); + var macroPartialFileSystem = new PhysicalFileSystem(_systemDirectories.MacroPartials); + var partialViewsFileSystem = new PhysicalFileSystem(_systemDirectories.PartialViews); + var stylesheetsFileSystem = new PhysicalFileSystem(_systemDirectories.Css); + var scriptsFileSystem = new PhysicalFileSystem(_systemDirectories.Scripts); + var mvcViewsFileSystem = new PhysicalFileSystem(_systemDirectories.MvcViews); _macroPartialFileSystem = new ShadowWrapper(macroPartialFileSystem, "macro-partials", IsScoped); _partialViewsFileSystem = new ShadowWrapper(partialViewsFileSystem, "partials", IsScoped); diff --git a/src/Umbraco.Core/IO/IOHelper.cs b/src/Umbraco.Core/IO/IOHelper.cs index 36215b267c..3925e6d8d5 100644 --- a/src/Umbraco.Core/IO/IOHelper.cs +++ b/src/Umbraco.Core/IO/IOHelper.cs @@ -13,7 +13,13 @@ namespace Umbraco.Core.IO { public class IOHelper : IIOHelper { - internal static IIOHelper Default { get; } = new IOHelper(); + private readonly ISystemDirectories _systemDirectories; + internal static IIOHelper Default { get; } = new IOHelper(new SystemDirectories()); + + public IOHelper(ISystemDirectories systemDirectories) + { + _systemDirectories = systemDirectories; + } /// /// Gets or sets a value forcing Umbraco to consider it is non-hosted. @@ -39,10 +45,10 @@ namespace Umbraco.Core.IO string retval = virtualPath; if (virtualPath.StartsWith("~")) - retval = virtualPath.Replace("~", SystemDirectories.Root); + retval = virtualPath.Replace("~", _systemDirectories.Root); - if (virtualPath.StartsWith("/") && virtualPath.StartsWith(SystemDirectories.Root) == false) - retval = SystemDirectories.Root + "/" + virtualPath.TrimStart('/'); + if (virtualPath.StartsWith("/") && virtualPath.StartsWith(_systemDirectories.Root) == false) + retval = _systemDirectories.Root + "/" + virtualPath.TrimStart('/'); return retval; } @@ -57,11 +63,11 @@ namespace Umbraco.Core.IO public string ResolveUrl(string virtualPath) { if (virtualPath.StartsWith("~")) - return virtualPath.Replace("~", SystemDirectories.Root).Replace("//", "/"); + return virtualPath.Replace("~", _systemDirectories.Root).Replace("//", "/"); else if (Uri.IsWellFormedUriString(virtualPath, UriKind.Absolute)) return virtualPath; else - return VirtualPathUtility.ToAbsolute(virtualPath, SystemDirectories.Root); + return VirtualPathUtility.ToAbsolute(virtualPath, _systemDirectories.Root); } public Attempt TryResolveUrl(string virtualPath) @@ -69,10 +75,10 @@ namespace Umbraco.Core.IO try { if (virtualPath.StartsWith("~")) - return Attempt.Succeed(virtualPath.Replace("~", SystemDirectories.Root).Replace("//", "/")); + return Attempt.Succeed(virtualPath.Replace("~", _systemDirectories.Root).Replace("//", "/")); if (Uri.IsWellFormedUriString(virtualPath, UriKind.Absolute)) return Attempt.Succeed(virtualPath); - return Attempt.Succeed(VirtualPathUtility.ToAbsolute(virtualPath, SystemDirectories.Root)); + return Attempt.Succeed(VirtualPathUtility.ToAbsolute(virtualPath, _systemDirectories.Root)); } catch (Exception ex) { @@ -97,7 +103,7 @@ namespace Umbraco.Core.IO if (useHttpContext && HttpContext.Current != null) { //string retval; - if (String.IsNullOrEmpty(path) == false && (path.StartsWith("~") || path.StartsWith(SystemDirectories.Root))) + if (String.IsNullOrEmpty(path) == false && (path.StartsWith("~") || path.StartsWith(_systemDirectories.Root))) return HostingEnvironment.MapPath(path); else return HostingEnvironment.MapPath("~/" + path.TrimStart('/')); @@ -160,7 +166,7 @@ namespace Umbraco.Core.IO // TODO: what's below is dirty, there are too many ways to get the root dir, etc. // not going to fix everything today - var mappedRoot = MapPath(SystemDirectories.Root); + var mappedRoot = MapPath(_systemDirectories.Root); if (filePath.StartsWith(mappedRoot) == false) filePath = MapPath(filePath); diff --git a/src/Umbraco.Core/IO/ShadowWrapper.cs b/src/Umbraco.Core/IO/ShadowWrapper.cs index 44152d7c1a..aab65e0a25 100644 --- a/src/Umbraco.Core/IO/ShadowWrapper.cs +++ b/src/Umbraco.Core/IO/ShadowWrapper.cs @@ -8,7 +8,7 @@ namespace Umbraco.Core.IO { internal class ShadowWrapper : IFileSystem { - private static readonly string ShadowFsPath = SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"; + private static readonly string ShadowFsPath = Current.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"; private readonly Func _isScoped; private readonly IFileSystem _innerFileSystem; diff --git a/src/Umbraco.Core/IO/SystemDirectories.cs b/src/Umbraco.Core/IO/SystemDirectories.cs index c5c410ff3f..4a976f5675 100644 --- a/src/Umbraco.Core/IO/SystemDirectories.cs +++ b/src/Umbraco.Core/IO/SystemDirectories.cs @@ -4,50 +4,50 @@ using Umbraco.Core.Composing; namespace Umbraco.Core.IO { //all paths has a starting but no trailing / - public class SystemDirectories + public class SystemDirectories : ISystemDirectories { - public static string Bin => "~/bin"; + public string Bin => "~/bin"; - public static string Config => "~/config"; + public string Config => "~/config"; - public static string Data => "~/App_Data"; + public string Data => "~/App_Data"; - public static string TempData => Data + "/TEMP"; + public string TempData => Data + "/TEMP"; - public static string TempFileUploads => TempData + "/FileUploads"; + public string TempFileUploads => TempData + "/FileUploads"; - public static string TempImageUploads => TempFileUploads + "/rte"; + public string TempImageUploads => TempFileUploads + "/rte"; - public static string Install => "~/install"; + public string Install => "~/install"; - public static string AppCode => "~/App_Code"; + public string AppCode => "~/App_Code"; - public static string AppPlugins => "~/App_Plugins"; + public string AppPlugins => "~/App_Plugins"; - public static string MvcViews => "~/Views"; + public string MvcViews => "~/Views"; - public static string PartialViews => MvcViews + "/Partials/"; + public string PartialViews => MvcViews + "/Partials/"; - public static string MacroPartials => MvcViews + "/MacroPartials/"; + public string MacroPartials => MvcViews + "/MacroPartials/"; - public static string Media => Current.IOHelper.ReturnPath("umbracoMediaPath", "~/media"); + public string Media => Current.IOHelper.ReturnPath("umbracoMediaPath", "~/media"); - public static string Scripts => Current.IOHelper.ReturnPath("umbracoScriptsPath", "~/scripts"); + public string Scripts => Current.IOHelper.ReturnPath("umbracoScriptsPath", "~/scripts"); - public static string Css => Current.IOHelper.ReturnPath("umbracoCssPath", "~/css"); + public string Css => Current.IOHelper.ReturnPath("umbracoCssPath", "~/css"); - public static string Umbraco => Current.IOHelper.ReturnPath("umbracoPath", "~/umbraco"); + public string Umbraco => Current.IOHelper.ReturnPath("umbracoPath", "~/umbraco"); - public static string Packages => Data + "/packages"; + public string Packages => Data + "/packages"; - public static string Preview => Data + "/preview"; + public string Preview => Data + "/preview"; - private static string _root; + private string _root; /// /// Gets the root path of the application /// - public static string Root + public string Root { get { @@ -62,7 +62,7 @@ namespace Umbraco.Core.IO return _root; } //Only required for unit tests - internal set => _root = value; + set => _root = value; } } } diff --git a/src/Umbraco.Core/IO/SystemFiles.cs b/src/Umbraco.Core/IO/SystemFiles.cs index 12e3f57d99..7df39eac6c 100644 --- a/src/Umbraco.Core/IO/SystemFiles.cs +++ b/src/Umbraco.Core/IO/SystemFiles.cs @@ -1,11 +1,12 @@ using System.IO; +using Umbraco.Core.Composing; using Umbraco.Core.Configuration; namespace Umbraco.Core.IO { public class SystemFiles { - public static string TinyMceConfig => SystemDirectories.Config + "/tinyMceConfig.config"; + public static string TinyMceConfig => Current.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) diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs index a0c87ce510..a7c6b38c1c 100644 --- a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs +++ b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs @@ -283,7 +283,7 @@ namespace Umbraco.Core.Migrations.Install if (string.IsNullOrWhiteSpace(providerName)) throw new ArgumentNullOrEmptyException(nameof(providerName)); var fileSource = "web.config"; - var fileName = Current.IOHelper.MapPath(SystemDirectories.Root +"/" + fileSource); + var fileName = Current.IOHelper.MapPath(Current.SystemDirectories.Root +"/" + fileSource); var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace); if (xml.Root == null) throw new Exception($"Invalid {fileSource} file (no root)."); @@ -296,7 +296,7 @@ namespace Umbraco.Core.Migrations.Install if (configSourceAttribute != null) { fileSource = configSourceAttribute.Value; - fileName = Current.IOHelper.MapPath(SystemDirectories.Root + "/" + fileSource); + fileName = Current.IOHelper.MapPath(Current.SystemDirectories.Root + "/" + fileSource); if (!File.Exists(fileName)) throw new Exception($"Invalid configSource \"{fileSource}\" (no such file)."); diff --git a/src/Umbraco.Core/Packaging/CompiledPackageXmlParser.cs b/src/Umbraco.Core/Packaging/CompiledPackageXmlParser.cs index 83034a7e1b..80857ab5eb 100644 --- a/src/Umbraco.Core/Packaging/CompiledPackageXmlParser.cs +++ b/src/Umbraco.Core/Packaging/CompiledPackageXmlParser.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Xml.Linq; +using Umbraco.Core.Composing; using Umbraco.Core.IO; using Umbraco.Core.Models; using Umbraco.Core.Models.Packaging; @@ -131,15 +132,15 @@ namespace Umbraco.Core.Packaging { return pathElement.TrimStart(new[] { '\\', '/', '~' }).Replace("/", "\\"); } - + private static string UpdatePathPlaceholders(string path) { if (path.Contains("[$")) { //this is experimental and undocumented... - path = path.Replace("[$UMBRACO]", SystemDirectories.Umbraco); - path = path.Replace("[$CONFIG]", SystemDirectories.Config); - path = path.Replace("[$DATA]", SystemDirectories.Data); + path = path.Replace("[$UMBRACO]", Current.SystemDirectories.Umbraco); + path = path.Replace("[$CONFIG]", Current.SystemDirectories.Config); + path = path.Replace("[$DATA]", Current.SystemDirectories.Data); } return path; } diff --git a/src/Umbraco.Core/Packaging/PackageDataInstallation.cs b/src/Umbraco.Core/Packaging/PackageDataInstallation.cs index 281cc2c396..8cd0225327 100644 --- a/src/Umbraco.Core/Packaging/PackageDataInstallation.cs +++ b/src/Umbraco.Core/Packaging/PackageDataInstallation.cs @@ -6,6 +6,7 @@ using System.Web; using System.Xml.Linq; using System.Xml.XPath; using Umbraco.Core.Collections; +using Umbraco.Core.Composing; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Models; @@ -1317,7 +1318,7 @@ namespace Umbraco.Core.Packaging private string ViewPath(string alias) { - return SystemDirectories.MvcViews + "/" + alias.Replace(" ", "") + ".cshtml"; + return Current.SystemDirectories.MvcViews + "/" + alias.Replace(" ", "") + ".cshtml"; } #endregion diff --git a/src/Umbraco.Core/Packaging/PackagesRepository.cs b/src/Umbraco.Core/Packaging/PackagesRepository.cs index 458a239cc0..24455308c8 100644 --- a/src/Umbraco.Core/Packaging/PackagesRepository.cs +++ b/src/Umbraco.Core/Packaging/PackagesRepository.cs @@ -70,9 +70,9 @@ namespace Umbraco.Core.Packaging _logger = logger; _packageRepositoryFileName = packageRepositoryFileName; - _tempFolderPath = tempFolderPath ?? SystemDirectories.TempData.EnsureEndsWith('/') + "PackageFiles"; - _packagesFolderPath = packagesFolderPath ?? SystemDirectories.Packages; - _mediaFolderPath = mediaFolderPath ?? SystemDirectories.Media + "/created-packages"; + _tempFolderPath = tempFolderPath ?? Current.SystemDirectories.TempData.EnsureEndsWith('/') + "PackageFiles"; + _packagesFolderPath = packagesFolderPath ?? Current.SystemDirectories.Packages; + _mediaFolderPath = mediaFolderPath ?? Current.SystemDirectories.Media + "/created-packages"; _parser = new PackageDefinitionXmlParser(logger); } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/PartialViewRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/PartialViewRepository.cs index d7d1be55c7..bee7260b53 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/PartialViewRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/PartialViewRepository.cs @@ -103,7 +103,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement } // validate path & extension - var validDir = SystemDirectories.MvcViews; + var validDir = Current.SystemDirectories.MvcViews; var isValidPath = Current.IOHelper.VerifyEditPath(fullPath, validDir); var isValidExtension = Current.IOHelper.VerifyFileExtension(fullPath, ValidExtensions); return isValidPath && isValidExtension; diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ScriptRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ScriptRepository.cs index 491dafe577..3acdb331a1 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ScriptRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ScriptRepository.cs @@ -15,11 +15,13 @@ namespace Umbraco.Core.Persistence.Repositories.Implement internal class ScriptRepository : FileRepository, IScriptRepository { private readonly IIOHelper _ioHelper; + private readonly ISystemDirectories _systemDirectories; public ScriptRepository(IFileSystems fileSystems, IIOHelper ioHelper) : base(fileSystems.ScriptsFileSystem) { _ioHelper = ioHelper ?? throw new ArgumentNullException(nameof(ioHelper)); + _systemDirectories = Current.SystemDirectories; } #region Implementation of IRepository @@ -104,7 +106,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement } // validate path & extension - var validDir = SystemDirectories.Scripts; + var validDir = _systemDirectories.Scripts; 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 94737b5620..de661d1f7e 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 = SystemDirectories.Css; + var validDir = Current.SystemDirectories.Css; var isValidPath = _ioHelper.VerifyEditPath(fullPath, validDir); var isValidExtension = _ioHelper.VerifyFileExtension(stylesheet.Path, ValidExtensions); return isValidPath && isValidExtension; diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs index 5fd319e4d4..b45ec5048b 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs @@ -585,7 +585,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement var path = template.VirtualPath; // get valid paths - var validDirs = new[] { SystemDirectories.MvcViews }; + var validDirs = new[] { Current.SystemDirectories.MvcViews }; // get valid extensions var validExts = new List(); diff --git a/src/Umbraco.Core/Runtime/CoreInitialComponent.cs b/src/Umbraco.Core/Runtime/CoreInitialComponent.cs index f88417948b..0cb7024e66 100644 --- a/src/Umbraco.Core/Runtime/CoreInitialComponent.cs +++ b/src/Umbraco.Core/Runtime/CoreInitialComponent.cs @@ -10,10 +10,10 @@ namespace Umbraco.Core.Runtime // ensure we have some essential directories // every other component can then initialize safely Current.IOHelper.EnsurePathExists("~/App_Data"); - Current.IOHelper.EnsurePathExists(SystemDirectories.Media); - Current.IOHelper.EnsurePathExists(SystemDirectories.MvcViews); - Current.IOHelper.EnsurePathExists(SystemDirectories.MvcViews + "/Partials"); - Current.IOHelper.EnsurePathExists(SystemDirectories.MvcViews + "/MacroPartials"); + Current.IOHelper.EnsurePathExists(Current.SystemDirectories.Media); + Current.IOHelper.EnsurePathExists(Current.SystemDirectories.MvcViews); + Current.IOHelper.EnsurePathExists(Current.SystemDirectories.MvcViews + "/Partials"); + Current.IOHelper.EnsurePathExists(Current.SystemDirectories.MvcViews + "/MacroPartials"); } public void Terminate() diff --git a/src/Umbraco.Core/Services/Implement/FileService.cs b/src/Umbraco.Core/Services/Implement/FileService.cs index cde8ed30fe..afc30e09ce 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($"{SystemDirectories.Umbraco}/PartialViewMacros/Templates/"); + var snippetPath = Current.IOHelper.MapPath($"{Current.SystemDirectories.Umbraco}/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($"{SystemDirectories.Umbraco}/PartialViewMacros/Templates/{fileName}"); + var snippetPath = Current.IOHelper.MapPath($"{Current.SystemDirectories.Umbraco}/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 65040f625a..fa7b14abe4 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(SystemDirectories.Umbraco)), + string.Concat(siteUri.Authority, Current.IOHelper.ResolveUrl(Current.SystemDirectories.Umbraco)), 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(SystemDirectories.Umbraco)), + string.Concat(siteUri.Authority, Current.IOHelper.ResolveUrl(Current.SystemDirectories.Umbraco)), summary.ToString()); // create the mail message diff --git a/src/Umbraco.Core/Services/Implement/PackagingService.cs b/src/Umbraco.Core/Services/Implement/PackagingService.cs index c0946e4468..f68685ee57 100644 --- a/src/Umbraco.Core/Services/Implement/PackagingService.cs +++ b/src/Umbraco.Core/Services/Implement/PackagingService.cs @@ -64,7 +64,7 @@ namespace Umbraco.Core.Services.Implement //successful if (bytes.Length > 0) { - var packagePath = Current.IOHelper.MapPath(SystemDirectories.Packages); + var packagePath = Current.IOHelper.MapPath(Current.SystemDirectories.Packages); // Check for package directory if (Directory.Exists(packagePath) == false) diff --git a/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs b/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs index b7afc1048b..b58aefe5dd 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(SystemDirectories.Umbraco); + var url = "http" + ssl + "://" + request.ServerVariables["SERVER_NAME"] + port + Current.IOHelper.ResolveUrl(Current.SystemDirectories.Umbraco); return url.TrimEnd('/'); } diff --git a/src/Umbraco.Examine/LuceneIndexCreator.cs b/src/Umbraco.Examine/LuceneIndexCreator.cs index 3834c1476e..f310ca9229 100644 --- a/src/Umbraco.Examine/LuceneIndexCreator.cs +++ b/src/Umbraco.Examine/LuceneIndexCreator.cs @@ -36,7 +36,7 @@ namespace Umbraco.Examine public virtual Lucene.Net.Store.Directory CreateFileSystemLuceneDirectory(string folderName) { - var dirInfo = new DirectoryInfo(Path.Combine(Current.IOHelper.MapPath(SystemDirectories.TempData), "ExamineIndexes", folderName)); + var dirInfo = new DirectoryInfo(Path.Combine(Current.IOHelper.MapPath(Current.SystemDirectories.TempData), "ExamineIndexes", folderName)); if (!dirInfo.Exists) System.IO.Directory.CreateDirectory(dirInfo.FullName); diff --git a/src/Umbraco.Examine/LuceneIndexDiagnostics.cs b/src/Umbraco.Examine/LuceneIndexDiagnostics.cs index 7a91552c81..0ed2d88085 100644 --- a/src/Umbraco.Examine/LuceneIndexDiagnostics.cs +++ b/src/Umbraco.Examine/LuceneIndexDiagnostics.cs @@ -72,7 +72,7 @@ namespace Umbraco.Examine if (luceneDir is FSDirectory fsDir) { - d[nameof(UmbracoExamineIndex.LuceneIndexFolder)] = fsDir.Directory.ToString().ToLowerInvariant().TrimStart(Current.IOHelper.MapPath(SystemDirectories.Root).ToLowerInvariant()).Replace("\\", "/").EnsureStartsWith('/'); + d[nameof(UmbracoExamineIndex.LuceneIndexFolder)] = fsDir.Directory.ToString().ToLowerInvariant().TrimStart(Current.IOHelper.MapPath(Current.SystemDirectories.Root).ToLowerInvariant()).Replace("\\", "/").EnsureStartsWith('/'); } return d; diff --git a/src/Umbraco.Tests/Configurations/GlobalSettingsTests.cs b/src/Umbraco.Tests/Configurations/GlobalSettingsTests.cs index 69a9613a38..bab6a13dad 100644 --- a/src/Umbraco.Tests/Configurations/GlobalSettingsTests.cs +++ b/src/Umbraco.Tests/Configurations/GlobalSettingsTests.cs @@ -17,13 +17,13 @@ namespace Umbraco.Tests.Configurations public override void SetUp() { base.SetUp(); - _root = SystemDirectories.Root; + _root = Current.SystemDirectories.Root; } public override void TearDown() { base.TearDown(); - SystemDirectories.Root = _root; + Current.SystemDirectories.Root = _root; } [Test] @@ -51,7 +51,7 @@ namespace Umbraco.Tests.Configurations var globalSettingsMock = Mock.Get(globalSettings); globalSettingsMock.Setup(x => x.Path).Returns(() => Current.IOHelper.ResolveUrl(path)); - SystemDirectories.Root = rootPath; + Current.SystemDirectories.Root = rootPath; Assert.AreEqual(outcome, globalSettings.GetUmbracoMvcAreaNoCache()); } diff --git a/src/Umbraco.Tests/CoreThings/UriExtensionsTests.cs b/src/Umbraco.Tests/CoreThings/UriExtensionsTests.cs index be7aec631e..d3d5548a1d 100644 --- a/src/Umbraco.Tests/CoreThings/UriExtensionsTests.cs +++ b/src/Umbraco.Tests/CoreThings/UriExtensionsTests.cs @@ -1,6 +1,7 @@ using System; using NUnit.Framework; using Umbraco.Core; +using Umbraco.Core.Composing; using Umbraco.Core.IO; using Umbraco.Tests.TestHelpers; @@ -14,13 +15,13 @@ namespace Umbraco.Tests.CoreThings [SetUp] public void SetUp() { - _root = SystemDirectories.Root; + _root = Current.SystemDirectories.Root; } [TearDown] public void TearDown() { - SystemDirectories.Root = _root; + Current.SystemDirectories.Root = _root; } [TestCase("http://www.domain.com/umbraco", "", true)] @@ -32,7 +33,7 @@ namespace Umbraco.Tests.CoreThings [TestCase("http://www.domain.com/umbraco/test/test.js", "", true)] [TestCase("http://www.domain.com/umbrac", "", false)] [TestCase("http://www.domain.com/test", "", false)] - [TestCase("http://www.domain.com/test/umbraco", "", false)] + [TestCase("http://www.domain.com/test/umbraco", "", false)] [TestCase("http://www.domain.com/Umbraco/Backoffice/blah", "", true)] [TestCase("http://www.domain.com/Umbraco/anything", "", true)] [TestCase("http://www.domain.com/Umbraco/anything/", "", true)] @@ -44,7 +45,7 @@ namespace Umbraco.Tests.CoreThings [TestCase("http://www.domain.com/umbraco/test/legacyAjaxCalls.ashx?some=query&blah=js", "", true)] public void Is_Back_Office_Request(string input, string virtualPath, bool expected) { - SystemDirectories.Root = virtualPath; + Current.SystemDirectories.Root = virtualPath; var globalConfig = SettingsForTests.GenerateMockGlobalSettings(); var source = new Uri(input); Assert.AreEqual(expected, source.IsBackOfficeRequest(virtualPath, globalConfig)); @@ -58,7 +59,7 @@ namespace Umbraco.Tests.CoreThings [TestCase("http://www.domain.com/install/test/test.js", true)] [TestCase("http://www.domain.com/instal", false)] [TestCase("http://www.domain.com/umbraco", false)] - [TestCase("http://www.domain.com/umbraco/umbraco", false)] + [TestCase("http://www.domain.com/umbraco/umbraco", false)] public void Is_Installer_Request(string input, bool expected) { var source = new Uri(input); diff --git a/src/Umbraco.Tests/IO/IoHelperTests.cs b/src/Umbraco.Tests/IO/IoHelperTests.cs index 2a7e633e4f..5ca335db25 100644 --- a/src/Umbraco.Tests/IO/IoHelperTests.cs +++ b/src/Umbraco.Tests/IO/IoHelperTests.cs @@ -9,6 +9,8 @@ namespace Umbraco.Tests.IO [TestFixture] public class IoHelperTests { + private ISystemDirectories SystemDirectories => Current.SystemDirectories; + [TestCase("~/Scripts", "/Scripts", null)] [TestCase("/Scripts", "/Scripts", null)] [TestCase("../Scripts", "/Scripts", typeof(ArgumentException))] diff --git a/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs b/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs index 409fae6081..2e8c6c110f 100644 --- a/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs +++ b/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs @@ -41,7 +41,7 @@ namespace Umbraco.Tests.IO private static void ClearFiles() { TestHelper.DeleteDirectory(Current.IOHelper.MapPath("FileSysTests")); - TestHelper.DeleteDirectory(Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs")); + TestHelper.DeleteDirectory(Current.IOHelper.MapPath(Current.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs")); } private static string NormPath(string path) @@ -388,7 +388,7 @@ namespace Umbraco.Tests.IO var logger = Mock.Of(); var path = Current.IOHelper.MapPath("FileSysTests"); - var shadowfs = Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"); + var shadowfs = Current.IOHelper.MapPath(Current.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"); Directory.CreateDirectory(path); Directory.CreateDirectory(shadowfs); @@ -483,7 +483,7 @@ namespace Umbraco.Tests.IO var logger = Mock.Of(); var path = Current.IOHelper.MapPath("FileSysTests"); - var shadowfs = Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"); + var shadowfs = Current.IOHelper.MapPath(Current.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"); Directory.CreateDirectory(path); var scopedFileSystems = false; @@ -536,7 +536,7 @@ namespace Umbraco.Tests.IO var logger = Mock.Of(); var path = Current.IOHelper.MapPath("FileSysTests"); - var shadowfs = Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"); + var shadowfs = Current.IOHelper.MapPath(Current.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"); Directory.CreateDirectory(path); var scopedFileSystems = false; diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/PreviewContent.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/PreviewContent.cs index adbd15b16a..f023eb9446 100644 --- a/src/Umbraco.Tests/LegacyXmlPublishedCache/PreviewContent.cs +++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/PreviewContent.cs @@ -108,7 +108,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache _previewXml = _xmlStore.GetPreviewXml(contentId, includeSubs); // make sure the preview folder exists - var dir = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Preview)); + var dir = new DirectoryInfo(Current.IOHelper.MapPath(Current.SystemDirectories.Preview)); if (dir.Exists == false) dir.Create(); @@ -122,7 +122,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache // get the full path to the preview set private static string GetPreviewSetPath(int userId, Guid previewSet) { - return Current.IOHelper.MapPath(Path.Combine(SystemDirectories.Preview, userId + "_" + previewSet + ".config")); + return Current.IOHelper.MapPath(Path.Combine(Current.SystemDirectories.Preview, userId + "_" + previewSet + ".config")); } // deletes files for the user, and files accessed more than one hour ago diff --git a/src/Umbraco.Tests/Persistence/Repositories/PartialViewRepositoryTests.cs b/src/Umbraco.Tests/Persistence/Repositories/PartialViewRepositoryTests.cs index 9c326b3ddc..8c47d709f2 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/PartialViewRepositoryTests.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/PartialViewRepositoryTests.cs @@ -1,6 +1,7 @@ using System.Linq; using Moq; using NUnit.Framework; +using Umbraco.Core.Composing; using Umbraco.Core.IO; using Umbraco.Core.Models; using Umbraco.Core.PropertyEditors; @@ -20,7 +21,7 @@ namespace Umbraco.Tests.Persistence.Repositories { base.SetUp(); - _fileSystem = new PhysicalFileSystem(SystemDirectories.MvcViews + "/Partials/"); + _fileSystem = new PhysicalFileSystem(Current.SystemDirectories.MvcViews + "/Partials/"); } protected override void Compose() diff --git a/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs index ae0c71a5b3..cd3a2dae2b 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Text; using Moq; using NUnit.Framework; +using Umbraco.Core.Composing; using Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Core.IO; using Umbraco.Core.Models; @@ -26,7 +27,7 @@ namespace Umbraco.Tests.Persistence.Repositories base.SetUp(); _fileSystems = Mock.Of(); - _fileSystem = new PhysicalFileSystem(SystemDirectories.Scripts); + _fileSystem = new PhysicalFileSystem(Current.SystemDirectories.Scripts); Mock.Get(_fileSystems).Setup(x => x.ScriptsFileSystem).Returns(_fileSystem); using (var stream = CreateStream("Umbraco.Sys.registerNamespace(\"Umbraco.Utils\");")) { @@ -36,7 +37,7 @@ namespace Umbraco.Tests.Persistence.Repositories private IScriptRepository CreateRepository() { - return new ScriptRepository(_fileSystems, new IOHelper()); + return new ScriptRepository(_fileSystems, IOHelper); } protected override void Compose() diff --git a/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs index 2358fb257d..a21222e4d2 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using Moq; using NUnit.Framework; +using Umbraco.Core.Composing; using Umbraco.Core.IO; using Umbraco.Core.Models; using Umbraco.Core.Persistence.Repositories; @@ -25,7 +26,7 @@ namespace Umbraco.Tests.Persistence.Repositories base.SetUp(); _fileSystems = Mock.Of(); - _fileSystem = new PhysicalFileSystem(SystemDirectories.Css); + _fileSystem = new PhysicalFileSystem(Current.SystemDirectories.Css); Mock.Get(_fileSystems).Setup(x => x.StylesheetsFileSystem).Returns(_fileSystem); var stream = CreateStream("body {background:#EE7600; color:#FFF;}"); _fileSystem.AddFile("styles.css", stream); @@ -33,7 +34,7 @@ namespace Umbraco.Tests.Persistence.Repositories private IStylesheetRepository CreateRepository() { - return new StylesheetRepository(_fileSystems, new IOHelper()); + return new StylesheetRepository(_fileSystems, IOHelper); } [Test] diff --git a/src/Umbraco.Tests/Persistence/Repositories/TemplateRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/TemplateRepositoryTest.cs index b0f9a5335b..c7eb9ed4f6 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/TemplateRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/TemplateRepositoryTest.cs @@ -7,6 +7,7 @@ using Moq; using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Cache; +using Umbraco.Core.Composing; using Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Core.IO; using Umbraco.Core.Models; @@ -35,7 +36,7 @@ namespace Umbraco.Tests.Persistence.Repositories base.SetUp(); _fileSystems = Mock.Of(); - var viewsFileSystem = new PhysicalFileSystem(SystemDirectories.MvcViews); + var viewsFileSystem = new PhysicalFileSystem(Current.SystemDirectories.MvcViews); Mock.Get(_fileSystems).Setup(x => x.MvcViewsFileSystem).Returns(viewsFileSystem); } @@ -63,7 +64,7 @@ namespace Umbraco.Tests.Persistence.Repositories // Act var template = new Template("test", "test"); repository.Save(template); - + //Assert Assert.That(repository.Get("test"), Is.Not.Null); @@ -526,7 +527,7 @@ namespace Umbraco.Tests.Persistence.Repositories _fileSystems = null; //Delete all files - var fsViews = new PhysicalFileSystem(SystemDirectories.MvcViews); + var fsViews = new PhysicalFileSystem(Current.SystemDirectories.MvcViews); var views = fsViews.GetFiles("", "*.cshtml"); foreach (var file in views) fsViews.DeleteFile(file); @@ -615,7 +616,7 @@ namespace Umbraco.Tests.Persistence.Repositories repository.Save(toddler4); repository.Save(baby1); repository.Save(baby2); - + return new[] {parent, child1, child2, toddler1, toddler2, toddler3, toddler4, baby1, baby2}; } diff --git a/src/Umbraco.Tests/Scoping/ScopeFileSystemsTests.cs b/src/Umbraco.Tests/Scoping/ScopeFileSystemsTests.cs index 305ae70be9..1f49e83202 100644 --- a/src/Umbraco.Tests/Scoping/ScopeFileSystemsTests.cs +++ b/src/Umbraco.Tests/Scoping/ScopeFileSystemsTests.cs @@ -46,7 +46,7 @@ namespace Umbraco.Tests.Scoping { TestHelper.DeleteDirectory(Current.IOHelper.MapPath("media")); TestHelper.DeleteDirectory(Current.IOHelper.MapPath("FileSysTests")); - TestHelper.DeleteDirectory(Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs")); + TestHelper.DeleteDirectory(Current.IOHelper.MapPath(Current.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs")); } [TestCase(true)] diff --git a/src/Umbraco.Tests/TestHelpers/TestHelper.cs b/src/Umbraco.Tests/TestHelpers/TestHelper.cs index e07dbe1e5a..abd4e0f91b 100644 --- a/src/Umbraco.Tests/TestHelpers/TestHelper.cs +++ b/src/Umbraco.Tests/TestHelpers/TestHelper.cs @@ -62,12 +62,12 @@ namespace Umbraco.Tests.TestHelpers public static void InitializeContentDirectories() { - CreateDirectories(new[] { SystemDirectories.MvcViews, SystemDirectories.Media, SystemDirectories.AppPlugins }); + CreateDirectories(new[] { Current.SystemDirectories.MvcViews, Current.SystemDirectories.Media, Current.SystemDirectories.AppPlugins }); } public static void CleanContentDirectories() { - CleanDirectories(new[] { SystemDirectories.MvcViews, SystemDirectories.Media }); + CleanDirectories(new[] { Current.SystemDirectories.MvcViews, Current.SystemDirectories.Media }); } public static void CreateDirectories(string[] directories) @@ -84,7 +84,7 @@ namespace Umbraco.Tests.TestHelpers { var preserves = new Dictionary { - { SystemDirectories.MvcViews, new[] {"dummy.txt"} } + { Current.SystemDirectories.MvcViews, new[] {"dummy.txt"} } }; foreach (var directory in directories) { diff --git a/src/Umbraco.Tests/TestHelpers/TestObjects.cs b/src/Umbraco.Tests/TestHelpers/TestObjects.cs index 280632fdae..0e838bbf24 100644 --- a/src/Umbraco.Tests/TestHelpers/TestObjects.cs +++ b/src/Umbraco.Tests/TestHelpers/TestObjects.cs @@ -118,9 +118,9 @@ namespace Umbraco.Tests.TestHelpers var localizedTextService = GetLazyService(factory, c => new LocalizedTextService( new Lazy(() => { - var mainLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Umbraco + "/config/lang/")); - var appPlugins = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.AppPlugins)); - var configLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Config + "/lang/")); + var mainLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(Current.SystemDirectories.Umbraco + "/config/lang/")); + var appPlugins = new DirectoryInfo(Current.IOHelper.MapPath(Current.SystemDirectories.AppPlugins)); + var configLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(Current.SystemDirectories.Config + "/lang/")); var pluginLangFolders = appPlugins.Exists == false ? Enumerable.Empty() diff --git a/src/Umbraco.Web/Composing/Current.cs b/src/Umbraco.Web/Composing/Current.cs index 026dedca7d..cef6065cbf 100644 --- a/src/Umbraco.Web/Composing/Current.cs +++ b/src/Umbraco.Web/Composing/Current.cs @@ -227,6 +227,7 @@ namespace Umbraco.Web.Composing public static IVariationContextAccessor VariationContextAccessor => CoreCurrent.VariationContextAccessor; public static IIOHelper IOHelper => CoreCurrent.IOHelper; + public static ISystemDirectories SystemDirectories => CoreCurrent.SystemDirectories; #endregion } diff --git a/src/Umbraco.Web/Editors/BackOfficeAssetsController.cs b/src/Umbraco.Web/Editors/BackOfficeAssetsController.cs index 6b1b12ab63..faab9fcb7f 100644 --- a/src/Umbraco.Web/Editors/BackOfficeAssetsController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeAssetsController.cs @@ -11,7 +11,7 @@ namespace Umbraco.Web.Editors [PluginController("UmbracoApi")] public class BackOfficeAssetsController : UmbracoAuthorizedJsonController { - private readonly IFileSystem _jsLibFileSystem = new PhysicalFileSystem(SystemDirectories.Umbraco + Current.IOHelper.DirSepChar + "lib"); + private readonly IFileSystem _jsLibFileSystem = new PhysicalFileSystem(Current.SystemDirectories.Umbraco + Current.IOHelper.DirSepChar + "lib"); [HttpGet] public object GetSupportedLocales() diff --git a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs index 45f5d52297..b706b0c229 100644 --- a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs +++ b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs @@ -320,8 +320,8 @@ namespace Umbraco.Web.Editors "umbracoSettings", new Dictionary { {"umbracoPath", _globalSettings.Path}, - {"mediaPath", Current.IOHelper.ResolveUrl(SystemDirectories.Media).TrimEnd('/')}, - {"appPluginsPath", Current.IOHelper.ResolveUrl(SystemDirectories.AppPlugins).TrimEnd('/')}, + {"mediaPath", Current.IOHelper.ResolveUrl(Current.SystemDirectories.Media).TrimEnd('/')}, + {"appPluginsPath", Current.IOHelper.ResolveUrl(Current.SystemDirectories.AppPlugins).TrimEnd('/')}, { "imageFileTypes", string.Join(",", Current.Configs.Settings().Content.ImageFileTypes) @@ -340,7 +340,7 @@ namespace Umbraco.Web.Editors }, {"keepUserLoggedIn", Current.Configs.Settings().Security.KeepUserLoggedIn}, {"usernameIsEmail", Current.Configs.Settings().Security.UsernameIsEmail}, - {"cssPath", Current.IOHelper.ResolveUrl(SystemDirectories.Css).TrimEnd('/')}, + {"cssPath", Current.IOHelper.ResolveUrl(Current.SystemDirectories.Css).TrimEnd('/')}, {"allowPasswordReset", Current.Configs.Settings().Security.AllowPasswordReset}, {"loginBackgroundImage", Current.Configs.Settings().Content.LoginBackgroundImage}, {"showUserInvite", EmailSender.CanSendRequiredEmail}, diff --git a/src/Umbraco.Web/Editors/Binders/ContentModelBinderHelper.cs b/src/Umbraco.Web/Editors/Binders/ContentModelBinderHelper.cs index 6fc0e123a5..12dab7549e 100644 --- a/src/Umbraco.Web/Editors/Binders/ContentModelBinderHelper.cs +++ b/src/Umbraco.Web/Editors/Binders/ContentModelBinderHelper.cs @@ -3,6 +3,7 @@ using System.Net.Http; using System.Web.Http; using System.Web.Http.Controllers; using Umbraco.Core; +using Umbraco.Core.Composing; using Umbraco.Core.IO; using Umbraco.Core.Models; using Umbraco.Core.Models.Editors; @@ -20,7 +21,7 @@ namespace Umbraco.Web.Editors.Binders public TModelSave BindModelFromMultipartRequest(HttpActionContext actionContext, ModelBindingContext bindingContext) where TModelSave : IHaveUploadedFiles { - var result = actionContext.ReadAsMultipart(SystemDirectories.TempFileUploads); + var result = actionContext.ReadAsMultipart(Current.SystemDirectories.TempFileUploads); var model = actionContext.GetModelFromMultipartRequest(result, "contentItem"); diff --git a/src/Umbraco.Web/Editors/CodeFileController.cs b/src/Umbraco.Web/Editors/CodeFileController.cs index a4e89c25f2..1d281e1641 100644 --- a/src/Umbraco.Web/Editors/CodeFileController.cs +++ b/src/Umbraco.Web/Editors/CodeFileController.cs @@ -110,19 +110,19 @@ namespace Umbraco.Web.Editors switch (type) { case Core.Constants.Trees.PartialViews: - virtualPath = NormalizeVirtualPath(name, SystemDirectories.PartialViews); + virtualPath = NormalizeVirtualPath(name, Current.SystemDirectories.PartialViews); Services.FileService.CreatePartialViewFolder(virtualPath); break; case Core.Constants.Trees.PartialViewMacros: - virtualPath = NormalizeVirtualPath(name, SystemDirectories.MacroPartials); + virtualPath = NormalizeVirtualPath(name, Current.SystemDirectories.MacroPartials); Services.FileService.CreatePartialViewMacroFolder(virtualPath); break; case Core.Constants.Trees.Scripts: - virtualPath = NormalizeVirtualPath(name, SystemDirectories.Scripts); + virtualPath = NormalizeVirtualPath(name, Current.SystemDirectories.Scripts); Services.FileService.CreateScriptFolder(virtualPath); break; case Core.Constants.Trees.Stylesheets: - virtualPath = NormalizeVirtualPath(name, SystemDirectories.Css); + virtualPath = NormalizeVirtualPath(name, Current.SystemDirectories.Css); Services.FileService.CreateStyleSheetFolder(virtualPath); break; @@ -250,23 +250,23 @@ namespace Umbraco.Web.Editors { case Core.Constants.Trees.PartialViews: codeFileDisplay = Mapper.Map(new PartialView(PartialViewType.PartialView, string.Empty)); - codeFileDisplay.VirtualPath = SystemDirectories.PartialViews; + codeFileDisplay.VirtualPath = Current.SystemDirectories.PartialViews; if (snippetName.IsNullOrWhiteSpace() == false) codeFileDisplay.Content = Services.FileService.GetPartialViewSnippetContent(snippetName); break; case Core.Constants.Trees.PartialViewMacros: codeFileDisplay = Mapper.Map(new PartialView(PartialViewType.PartialViewMacro, string.Empty)); - codeFileDisplay.VirtualPath = SystemDirectories.MacroPartials; + codeFileDisplay.VirtualPath = Current.SystemDirectories.MacroPartials; if (snippetName.IsNullOrWhiteSpace() == false) codeFileDisplay.Content = Services.FileService.GetPartialViewMacroSnippetContent(snippetName); break; case Core.Constants.Trees.Scripts: codeFileDisplay = Mapper.Map(new Script(string.Empty)); - codeFileDisplay.VirtualPath = SystemDirectories.Scripts; + codeFileDisplay.VirtualPath = Current.SystemDirectories.Scripts; break; case Core.Constants.Trees.Stylesheets: codeFileDisplay = Mapper.Map(new Stylesheet(string.Empty)); - codeFileDisplay.VirtualPath = SystemDirectories.Css; + codeFileDisplay.VirtualPath = Current.SystemDirectories.Css; break; default: throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Unsupported editortype")); @@ -305,7 +305,7 @@ namespace Umbraco.Web.Editors switch (type) { case Core.Constants.Trees.PartialViews: - if (IsDirectory(virtualPath, SystemDirectories.PartialViews)) + if (IsDirectory(virtualPath, Current.SystemDirectories.PartialViews)) { Services.FileService.DeletePartialViewFolder(virtualPath); return Request.CreateResponse(HttpStatusCode.OK); @@ -317,7 +317,7 @@ namespace Umbraco.Web.Editors return Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Partial View or folder found with the specified path"); case Core.Constants.Trees.PartialViewMacros: - if (IsDirectory(virtualPath, SystemDirectories.MacroPartials)) + if (IsDirectory(virtualPath, Current.SystemDirectories.MacroPartials)) { Services.FileService.DeletePartialViewMacroFolder(virtualPath); return Request.CreateResponse(HttpStatusCode.OK); @@ -329,7 +329,7 @@ namespace Umbraco.Web.Editors return Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Partial View Macro or folder found with the specified path"); case Core.Constants.Trees.Scripts: - if (IsDirectory(virtualPath, SystemDirectories.Scripts)) + if (IsDirectory(virtualPath, Current.SystemDirectories.Scripts)) { Services.FileService.DeleteScriptFolder(virtualPath); return Request.CreateResponse(HttpStatusCode.OK); @@ -342,7 +342,7 @@ namespace Umbraco.Web.Editors return Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Script or folder found with the specified path"); case Core.Constants.Trees.Stylesheets: - if (IsDirectory(virtualPath, SystemDirectories.Css)) + if (IsDirectory(virtualPath, Current.SystemDirectories.Css)) { Services.FileService.DeleteStyleSheetFolder(virtualPath); return Request.CreateResponse(HttpStatusCode.OK); @@ -561,13 +561,13 @@ namespace Umbraco.Web.Editors private Attempt CreateOrUpdatePartialView(CodeFileDisplay display) { - return CreateOrUpdatePartialView(display, SystemDirectories.PartialViews, + return CreateOrUpdatePartialView(display, Current.SystemDirectories.PartialViews, Services.FileService.GetPartialView, Services.FileService.SavePartialView, Services.FileService.CreatePartialView); } private Attempt CreateOrUpdatePartialViewMacro(CodeFileDisplay display) { - return CreateOrUpdatePartialView(display, SystemDirectories.MacroPartials, + return CreateOrUpdatePartialView(display, Current.SystemDirectories.MacroPartials, Services.FileService.GetPartialViewMacro, Services.FileService.SavePartialViewMacro, Services.FileService.CreatePartialViewMacro); } diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs index e01fe251cb..790381ab04 100644 --- a/src/Umbraco.Web/Editors/ContentTypeController.cs +++ b/src/Umbraco.Web/Editors/ContentTypeController.cs @@ -515,7 +515,7 @@ namespace Umbraco.Web.Editors [HttpPost] public HttpResponseMessage Import(string file) { - var filePath = Path.Combine(Current.IOHelper.MapPath(SystemDirectories.Data), file); + var filePath = Path.Combine(Current.IOHelper.MapPath(Current.SystemDirectories.Data), file); if (string.IsNullOrEmpty(file) || !System.IO.File.Exists(filePath)) { return Request.CreateResponse(HttpStatusCode.NotFound); @@ -553,7 +553,7 @@ namespace Umbraco.Web.Editors throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); } - var root = Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "FileUploads"); + var root = Current.IOHelper.MapPath(Current.SystemDirectories.TempData.EnsureEndsWith('/') + "FileUploads"); //ensure it exists Directory.CreateDirectory(root); var provider = new MultipartFormDataStreamProvider(root); diff --git a/src/Umbraco.Web/Editors/MacrosController.cs b/src/Umbraco.Web/Editors/MacrosController.cs index 0df685dea7..0f73dcea8f 100644 --- a/src/Umbraco.Web/Editors/MacrosController.cs +++ b/src/Umbraco.Web/Editors/MacrosController.cs @@ -311,12 +311,12 @@ namespace Umbraco.Web.Editors /// private IEnumerable FindPartialViewFilesInViewsFolder() { - var partialsDir = Current.IOHelper.MapPath(SystemDirectories.MacroPartials); + var partialsDir = Current.IOHelper.MapPath(Current.SystemDirectories.MacroPartials); return this.FindPartialViewFilesInFolder( partialsDir, partialsDir, - SystemDirectories.MacroPartials); + Current.SystemDirectories.MacroPartials); } /// @@ -329,7 +329,7 @@ namespace Umbraco.Web.Editors { var files = new List(); - var appPluginsFolder = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.AppPlugins)); + var appPluginsFolder = new DirectoryInfo(Current.IOHelper.MapPath(Current.SystemDirectories.AppPlugins)); if (!appPluginsFolder.Exists) { @@ -344,7 +344,7 @@ namespace Umbraco.Web.Editors var macroPartials = viewsFolder.First().GetDirectories("MacroPartials"); if (macroPartials.Any()) { - files.AddRange(this.FindPartialViewFilesInFolder(macroPartials.First().FullName, macroPartials.First().FullName, SystemDirectories.AppPlugins + "/" + directory.Name + "/Views/MacroPartials")); + files.AddRange(this.FindPartialViewFilesInFolder(macroPartials.First().FullName, macroPartials.First().FullName, Current.SystemDirectories.AppPlugins + "/" + directory.Name + "/Views/MacroPartials")); } } } diff --git a/src/Umbraco.Web/Editors/MediaController.cs b/src/Umbraco.Web/Editors/MediaController.cs index 2cab9f4ebc..7c53db6b17 100644 --- a/src/Umbraco.Web/Editors/MediaController.cs +++ b/src/Umbraco.Web/Editors/MediaController.cs @@ -620,7 +620,7 @@ namespace Umbraco.Web.Editors throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); } - var root = Current.IOHelper.MapPath(SystemDirectories.TempFileUploads); + var root = Current.IOHelper.MapPath(Current.SystemDirectories.TempFileUploads); //ensure it exists Directory.CreateDirectory(root); var provider = new MultipartFormDataStreamProvider(root); diff --git a/src/Umbraco.Web/Editors/PackageInstallController.cs b/src/Umbraco.Web/Editors/PackageInstallController.cs index 51007b1970..0629adcfcf 100644 --- a/src/Umbraco.Web/Editors/PackageInstallController.cs +++ b/src/Umbraco.Web/Editors/PackageInstallController.cs @@ -90,7 +90,7 @@ namespace Umbraco.Web.Editors private void PopulateFromPackageData(LocalPackageInstallModel model) { - var zipFile = new FileInfo(Path.Combine(Current.IOHelper.MapPath(SystemDirectories.Packages), model.ZipFileName)); + var zipFile = new FileInfo(Path.Combine(Current.IOHelper.MapPath(Current.SystemDirectories.Packages), model.ZipFileName)); var ins = Services.PackagingService.GetCompiledPackageInfo(zipFile); @@ -132,7 +132,7 @@ namespace Umbraco.Web.Editors if (Request.Content.IsMimeMultipartContent() == false) throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); - var root = Current.IOHelper.MapPath(SystemDirectories.TempFileUploads); + var root = Current.IOHelper.MapPath(Current.SystemDirectories.TempFileUploads); //ensure it exists Directory.CreateDirectory(root); var provider = new MultipartFormDataStreamProvider(root); @@ -159,7 +159,7 @@ namespace Umbraco.Web.Editors { //we always save package files to /App_Data/packages/package-guid.umb for processing as a standard so lets copy. - var packagesFolder = Current.IOHelper.MapPath(SystemDirectories.Packages); + var packagesFolder = Current.IOHelper.MapPath(Current.SystemDirectories.Packages); Directory.CreateDirectory(packagesFolder); var packageFile = Path.Combine(packagesFolder, model.PackageGuid + ".umb"); File.Copy(file.LocalFileName, packageFile); @@ -211,7 +211,7 @@ namespace Umbraco.Web.Editors { //Default path string fileName = packageGuid + ".umb"; - if (File.Exists(Path.Combine(Current.IOHelper.MapPath(SystemDirectories.Packages), fileName)) == false) + if (File.Exists(Path.Combine(Current.IOHelper.MapPath(Current.SystemDirectories.Packages), fileName)) == false) { var packageFile = await Services.PackagingService.FetchPackageFileAsync( Guid.Parse(packageGuid), @@ -251,7 +251,7 @@ namespace Umbraco.Web.Editors [HttpPost] public PackageInstallModel Import(PackageInstallModel model) { - var zipFile = new FileInfo(Path.Combine(Current.IOHelper.MapPath(SystemDirectories.Packages), model.ZipFileName)); + var zipFile = new FileInfo(Path.Combine(Current.IOHelper.MapPath(Current.SystemDirectories.Packages), model.ZipFileName)); var packageInfo = Services.PackagingService.GetCompiledPackageInfo(zipFile); diff --git a/src/Umbraco.Web/Editors/TinyMceController.cs b/src/Umbraco.Web/Editors/TinyMceController.cs index 3d03977883..b03d87ffbc 100644 --- a/src/Umbraco.Web/Editors/TinyMceController.cs +++ b/src/Umbraco.Web/Editors/TinyMceController.cs @@ -45,10 +45,10 @@ namespace Umbraco.Web.Editors } // Create an unique folder path to help with concurrent users to avoid filename clash - var imageTempPath = Current.IOHelper.MapPath(SystemDirectories.TempImageUploads + "/" + Guid.NewGuid().ToString()); + var imageTempPath = Current.IOHelper.MapPath(Current.SystemDirectories.TempImageUploads + "/" + Guid.NewGuid().ToString()); // Temp folderpath (Files come in as bodypart & will need to move/saved into imgTempPath - var folderPath = Current.IOHelper.MapPath(SystemDirectories.TempFileUploads); + var folderPath = Current.IOHelper.MapPath(Current.SystemDirectories.TempFileUploads); // Ensure image temp path exists if(Directory.Exists(imageTempPath) == false) diff --git a/src/Umbraco.Web/Editors/TourController.cs b/src/Umbraco.Web/Editors/TourController.cs index e3d42b6753..80a39ee83b 100644 --- a/src/Umbraco.Web/Editors/TourController.cs +++ b/src/Umbraco.Web/Editors/TourController.cs @@ -41,7 +41,7 @@ namespace Umbraco.Web.Editors var nonPluginFilters = _filters.Where(x => x.PluginName == null).ToList(); //add core tour files - var coreToursPath = Path.Combine(Current.IOHelper.MapPath(SystemDirectories.Config), "BackOfficeTours"); + var coreToursPath = Path.Combine(Current.IOHelper.MapPath(Current.SystemDirectories.Config), "BackOfficeTours"); if (Directory.Exists(coreToursPath)) { foreach (var tourFile in Directory.EnumerateFiles(coreToursPath, "*.json")) @@ -51,7 +51,7 @@ namespace Umbraco.Web.Editors } //collect all tour files in packages - var appPlugins = Current.IOHelper.MapPath(SystemDirectories.AppPlugins); + var appPlugins = Current.IOHelper.MapPath(Current.SystemDirectories.AppPlugins); if (Directory.Exists(appPlugins)) { foreach (var plugin in Directory.EnumerateDirectories(appPlugins)) diff --git a/src/Umbraco.Web/Editors/UsersController.cs b/src/Umbraco.Web/Editors/UsersController.cs index 3024583fba..cf81907dda 100644 --- a/src/Umbraco.Web/Editors/UsersController.cs +++ b/src/Umbraco.Web/Editors/UsersController.cs @@ -75,7 +75,7 @@ namespace Umbraco.Web.Editors throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); } - var root = Current.IOHelper.MapPath(SystemDirectories.TempFileUploads); + var root = Current.IOHelper.MapPath(Current.SystemDirectories.TempFileUploads); //ensure it exists Directory.CreateDirectory(root); var provider = new MultipartFormDataStreamProvider(root); diff --git a/src/Umbraco.Web/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs index 577d22fe67..7c263ed7a0 100644 --- a/src/Umbraco.Web/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs +++ b/src/Umbraco.Web/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs @@ -60,24 +60,24 @@ namespace Umbraco.Web.HealthCheck.Checks.Permissions // in ALL circumstances or just some var pathsToCheck = new Dictionary { - { SystemDirectories.Data, PermissionCheckRequirement.Required }, - { SystemDirectories.Packages, PermissionCheckRequirement.Required}, - { SystemDirectories.Preview, PermissionCheckRequirement.Required }, - { SystemDirectories.AppPlugins, PermissionCheckRequirement.Required }, - { SystemDirectories.Config, PermissionCheckRequirement.Optional }, - { SystemDirectories.Css, PermissionCheckRequirement.Optional }, - { SystemDirectories.Media, PermissionCheckRequirement.Optional }, - { SystemDirectories.Scripts, PermissionCheckRequirement.Optional }, - { SystemDirectories.Umbraco, PermissionCheckRequirement.Optional }, - { SystemDirectories.MvcViews, PermissionCheckRequirement.Optional } + { Current.SystemDirectories.Data, PermissionCheckRequirement.Required }, + { Current.SystemDirectories.Packages, PermissionCheckRequirement.Required}, + { Current.SystemDirectories.Preview, PermissionCheckRequirement.Required }, + { Current.SystemDirectories.AppPlugins, PermissionCheckRequirement.Required }, + { Current.SystemDirectories.Config, PermissionCheckRequirement.Optional }, + { Current.SystemDirectories.Css, PermissionCheckRequirement.Optional }, + { Current.SystemDirectories.Media, PermissionCheckRequirement.Optional }, + { Current.SystemDirectories.Scripts, PermissionCheckRequirement.Optional }, + { Current.SystemDirectories.Umbraco, PermissionCheckRequirement.Optional }, + { Current.SystemDirectories.MvcViews, PermissionCheckRequirement.Optional } }; //These are special paths to check that will restart an app domain if a file is written to them, //so these need to be tested differently var pathsToCheckWithRestarts = new Dictionary { - { SystemDirectories.AppCode, PermissionCheckRequirement.Optional }, - { SystemDirectories.Bin, PermissionCheckRequirement.Optional } + { Current.SystemDirectories.AppCode, PermissionCheckRequirement.Optional }, + { Current.SystemDirectories.Bin, PermissionCheckRequirement.Optional } }; // Run checks for required and optional paths for modify permission diff --git a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs index a68ba96327..cd3c768b5d 100644 --- a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs +++ b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs @@ -67,7 +67,7 @@ namespace Umbraco.Web { var htmlBadge = String.Format(Current.Configs.Settings().Content.PreviewBadge, - Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco), + Current.IOHelper.ResolveUrl(Current.SystemDirectories.Umbraco), Current.UmbracoContext.HttpContext.Server.UrlEncode(Current.UmbracoContext.HttpContext.Request.Path)); return new MvcHtmlString(htmlBadge); } diff --git a/src/Umbraco.Web/Install/Controllers/InstallController.cs b/src/Umbraco.Web/Install/Controllers/InstallController.cs index dc71125f15..8bf294ab0e 100644 --- a/src/Umbraco.Web/Install/Controllers/InstallController.cs +++ b/src/Umbraco.Web/Install/Controllers/InstallController.cs @@ -41,7 +41,7 @@ namespace Umbraco.Web.Install.Controllers public ActionResult Index() { if (_runtime.Level == RuntimeLevel.Run) - return Redirect(SystemDirectories.Umbraco.EnsureEndsWith('/')); + return Redirect(Current.SystemDirectories.Umbraco.EnsureEndsWith('/')); if (_runtime.Level == RuntimeLevel.Upgrade) { @@ -58,7 +58,7 @@ namespace Umbraco.Web.Install.Controllers { case ValidateRequestAttempt.FailedNoPrivileges: case ValidateRequestAttempt.FailedNoContextId: - return Redirect(SystemDirectories.Umbraco + "/AuthorizeUpgrade?redir=" + Server.UrlEncode(Request.RawUrl)); + return Redirect(Current.SystemDirectories.Umbraco + "/AuthorizeUpgrade?redir=" + Server.UrlEncode(Request.RawUrl)); } } @@ -66,7 +66,7 @@ namespace Umbraco.Web.Install.Controllers ViewData.SetInstallApiBaseUrl(Url.GetUmbracoApiService("GetSetup", "InstallApi", "UmbracoInstall").TrimEnd("GetSetup")); // get the base umbraco folder - ViewData.SetUmbracoBaseFolder(Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco)); + ViewData.SetUmbracoBaseFolder(Current.IOHelper.ResolveUrl(Current.SystemDirectories.Umbraco)); _installHelper.InstallStatus(false, ""); diff --git a/src/Umbraco.Web/Install/FilePermissionHelper.cs b/src/Umbraco.Web/Install/FilePermissionHelper.cs index 2d48fe8974..7f90f55ae9 100644 --- a/src/Umbraco.Web/Install/FilePermissionHelper.cs +++ b/src/Umbraco.Web/Install/FilePermissionHelper.cs @@ -11,8 +11,8 @@ namespace Umbraco.Web.Install internal class FilePermissionHelper { // ensure that these directories exist and Umbraco can write to them - private static readonly string[] PermissionDirs = { SystemDirectories.Css, SystemDirectories.Config, SystemDirectories.Data, SystemDirectories.Media, SystemDirectories.Preview }; - private static readonly string[] PackagesPermissionsDirs = { SystemDirectories.Bin, SystemDirectories.Umbraco, SystemDirectories.Packages }; + private static readonly string[] PermissionDirs = { Current.SystemDirectories.Css, Current.SystemDirectories.Config, Current.SystemDirectories.Data, Current.SystemDirectories.Media, Current.SystemDirectories.Preview }; + private static readonly string[] PackagesPermissionsDirs = { Current.SystemDirectories.Bin, Current.SystemDirectories.Umbraco, Current.SystemDirectories.Packages }; // ensure Umbraco can write to these files (the directories must exist) private static readonly string[] PermissionFiles = { }; @@ -35,7 +35,7 @@ namespace Umbraco.Web.Install if (TestPublishedSnapshotService(out errors) == false) report["Published snapshot environment check failed"] = errors.ToList(); - if (EnsureCanCreateSubDirectory(SystemDirectories.Media, out errors) == false) + if (EnsureCanCreateSubDirectory(Current.SystemDirectories.Media, out errors) == false) report["Media folder creation failed"] = errors.ToList(); } diff --git a/src/Umbraco.Web/Install/InstallAuthorizeAttribute.cs b/src/Umbraco.Web/Install/InstallAuthorizeAttribute.cs index ce45ef652b..5da3179c44 100644 --- a/src/Umbraco.Web/Install/InstallAuthorizeAttribute.cs +++ b/src/Umbraco.Web/Install/InstallAuthorizeAttribute.cs @@ -66,7 +66,7 @@ namespace Umbraco.Web.Install /// protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext) { - filterContext.Result = new RedirectResult(SystemDirectories.Umbraco.EnsureEndsWith('/')); + filterContext.Result = new RedirectResult(Current.SystemDirectories.Umbraco.EnsureEndsWith('/')); } } } diff --git a/src/Umbraco.Web/Install/InstallStatusTracker.cs b/src/Umbraco.Web/Install/InstallStatusTracker.cs index 3c968ca696..874456ad3f 100644 --- a/src/Umbraco.Web/Install/InstallStatusTracker.cs +++ b/src/Umbraco.Web/Install/InstallStatusTracker.cs @@ -25,10 +25,10 @@ namespace Umbraco.Web.Install private static string GetFile(Guid installId) { - var file = Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "Install/" - + "install_" - + installId.ToString("N") - + ".txt"); + var file = Current.IOHelper.MapPath(Current.SystemDirectories.TempData.EnsureEndsWith('/') + "Install/" + + "install_" + + installId.ToString("N") + + ".txt"); return file; } @@ -40,7 +40,7 @@ namespace Umbraco.Web.Install public static void ClearFiles() { - var dir = Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "Install/"); + var dir = Current.IOHelper.MapPath(Current.SystemDirectories.TempData.EnsureEndsWith('/') + "Install/"); if (Directory.Exists(dir)) { var files = Directory.GetFiles(dir); diff --git a/src/Umbraco.Web/Install/InstallSteps/ConfigureMachineKey.cs b/src/Umbraco.Web/Install/InstallSteps/ConfigureMachineKey.cs index a084805a2c..d71c8d99f3 100644 --- a/src/Umbraco.Web/Install/InstallSteps/ConfigureMachineKey.cs +++ b/src/Umbraco.Web/Install/InstallSteps/ConfigureMachineKey.cs @@ -37,7 +37,7 @@ namespace Umbraco.Web.Install.InstallSteps if (model.HasValue && model.Value == false) return Task.FromResult(null); //install the machine key - var fileName = Current.IOHelper.MapPath($"{SystemDirectories.Root}/web.config"); + var fileName = Current.IOHelper.MapPath($"{Current.SystemDirectories.Root}/web.config"); var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace); // we only want to get the element that is under the root, (there may be more under tags we don't want them) diff --git a/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs b/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs index 352a2cace9..89c5ba7191 100644 --- a/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs @@ -27,7 +27,7 @@ namespace Umbraco.Web.Install.InstallSteps private void CleanupInstallation(int packageId, string packageFile) { - var zipFile = new FileInfo(Path.Combine(Current.IOHelper.MapPath(SystemDirectories.Packages), HttpUtility.UrlDecode(packageFile))); + var zipFile = new FileInfo(Path.Combine(Current.IOHelper.MapPath(Current.SystemDirectories.Packages), HttpUtility.UrlDecode(packageFile))); if (zipFile.Exists) zipFile.Delete(); diff --git a/src/Umbraco.Web/JavaScript/ClientDependencyConfiguration.cs b/src/Umbraco.Web/JavaScript/ClientDependencyConfiguration.cs index c64318a68d..b636007cfe 100644 --- a/src/Umbraco.Web/JavaScript/ClientDependencyConfiguration.cs +++ b/src/Umbraco.Web/JavaScript/ClientDependencyConfiguration.cs @@ -27,7 +27,7 @@ namespace Umbraco.Web.JavaScript { if (logger == null) throw new ArgumentNullException("logger"); _logger = logger; - _fileName = Current.IOHelper.MapPath(string.Format("{0}/ClientDependency.config", SystemDirectories.Config)); + _fileName = Current.IOHelper.MapPath(string.Format("{0}/ClientDependency.config", Current.SystemDirectories.Config)); } /// diff --git a/src/Umbraco.Web/JavaScript/JsInitialization.cs b/src/Umbraco.Web/JavaScript/JsInitialization.cs index 24c09dfd03..89b32779a5 100644 --- a/src/Umbraco.Web/JavaScript/JsInitialization.cs +++ b/src/Umbraco.Web/JavaScript/JsInitialization.cs @@ -58,7 +58,7 @@ namespace Umbraco.Web.JavaScript } jarray.Append("]"); - return WriteScript(jarray.ToString(), Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco), angularModule); + return WriteScript(jarray.ToString(), Current.IOHelper.ResolveUrl(Current.SystemDirectories.Umbraco), angularModule); } /// diff --git a/src/Umbraco.Web/JavaScript/UmbracoClientDependencyLoader.cs b/src/Umbraco.Web/JavaScript/UmbracoClientDependencyLoader.cs index 82ae027c8d..c313be8a8b 100644 --- a/src/Umbraco.Web/JavaScript/UmbracoClientDependencyLoader.cs +++ b/src/Umbraco.Web/JavaScript/UmbracoClientDependencyLoader.cs @@ -18,7 +18,7 @@ namespace Umbraco.Web.JavaScript public UmbracoClientDependencyLoader() : base() { - this.AddPath("UmbracoRoot", Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco)); + this.AddPath("UmbracoRoot", Current.IOHelper.ResolveUrl(Current.SystemDirectories.Umbraco)); this.ProviderName = LoaderControlProvider.DefaultName; } diff --git a/src/Umbraco.Web/Mvc/PluginViewEngine.cs b/src/Umbraco.Web/Mvc/PluginViewEngine.cs index e83980a5d8..ae07db58c5 100644 --- a/src/Umbraco.Web/Mvc/PluginViewEngine.cs +++ b/src/Umbraco.Web/Mvc/PluginViewEngine.cs @@ -35,16 +35,16 @@ namespace Umbraco.Web.Mvc var viewLocationsArray = new[] { - string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/{1}/{0}.cshtml"), - string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/{1}/{0}.vbhtml") + string.Concat(Current.SystemDirectories.AppPlugins, "/{2}/Views/{1}/{0}.cshtml"), + string.Concat(Current.SystemDirectories.AppPlugins, "/{2}/Views/{1}/{0}.vbhtml") }; //set all of the area view locations to the plugin folder AreaViewLocationFormats = viewLocationsArray .Concat(new[] { - string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/Shared/{0}.cshtml"), - string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/Shared/{0}.vbhtml") + string.Concat(Current.SystemDirectories.AppPlugins, "/{2}/Views/Shared/{0}.cshtml"), + string.Concat(Current.SystemDirectories.AppPlugins, "/{2}/Views/Shared/{0}.vbhtml") }) .ToArray(); @@ -53,15 +53,15 @@ namespace Umbraco.Web.Mvc AreaPartialViewLocationFormats = new[] { //will be used when we have partial view and child action macros - string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/Partials/{0}.cshtml"), - string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/Partials/{0}.vbhtml"), - string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/MacroPartials/{0}.cshtml"), - string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/MacroPartials/{0}.vbhtml"), - //for partials - string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/{1}/{0}.cshtml"), - string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/{1}/{0}.vbhtml"), - string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/Shared/{0}.cshtml"), - string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/Shared/{0}.vbhtml") + string.Concat(Current.SystemDirectories.AppPlugins, "/{2}/Views/Partials/{0}.cshtml"), + string.Concat(Current.SystemDirectories.AppPlugins, "/{2}/Views/Partials/{0}.vbhtml"), + string.Concat(Current.SystemDirectories.AppPlugins, "/{2}/Views/MacroPartials/{0}.cshtml"), + string.Concat(Current.SystemDirectories.AppPlugins, "/{2}/Views/MacroPartials/{0}.vbhtml"), + //for partialsCurrent. + string.Concat(Current.SystemDirectories.AppPlugins, "/{2}/Views/{1}/{0}.cshtml"), + string.Concat(Current.SystemDirectories.AppPlugins, "/{2}/Views/{1}/{0}.vbhtml"), + string.Concat(Current.SystemDirectories.AppPlugins, "/{2}/Views/Shared/{0}.cshtml"), + string.Concat(Current.SystemDirectories.AppPlugins, "/{2}/Views/Shared/{0}.vbhtml") }; } diff --git a/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs b/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs index 26dee405ee..f58a519393 100644 --- a/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs +++ b/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs @@ -214,7 +214,7 @@ namespace Umbraco.Web.Mvc // creating previewBadge markup markupToInject = string.Format(Current.Configs.Settings().Content.PreviewBadge, - Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco), + Current.IOHelper.ResolveUrl(Current.SystemDirectories.Umbraco), Server.UrlEncode(Current.UmbracoContext.HttpContext.Request.Url?.PathAndQuery)); } else diff --git a/src/Umbraco.Web/Runtime/WebInitialComponent.cs b/src/Umbraco.Web/Runtime/WebInitialComponent.cs index 5210232f67..e5ad0c0665 100644 --- a/src/Umbraco.Web/Runtime/WebInitialComponent.cs +++ b/src/Umbraco.Web/Runtime/WebInitialComponent.cs @@ -112,7 +112,7 @@ namespace Umbraco.Web.Runtime private static void ConfigureClientDependency(IGlobalSettings globalSettings) { // Backwards compatibility - set the path and URL type for ClientDependency 1.5.1 [LK] - XmlFileMapper.FileMapDefaultFolder = SystemDirectories.TempData.EnsureEndsWith('/') + "ClientDependency"; + XmlFileMapper.FileMapDefaultFolder = Current.SystemDirectories.TempData.EnsureEndsWith('/') + "ClientDependency"; BaseCompositeFileProcessingProvider.UrlTypeDefault = CompositeUrlType.Base64QueryStrings; // 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 diff --git a/src/Umbraco.Web/Scheduling/SchedulerComponent.cs b/src/Umbraco.Web/Scheduling/SchedulerComponent.cs index ee3fce50c8..ff1350bcde 100644 --- a/src/Umbraco.Web/Scheduling/SchedulerComponent.cs +++ b/src/Umbraco.Web/Scheduling/SchedulerComponent.cs @@ -170,7 +170,7 @@ namespace Umbraco.Web.Scheduling // temp file cleanup, will run on all servers - even though file upload should only be handled on the master, this will // ensure that in the case it happes on replicas that they are cleaned up. var task = new TempFileCleanup(_fileCleanupRunner, DefaultDelayMilliseconds, OneHourMilliseconds, - new[] { new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.TempFileUploads)) }, + new[] { new DirectoryInfo(Current.IOHelper.MapPath(Current.SystemDirectories.TempFileUploads)) }, TimeSpan.FromDays(1), //files that are over a day old _runtime, _logger); _scrubberRunner.TryAdd(task); diff --git a/src/Umbraco.Web/Security/WebSecurity.cs b/src/Umbraco.Web/Security/WebSecurity.cs index 6b66becedb..ce799a8a2b 100644 --- a/src/Umbraco.Web/Security/WebSecurity.cs +++ b/src/Umbraco.Web/Security/WebSecurity.cs @@ -209,7 +209,7 @@ namespace Umbraco.Web.Security private static bool RequestIsInUmbracoApplication(HttpContextBase context) { - return context.Request.Path.ToLower().IndexOf(Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco).ToLower(), StringComparison.Ordinal) > -1; + return context.Request.Path.ToLower().IndexOf(Current.IOHelper.ResolveUrl(Current.SystemDirectories.Umbraco).ToLower(), StringComparison.Ordinal) > -1; } /// diff --git a/src/Umbraco.Web/UmbracoInjectedModule.cs b/src/Umbraco.Web/UmbracoInjectedModule.cs index 6dc41d39ee..f43146cda5 100644 --- a/src/Umbraco.Web/UmbracoInjectedModule.cs +++ b/src/Umbraco.Web/UmbracoInjectedModule.cs @@ -180,7 +180,7 @@ namespace Umbraco.Web return Attempt.If(reason == EnsureRoutableOutcome.IsRoutable, reason); } - + private bool EnsureRuntime(HttpContextBase httpContext, Uri uri) { @@ -205,7 +205,7 @@ namespace Umbraco.Web case RuntimeLevel.Upgrade: // redirect to install ReportRuntime(level, "Umbraco must install or upgrade."); - var installPath = UriUtility.ToAbsolute(SystemDirectories.Install); + var installPath = UriUtility.ToAbsolute(Current.SystemDirectories.Install); var installUrl = $"{installPath}/?redir=true&url={HttpUtility.UrlEncode(uri.ToString())}"; httpContext.Response.Redirect(installUrl, true); return false; // cannot serve content @@ -436,6 +436,6 @@ namespace Umbraco.Web #endregion - + } }