Merge branch 'netcore/feature/abstract-systemdirectories' into netcore/feature/AB3594_move_exsiting_configuration_to_own_project
This commit is contained in:
@@ -80,12 +80,6 @@ namespace Umbraco.Core.IO
|
||||
/// <returns></returns>
|
||||
string GetRelativePath(string path);
|
||||
|
||||
string Media { get; }
|
||||
string Scripts { get; }
|
||||
string Css { get; }
|
||||
string Umbraco { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the root path of the application
|
||||
/// </summary>
|
||||
|
||||
@@ -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<IMediaFileSystem>() returns the underlying filesystem
|
||||
composition.SetMediaFileSystem(() => new PhysicalFileSystem(Current.IOHelper.Media));
|
||||
composition.SetMediaFileSystem(() => new PhysicalFileSystem(Current.Configs.Global().UmbracoMediaPath));
|
||||
|
||||
return composition;
|
||||
}
|
||||
|
||||
@@ -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/"));
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<Type, string> _paths = new Dictionary<Type, string>();
|
||||
private IGlobalSettings _globalSettings;
|
||||
|
||||
// internal for tests
|
||||
internal IReadOnlyDictionary<Type, string> Paths => _paths;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -664,7 +664,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
|
||||
public IEnumerable<string> 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<string>.Succeed(snippetPath)
|
||||
: Attempt<string>.Fail();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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('/');
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Umbraco.Tests.Components
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var typeFinder = new TypeFinder(logger);
|
||||
var f = new UmbracoDatabaseFactory(logger, new Lazy<IMapperCollection>(() => new MapperCollection(Enumerable.Empty<BaseMapper>())));
|
||||
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);
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -397,7 +397,7 @@ namespace Umbraco.Tests.IO
|
||||
var phy = new PhysicalFileSystem(path, "ignore");
|
||||
|
||||
var container = Mock.Of<IFactory>();
|
||||
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<FS>(phy);
|
||||
var sw = (ShadowWrapper) fs.InnerFileSystem;
|
||||
|
||||
@@ -491,7 +491,7 @@ namespace Umbraco.Tests.IO
|
||||
var phy = new PhysicalFileSystem(path, "ignore");
|
||||
|
||||
var container = Mock.Of<IFactory>();
|
||||
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<FS>( phy);
|
||||
var sw = (ShadowWrapper) fs.InnerFileSystem;
|
||||
|
||||
@@ -544,7 +544,7 @@ namespace Umbraco.Tests.IO
|
||||
var phy = new PhysicalFileSystem(path, "ignore");
|
||||
|
||||
var container = Mock.Of<IFactory>();
|
||||
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<FS>( phy);
|
||||
var sw = (ShadowWrapper)fs.InnerFileSystem;
|
||||
|
||||
|
||||
@@ -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<IFileSystems>();
|
||||
_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\");"))
|
||||
{
|
||||
|
||||
@@ -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<IFileSystems>();
|
||||
_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);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Umbraco.Tests.Scoping
|
||||
|
||||
_testObjects = new TestObjects(register);
|
||||
|
||||
composition.RegisterUnique(factory => new FileSystems(factory, factory.TryGetInstance<ILogger>(), IOHelper.Default));
|
||||
composition.RegisterUnique(factory => new FileSystems(factory, factory.TryGetInstance<ILogger>(), IOHelper.Default, SettingsForTests.GenerateMockGlobalSettings()));
|
||||
composition.WithCollectionBuilder<MapperCollectionBuilder>();
|
||||
|
||||
composition.Configs.Add(SettingsForTests.GetDefaultGlobalSettings);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
var localizedTextService = GetLazyService<ILocalizedTextService>(factory, c => new LocalizedTextService(
|
||||
new Lazy<LocalizedTextServiceFileSources>(() =>
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<title>Umbraco</title>
|
||||
|
||||
@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*@
|
||||
<style>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<title ng-bind="$root.locationTitle">Umbraco</title>
|
||||
|
||||
@Html.RenderCssHere(
|
||||
new BasicPath("Umbraco", Current.IOHelper.ResolveUrl(Current.IOHelper.Umbraco)))
|
||||
new BasicPath("Umbraco", Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoPath)))
|
||||
</head>
|
||||
<body ng-class="{'touch':touchDevice, 'emptySection':emptySection, 'umb-drawer-is-visible':drawer.show, 'umb-tour-is-visible': tour.show, 'tabbing-active':tabbingActive}" ng-controller="Umbraco.MainController" id="umbracoMainPageBody">
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<meta name="pinterest" content="nopin" />
|
||||
|
||||
@Html.RenderCssHere(
|
||||
new BasicPath("Umbraco", Current.IOHelper.ResolveUrl(Current.IOHelper.Umbraco)))
|
||||
new BasicPath("Umbraco", Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoPath)))
|
||||
|
||||
</head>
|
||||
<body id="canvasdesignerPanel" ng-mouseover="outlinePositionHide()" ng-controller="previewController">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="True" Inherits="Umbraco.Web.UI.Config.Splashes.NoNodes" CodeBehind="NoNodes.aspx.cs" %>
|
||||
<%@ Import Namespace="Umbraco.Core" %>
|
||||
<%@ Import Namespace="Umbraco.Core.Composing" %>
|
||||
<%@ Import Namespace="Umbraco.Core.Configuration" %>
|
||||
<%@ Import Namespace="Umbraco.Core.IO" %>
|
||||
@@ -31,7 +32,7 @@
|
||||
<h3>You're seeing this wonderful page because your website doesn't contain any published content yet.</h3>
|
||||
|
||||
<div class="cta">
|
||||
<a href="<%= Current.IOHelper.ResolveUrl(Current.IOHelper.Umbraco) %>" class="button">Open Umbraco</a>
|
||||
<a href="<%= Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoPath) %>" class="button">Open Umbraco</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Web.Mvc;
|
||||
@@ -11,7 +12,7 @@ namespace Umbraco.Web.Editors
|
||||
[PluginController("UmbracoApi")]
|
||||
public class BackOfficeAssetsController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
private readonly IFileSystem _jsLibFileSystem = new PhysicalFileSystem(Current.IOHelper.Umbraco + Current.IOHelper.DirSepChar + "lib");
|
||||
private readonly IFileSystem _jsLibFileSystem = new PhysicalFileSystem(Current.Configs.Global().UmbracoPath + Current.IOHelper.DirSepChar + "lib");
|
||||
|
||||
[HttpGet]
|
||||
public object GetSupportedLocales()
|
||||
|
||||
@@ -320,7 +320,7 @@ namespace Umbraco.Web.Editors
|
||||
"umbracoSettings", new Dictionary<string, object>
|
||||
{
|
||||
{"umbracoPath", _globalSettings.Path},
|
||||
{"mediaPath", Current.IOHelper.ResolveUrl(Current.IOHelper.Media).TrimEnd('/')},
|
||||
{"mediaPath", Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoMediaPath).TrimEnd('/')},
|
||||
{"appPluginsPath", Current.IOHelper.ResolveUrl(Constants.SystemDirectories.AppPlugins).TrimEnd('/')},
|
||||
{
|
||||
"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(Current.IOHelper.Css).TrimEnd('/')},
|
||||
{"cssPath", Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoCssPath).TrimEnd('/')},
|
||||
{"allowPasswordReset", Current.Configs.Settings().Security.AllowPasswordReset},
|
||||
{"loginBackgroundImage", Current.Configs.Settings().Content.LoginBackgroundImage},
|
||||
{"showUserInvite", EmailSender.CanSendRequiredEmail},
|
||||
|
||||
@@ -118,11 +118,11 @@ namespace Umbraco.Web.Editors
|
||||
Services.FileService.CreatePartialViewMacroFolder(virtualPath);
|
||||
break;
|
||||
case Core.Constants.Trees.Scripts:
|
||||
virtualPath = NormalizeVirtualPath(name, Current.IOHelper.Scripts);
|
||||
virtualPath = NormalizeVirtualPath(name, Current.Configs.Global().UmbracoScriptsPath);
|
||||
Services.FileService.CreateScriptFolder(virtualPath);
|
||||
break;
|
||||
case Core.Constants.Trees.Stylesheets:
|
||||
virtualPath = NormalizeVirtualPath(name, Current.IOHelper.Css);
|
||||
virtualPath = NormalizeVirtualPath(name, Current.Configs.Global().UmbracoCssPath);
|
||||
Services.FileService.CreateStyleSheetFolder(virtualPath);
|
||||
break;
|
||||
|
||||
@@ -262,11 +262,11 @@ namespace Umbraco.Web.Editors
|
||||
break;
|
||||
case Core.Constants.Trees.Scripts:
|
||||
codeFileDisplay = Mapper.Map<Script, CodeFileDisplay>(new Script(string.Empty));
|
||||
codeFileDisplay.VirtualPath = Current.IOHelper.Scripts;
|
||||
codeFileDisplay.VirtualPath = Current.Configs.Global().UmbracoScriptsPath;
|
||||
break;
|
||||
case Core.Constants.Trees.Stylesheets:
|
||||
codeFileDisplay = Mapper.Map<Stylesheet, CodeFileDisplay>(new Stylesheet(string.Empty));
|
||||
codeFileDisplay.VirtualPath = Current.IOHelper.Css;
|
||||
codeFileDisplay.VirtualPath = Current.Configs.Global().UmbracoCssPath;
|
||||
break;
|
||||
default:
|
||||
throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Unsupported editortype"));
|
||||
@@ -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, Current.IOHelper.Scripts))
|
||||
if (IsDirectory(virtualPath, Current.Configs.Global().UmbracoScriptsPath))
|
||||
{
|
||||
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, Current.IOHelper.Css))
|
||||
if (IsDirectory(virtualPath, Current.Configs.Global().UmbracoCssPath))
|
||||
{
|
||||
Services.FileService.DeleteStyleSheetFolder(virtualPath);
|
||||
return Request.CreateResponse(HttpStatusCode.OK);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Services;
|
||||
@@ -60,24 +61,24 @@ namespace Umbraco.Web.HealthCheck.Checks.Permissions
|
||||
// in ALL circumstances or just some
|
||||
var pathsToCheck = new Dictionary<string, PermissionCheckRequirement>
|
||||
{
|
||||
{ Core.Constants.SystemDirectories.Data, PermissionCheckRequirement.Required },
|
||||
{ Core.Constants.SystemDirectories.Packages, PermissionCheckRequirement.Required},
|
||||
{ Core.Constants.SystemDirectories.Preview, PermissionCheckRequirement.Required },
|
||||
{ Core.Constants.SystemDirectories.AppPlugins, PermissionCheckRequirement.Required },
|
||||
{ Core.Constants.SystemDirectories.Config, PermissionCheckRequirement.Optional },
|
||||
{ Current.IOHelper.Css, PermissionCheckRequirement.Optional },
|
||||
{ Current.IOHelper.Media, PermissionCheckRequirement.Optional },
|
||||
{ Current.IOHelper.Scripts, PermissionCheckRequirement.Optional },
|
||||
{ Current.IOHelper.Umbraco, PermissionCheckRequirement.Optional },
|
||||
{ Core.Constants.SystemDirectories.MvcViews, PermissionCheckRequirement.Optional }
|
||||
{ Constants.SystemDirectories.Data, PermissionCheckRequirement.Required },
|
||||
{ Constants.SystemDirectories.Packages, PermissionCheckRequirement.Required},
|
||||
{ Constants.SystemDirectories.Preview, PermissionCheckRequirement.Required },
|
||||
{ Constants.SystemDirectories.AppPlugins, PermissionCheckRequirement.Required },
|
||||
{ Constants.SystemDirectories.Config, PermissionCheckRequirement.Optional },
|
||||
{ Current.Configs.Global().UmbracoCssPath, PermissionCheckRequirement.Optional },
|
||||
{ Current.Configs.Global().UmbracoMediaPath, PermissionCheckRequirement.Optional },
|
||||
{ Current.Configs.Global().UmbracoScriptsPath, PermissionCheckRequirement.Optional },
|
||||
{ Current.Configs.Global().UmbracoPath, PermissionCheckRequirement.Optional },
|
||||
{ Constants.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<string, PermissionCheckRequirement>
|
||||
{
|
||||
{ Core.Constants.SystemDirectories.AppCode, PermissionCheckRequirement.Optional },
|
||||
{ Core.Constants.SystemDirectories.Bin, PermissionCheckRequirement.Optional }
|
||||
{ Constants.SystemDirectories.AppCode, PermissionCheckRequirement.Optional },
|
||||
{ Constants.SystemDirectories.Bin, PermissionCheckRequirement.Optional }
|
||||
};
|
||||
|
||||
// Run checks for required and optional paths for modify permission
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Umbraco.Web
|
||||
{
|
||||
var htmlBadge =
|
||||
String.Format(Current.Configs.Settings().Content.PreviewBadge,
|
||||
Current.IOHelper.ResolveUrl(Current.IOHelper.Umbraco),
|
||||
Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoPath),
|
||||
Current.UmbracoContext.HttpContext.Server.UrlEncode(Current.UmbracoContext.HttpContext.Request.Path));
|
||||
return new MvcHtmlString(htmlBadge);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Umbraco.Web.Install.Controllers
|
||||
public ActionResult Index()
|
||||
{
|
||||
if (_runtime.Level == RuntimeLevel.Run)
|
||||
return Redirect(Current.IOHelper.Umbraco.EnsureEndsWith('/'));
|
||||
return Redirect(Current.Configs.Global().UmbracoPath.EnsureEndsWith('/'));
|
||||
|
||||
if (_runtime.Level == RuntimeLevel.Upgrade)
|
||||
{
|
||||
@@ -58,7 +58,7 @@ namespace Umbraco.Web.Install.Controllers
|
||||
{
|
||||
case ValidateRequestAttempt.FailedNoPrivileges:
|
||||
case ValidateRequestAttempt.FailedNoContextId:
|
||||
return Redirect(Current.IOHelper.Umbraco + "/AuthorizeUpgrade?redir=" + Server.UrlEncode(Request.RawUrl));
|
||||
return Redirect(Current.Configs.Global().UmbracoPath + "/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(Current.IOHelper.Umbraco));
|
||||
ViewData.SetUmbracoBaseFolder(Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoPath));
|
||||
|
||||
_installHelper.InstallStatus(false, "");
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace Umbraco.Web.Install
|
||||
internal class FilePermissionHelper
|
||||
{
|
||||
// ensure that these directories exist and Umbraco can write to them
|
||||
private static readonly string[] PermissionDirs = { Current.IOHelper.Css, Constants.SystemDirectories.Config, Constants.SystemDirectories.Data, Current.IOHelper.Media, Constants.SystemDirectories.Preview };
|
||||
private static readonly string[] PackagesPermissionsDirs = { Constants.SystemDirectories.Bin, Current.IOHelper.Umbraco, Constants.SystemDirectories.Packages };
|
||||
private static readonly string[] PermissionDirs = { Current.Configs.Global().UmbracoCssPath, Constants.SystemDirectories.Config, Constants.SystemDirectories.Data, Current.Configs.Global().UmbracoMediaPath, Constants.SystemDirectories.Preview };
|
||||
private static readonly string[] PackagesPermissionsDirs = { Constants.SystemDirectories.Bin, Current.Configs.Global().UmbracoPath, Constants.SystemDirectories.Packages };
|
||||
|
||||
// ensure Umbraco can write to these files (the directories must exist)
|
||||
private static readonly string[] PermissionFiles = { };
|
||||
@@ -36,7 +36,7 @@ namespace Umbraco.Web.Install
|
||||
if (TestPublishedSnapshotService(out errors) == false)
|
||||
report["Published snapshot environment check failed"] = errors.ToList();
|
||||
|
||||
if (EnsureCanCreateSubDirectory(Current.IOHelper.Media, out errors) == false)
|
||||
if (EnsureCanCreateSubDirectory(Current.Configs.Global().UmbracoMediaPath, out errors) == false)
|
||||
report["Media folder creation failed"] = errors.ToList();
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Umbraco.Web.Install
|
||||
/// <param name="filterContext"></param>
|
||||
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
|
||||
{
|
||||
filterContext.Result = new RedirectResult(Current.IOHelper.Umbraco.EnsureEndsWith('/'));
|
||||
filterContext.Result = new RedirectResult(Current.Configs.Global().UmbracoPath.EnsureEndsWith('/'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Web;
|
||||
using ClientDependency.Core;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Manifest;
|
||||
@@ -58,7 +59,7 @@ namespace Umbraco.Web.JavaScript
|
||||
}
|
||||
jarray.Append("]");
|
||||
|
||||
return WriteScript(jarray.ToString(), Current.IOHelper.ResolveUrl(Current.IOHelper.Umbraco), angularModule);
|
||||
return WriteScript(jarray.ToString(), Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoPath), angularModule);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Web.UI;
|
||||
using ClientDependency.Core.Controls;
|
||||
using ClientDependency.Core.FileRegistration.Providers;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
@@ -18,7 +19,7 @@ namespace Umbraco.Web.JavaScript
|
||||
public UmbracoClientDependencyLoader()
|
||||
: base()
|
||||
{
|
||||
this.AddPath("UmbracoRoot", Current.IOHelper.ResolveUrl(Current.IOHelper.Umbraco));
|
||||
this.AddPath("UmbracoRoot", Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoPath));
|
||||
this.ProviderName = LoaderControlProvider.DefaultName;
|
||||
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ namespace Umbraco.Web.Mvc
|
||||
// creating previewBadge markup
|
||||
markupToInject =
|
||||
string.Format(Current.Configs.Settings().Content.PreviewBadge,
|
||||
Current.IOHelper.ResolveUrl(Current.IOHelper.Umbraco),
|
||||
Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoPath),
|
||||
Server.UrlEncode(Current.UmbracoContext.HttpContext.Request.Url?.PathAndQuery));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace Umbraco.Web.Security
|
||||
|
||||
private static bool RequestIsInUmbracoApplication(HttpContextBase context)
|
||||
{
|
||||
return context.Request.Path.ToLower().IndexOf(Current.IOHelper.ResolveUrl(Current.IOHelper.Umbraco).ToLower(), StringComparison.Ordinal) > -1;
|
||||
return context.Request.Path.ToLower().IndexOf(Current.IOHelper.ResolveUrl(Current.Configs.Global().UmbracoPath).ToLower(), StringComparison.Ordinal) > -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user