diff --git a/src/Umbraco.Configuration/ConfigsFactory.cs b/src/Umbraco.Configuration/ConfigsFactory.cs index fea0c23f29..c09dc7b9f6 100644 --- a/src/Umbraco.Configuration/ConfigsFactory.cs +++ b/src/Umbraco.Configuration/ConfigsFactory.cs @@ -7,11 +7,6 @@ namespace Umbraco.Core.Configuration { public class ConfigsFactory : IConfigsFactory { - - public ConfigsFactory() - { - } - public IHostingSettings HostingSettings { get; } = new HostingSettings(); public ICoreDebug CoreDebug { get; } = new CoreDebug(); @@ -32,7 +27,7 @@ namespace Umbraco.Core.Configuration configs.AddPasswordConfigurations(); configs.Add(() => CoreDebug); - configs.Add(() => new ConnectionStrings()); + configs.Add(() => new ConnectionStrings(ioHelper)); configs.AddCoreConfigs(ioHelper); return configs; } diff --git a/src/Umbraco.Configuration/ConnectionStrings.cs b/src/Umbraco.Configuration/ConnectionStrings.cs index 707f58c7b7..6a00974831 100644 --- a/src/Umbraco.Configuration/ConnectionStrings.cs +++ b/src/Umbraco.Configuration/ConnectionStrings.cs @@ -8,6 +8,13 @@ namespace Umbraco.Core.Configuration { public class ConnectionStrings : IConnectionStrings { + private readonly IIOHelper _ioHelper; + + public ConnectionStrings(IIOHelper ioHelper) + { + _ioHelper = ioHelper; + } + public ConfigConnectionString this[string key] { get @@ -17,5 +24,22 @@ namespace Umbraco.Core.Configuration return new ConfigConnectionString(settings.ConnectionString, settings.ProviderName, settings.Name); } } + + public void RemoveConnectionString(string key) + { + var fileName = _ioHelper.MapPath(string.Format("{0}/web.config", _ioHelper.Root)); + var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace); + + var appSettings = xml.Root.DescendantsAndSelf("appSettings").Single(); + var setting = appSettings.Descendants("add").FirstOrDefault(s => s.Attribute("key").Value == key); + + if (setting != null) + { + setting.Remove(); + xml.Save(fileName, SaveOptions.DisableFormatting); + ConfigurationManager.RefreshSection("appSettings"); + } + var settings = ConfigurationManager.ConnectionStrings[key]; + } } } diff --git a/src/Umbraco.Configuration/GlobalSettings.cs b/src/Umbraco.Configuration/GlobalSettings.cs index 6cd1ea58a5..a44f7ae636 100644 --- a/src/Umbraco.Configuration/GlobalSettings.cs +++ b/src/Umbraco.Configuration/GlobalSettings.cs @@ -254,27 +254,7 @@ namespace Umbraco.Core.Configuration ConfigurationManager.RefreshSection("appSettings"); } - /// - /// Removes a setting from the configuration file. - /// - /// Key of the setting to be removed. - public static void RemoveSetting(string key, IIOHelper ioHelper) - { - var fileName = ioHelper.MapPath(string.Format("{0}/web.config", ioHelper.Root)); - var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace); - - var appSettings = xml.Root.DescendantsAndSelf("appSettings").Single(); - var setting = appSettings.Descendants("add").FirstOrDefault(s => s.Attribute("key").Value == key); - - if (setting != null) - { - setting.Remove(); - xml.Save(fileName, SaveOptions.DisableFormatting); - ConfigurationManager.RefreshSection("appSettings"); - } - } - - + /// /// Gets the time out in minutes. /// diff --git a/src/Umbraco.Core/Configuration/IConnectionStrings.cs b/src/Umbraco.Core/Configuration/IConnectionStrings.cs index 0d33378669..acd2281a1e 100644 --- a/src/Umbraco.Core/Configuration/IConnectionStrings.cs +++ b/src/Umbraco.Core/Configuration/IConnectionStrings.cs @@ -6,5 +6,7 @@ namespace Umbraco.Core.Configuration { get; } + + void RemoveConnectionString(string umbracoConnectionName); } } diff --git a/src/Umbraco.Core/Cookie/ICookieManager.cs b/src/Umbraco.Core/Cookie/ICookieManager.cs index 4822d8ce74..af0ee7b1f6 100644 --- a/src/Umbraco.Core/Cookie/ICookieManager.cs +++ b/src/Umbraco.Core/Cookie/ICookieManager.cs @@ -2,6 +2,9 @@ namespace Umbraco.Core.Cookie { public interface ICookieManager { - void ExpireCookie(string angularCookieName); + void ExpireCookie(string cookieName); + string GetCookieValue(string cookieName); + void SetCookieValue(string cookieName, string value); + bool HasCookie(string cookieName); } } diff --git a/src/Umbraco.Web/Editors/EditorModelEventArgs.cs b/src/Umbraco.Core/Editors/EditorModelEventArgs.cs similarity index 100% rename from src/Umbraco.Web/Editors/EditorModelEventArgs.cs rename to src/Umbraco.Core/Editors/EditorModelEventArgs.cs diff --git a/src/Umbraco.Web/Editors/EditorValidatorCollection.cs b/src/Umbraco.Core/Editors/EditorValidatorCollection.cs similarity index 100% rename from src/Umbraco.Web/Editors/EditorValidatorCollection.cs rename to src/Umbraco.Core/Editors/EditorValidatorCollection.cs diff --git a/src/Umbraco.Web/Editors/EditorValidatorCollectionBuilder.cs b/src/Umbraco.Core/Editors/EditorValidatorCollectionBuilder.cs similarity index 100% rename from src/Umbraco.Web/Editors/EditorValidatorCollectionBuilder.cs rename to src/Umbraco.Core/Editors/EditorValidatorCollectionBuilder.cs diff --git a/src/Umbraco.Web/Editors/EditorValidatorOfT.cs b/src/Umbraco.Core/Editors/EditorValidatorOfT.cs similarity index 100% rename from src/Umbraco.Web/Editors/EditorValidatorOfT.cs rename to src/Umbraco.Core/Editors/EditorValidatorOfT.cs diff --git a/src/Umbraco.Web/Editors/IEditorValidator.cs b/src/Umbraco.Core/Editors/IEditorValidator.cs similarity index 100% rename from src/Umbraco.Web/Editors/IEditorValidator.cs rename to src/Umbraco.Core/Editors/IEditorValidator.cs diff --git a/src/Umbraco.Web/Features/DisabledFeatures.cs b/src/Umbraco.Core/Features/DisabledFeatures.cs similarity index 82% rename from src/Umbraco.Web/Features/DisabledFeatures.cs rename to src/Umbraco.Core/Features/DisabledFeatures.cs index 62fb019c70..9bd091a570 100644 --- a/src/Umbraco.Web/Features/DisabledFeatures.cs +++ b/src/Umbraco.Core/Features/DisabledFeatures.cs @@ -1,5 +1,4 @@ using Umbraco.Core.Collections; -using Umbraco.Web.WebApi; namespace Umbraco.Web.Features { @@ -13,19 +12,19 @@ namespace Umbraco.Web.Features /// public DisabledFeatures() { - Controllers = new TypeList(); + Controllers = new TypeList(); } /// /// Gets the disabled controllers. /// - public TypeList Controllers { get; } + public TypeList Controllers { get; } /// /// Disables the device preview feature of previewing. /// public bool DisableDevicePreview { get; set; } - + /// /// If true, all references to templates will be removed in the back office and routing /// diff --git a/src/Umbraco.Web/Features/EnabledFeatures.cs b/src/Umbraco.Core/Features/EnabledFeatures.cs similarity index 100% rename from src/Umbraco.Web/Features/EnabledFeatures.cs rename to src/Umbraco.Core/Features/EnabledFeatures.cs diff --git a/src/Umbraco.Core/Features/IUmbracoFeature.cs b/src/Umbraco.Core/Features/IUmbracoFeature.cs new file mode 100644 index 0000000000..ccb80b0a9f --- /dev/null +++ b/src/Umbraco.Core/Features/IUmbracoFeature.cs @@ -0,0 +1,10 @@ +namespace Umbraco.Web.Features +{ + /// + /// This is a marker interface to allow controllers to be disabled if also marked with FeatureAuthorizeAttribute. + /// + public interface IUmbracoFeature + { + + } +} diff --git a/src/Umbraco.Web/Features/UmbracoFeatures.cs b/src/Umbraco.Core/Features/UmbracoFeatures.cs similarity index 90% rename from src/Umbraco.Web/Features/UmbracoFeatures.cs rename to src/Umbraco.Core/Features/UmbracoFeatures.cs index d1c3899271..69fe58f76d 100644 --- a/src/Umbraco.Web/Features/UmbracoFeatures.cs +++ b/src/Umbraco.Core/Features/UmbracoFeatures.cs @@ -1,5 +1,4 @@ using System; -using Umbraco.Web.WebApi; namespace Umbraco.Web.Features { @@ -16,7 +15,7 @@ namespace Umbraco.Web.Features Disabled = new DisabledFeatures(); Enabled = new EnabledFeatures(); } - + /// /// Gets the disabled features. /// @@ -32,7 +31,7 @@ namespace Umbraco.Web.Features /// internal bool IsControllerEnabled(Type feature) { - if (typeof(UmbracoApiControllerBase).IsAssignableFrom(feature)) + if (typeof(IUmbracoFeature).IsAssignableFrom(feature)) return Disabled.Controllers.Contains(feature) == false; throw new NotSupportedException("Not a supported feature type."); diff --git a/src/Umbraco.Core/IO/IIOHelper.cs b/src/Umbraco.Core/IO/IIOHelper.cs index e8ef6d2973..11f5c6c565 100644 --- a/src/Umbraco.Core/IO/IIOHelper.cs +++ b/src/Umbraco.Core/IO/IIOHelper.cs @@ -75,5 +75,6 @@ namespace Umbraco.Core.IO get; set; //Only required for unit tests } + } } diff --git a/src/Umbraco.Core/IO/IOHelperExtensions.cs b/src/Umbraco.Core/IO/IOHelperExtensions.cs new file mode 100644 index 0000000000..64b57e7dc1 --- /dev/null +++ b/src/Umbraco.Core/IO/IOHelperExtensions.cs @@ -0,0 +1,39 @@ +using System; +using System.IO; + +namespace Umbraco.Core.IO +{ + public static class IOHelperExtensions + { + /// + /// Tries to create a directory. + /// + /// The IOHelper. + /// the directory path. + /// true if the directory was created, false otherwise. + public static bool TryCreateDirectory(this IIOHelper ioHelper, string dir) + { + try + { + var dirPath = ioHelper.MapPath(dir); + + if (Directory.Exists(dirPath) == false) + Directory.CreateDirectory(dirPath); + + var filePath = dirPath + "/" + CreateRandomFileName(ioHelper) + ".tmp"; + File.WriteAllText(filePath, "This is an Umbraco internal test file. It is safe to delete it."); + File.Delete(filePath); + return true; + } + catch + { + return false; + } + } + + public static string CreateRandomFileName(this IIOHelper ioHelper) + { + return "umbraco-test." + Guid.NewGuid().ToString("N").Substring(0, 8); + } + } +} diff --git a/src/Umbraco.Web/IUmbracoContextFactory.cs b/src/Umbraco.Core/IUmbracoContextFactory.cs similarity index 100% rename from src/Umbraco.Web/IUmbracoContextFactory.cs rename to src/Umbraco.Core/IUmbracoContextFactory.cs diff --git a/src/Umbraco.Core/Install/IFilePermissionHelper.cs b/src/Umbraco.Core/Install/IFilePermissionHelper.cs index 90f550f2c9..b60839cb00 100644 --- a/src/Umbraco.Core/Install/IFilePermissionHelper.cs +++ b/src/Umbraco.Core/Install/IFilePermissionHelper.cs @@ -7,10 +7,5 @@ namespace Umbraco.Core.Install bool RunFilePermissionTestSuite(out Dictionary> report); bool EnsureDirectories(string[] dirs, out IEnumerable errors, bool writeCausesRestart = false); bool EnsureFiles(string[] files, out IEnumerable errors); - bool EnsureCanCreateSubDirectory(string dir, out IEnumerable errors); - bool EnsureCanCreateSubDirectories(IEnumerable dirs, out IEnumerable errors); - bool TestPublishedSnapshotService(out IEnumerable errors); - bool TryCreateDirectory(string dir); - bool TryAccessDirectory(string dir, bool canWrite); } } diff --git a/src/Umbraco.Web/Install/InstallException.cs b/src/Umbraco.Core/Install/InstallException.cs similarity index 100% rename from src/Umbraco.Web/Install/InstallException.cs rename to src/Umbraco.Core/Install/InstallException.cs diff --git a/src/Umbraco.Web/Install/InstallStatusTracker.cs b/src/Umbraco.Core/Install/InstallStatusTracker.cs similarity index 69% rename from src/Umbraco.Web/Install/InstallStatusTracker.cs rename to src/Umbraco.Core/Install/InstallStatusTracker.cs index 58e8507ec8..c0c9a696fd 100644 --- a/src/Umbraco.Web/Install/InstallStatusTracker.cs +++ b/src/Umbraco.Core/Install/InstallStatusTracker.cs @@ -2,10 +2,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using Newtonsoft.Json; using Umbraco.Core; using Umbraco.Core.Collections; -using Umbraco.Web.Composing; +using Umbraco.Core.IO; +using Umbraco.Core.Serialization; using Umbraco.Web.Install.Models; namespace Umbraco.Web.Install @@ -13,29 +13,37 @@ namespace Umbraco.Web.Install /// /// An internal in-memory status tracker for the current installation /// - internal static class InstallStatusTracker + public class InstallStatusTracker { + private readonly IIOHelper _ioHelper; + private readonly IJsonSerializer _jsonSerializer; + + public InstallStatusTracker(IIOHelper ioHelper, IJsonSerializer jsonSerializer) + { + _ioHelper = ioHelper; + _jsonSerializer = jsonSerializer; + } private static ConcurrentHashSet _steps = new ConcurrentHashSet(); - private static string GetFile(Guid installId) + private string GetFile(Guid installId) { - var file = Current.IOHelper.MapPath(Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "Install/" - + "install_" - + installId.ToString("N") - + ".txt"); + var file = _ioHelper.MapPath(Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "Install/" + + "install_" + + installId.ToString("N") + + ".txt"); return file; } - public static void Reset() + public void Reset() { _steps = new ConcurrentHashSet(); ClearFiles(); } - public static void ClearFiles() + public void ClearFiles() { - var dir = Current.IOHelper.MapPath(Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "Install/"); + var dir = _ioHelper.MapPath(Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "Install/"); if (Directory.Exists(dir)) { var files = Directory.GetFiles(dir); @@ -50,13 +58,13 @@ namespace Umbraco.Web.Install } } - public static IEnumerable InitializeFromFile(Guid installId) + public IEnumerable InitializeFromFile(Guid installId) { //check if we have our persisted file and read it var file = GetFile(installId); if (File.Exists(file)) { - var deserialized = JsonConvert.DeserializeObject>( + var deserialized = _jsonSerializer.Deserialize>( File.ReadAllText(file)); foreach (var item in deserialized) { @@ -70,7 +78,7 @@ namespace Umbraco.Web.Install return new List(_steps); } - public static IEnumerable Initialize(Guid installId, IEnumerable steps) + public IEnumerable Initialize(Guid installId, IEnumerable steps) { //if there are no steps in memory if (_steps.Count == 0) @@ -79,7 +87,7 @@ namespace Umbraco.Web.Install var file = GetFile(installId); if (File.Exists(file)) { - var deserialized = JsonConvert.DeserializeObject>( + var deserialized = _jsonSerializer.Deserialize>( File.ReadAllText(file)); foreach (var item in deserialized) { @@ -96,7 +104,7 @@ namespace Umbraco.Web.Install _steps.Add(new InstallTrackingItem(step.Name, step.ServerOrder)); } //save the file - var serialized = JsonConvert.SerializeObject(new List(_steps)); + var serialized = _jsonSerializer.Serialize(new List(_steps)); Directory.CreateDirectory(Path.GetDirectoryName(file)); File.WriteAllText(file, serialized); } @@ -110,7 +118,7 @@ namespace Umbraco.Web.Install ClearFiles(); //save the correct file - var serialized = JsonConvert.SerializeObject(new List(_steps)); + var serialized = _jsonSerializer.Serialize(new List(_steps)); Directory.CreateDirectory(Path.GetDirectoryName(file)); File.WriteAllText(file, serialized); } @@ -119,7 +127,7 @@ namespace Umbraco.Web.Install return new List(_steps); } - public static void SetComplete(Guid installId, string name, IDictionary additionalData = null) + public void SetComplete(Guid installId, string name, IDictionary additionalData = null) { var trackingItem = _steps.Single(x => x.Name == name); if (additionalData != null) @@ -130,7 +138,7 @@ namespace Umbraco.Web.Install //save the file var file = GetFile(installId); - var serialized = JsonConvert.SerializeObject(new List(_steps)); + var serialized = _jsonSerializer.Serialize(new List(_steps)); File.WriteAllText(file, serialized); } diff --git a/src/Umbraco.Web/Install/InstallSteps/FilePermissionsStep.cs b/src/Umbraco.Core/Install/InstallSteps/FilePermissionsStep.cs similarity index 98% rename from src/Umbraco.Web/Install/InstallSteps/FilePermissionsStep.cs rename to src/Umbraco.Core/Install/InstallSteps/FilePermissionsStep.cs index b4be0b0a21..c3d7493084 100644 --- a/src/Umbraco.Web/Install/InstallSteps/FilePermissionsStep.cs +++ b/src/Umbraco.Core/Install/InstallSteps/FilePermissionsStep.cs @@ -4,7 +4,6 @@ using System.IO; using System.Threading.Tasks; using Umbraco.Core; using Umbraco.Core.Install; -using Umbraco.Core.IO; using Umbraco.Web.Install.Models; namespace Umbraco.Web.Install.InstallSteps diff --git a/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs b/src/Umbraco.Core/Install/InstallSteps/StarterKitCleanupStep.cs similarity index 100% rename from src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs rename to src/Umbraco.Core/Install/InstallSteps/StarterKitCleanupStep.cs diff --git a/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs b/src/Umbraco.Core/Install/InstallSteps/UpgradeStep.cs similarity index 84% rename from src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs rename to src/Umbraco.Core/Install/InstallSteps/UpgradeStep.cs index a59d7394f0..0979f31dc5 100644 --- a/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs +++ b/src/Umbraco.Core/Install/InstallSteps/UpgradeStep.cs @@ -1,6 +1,6 @@ using System; using System.Threading.Tasks; -using Umbraco.Web.Composing; +using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Web.Install.Models; @@ -14,10 +14,12 @@ namespace Umbraco.Web.Install.InstallSteps { public override bool RequiresExecution(object model) => true; private readonly IUmbracoVersion _umbracoVersion; + private readonly IRuntimeState _runtimeState; - public UpgradeStep(IUmbracoVersion umbracoVersion) + public UpgradeStep(IUmbracoVersion umbracoVersion, IRuntimeState runtimeState) { _umbracoVersion = umbracoVersion; + _runtimeState = runtimeState; } public override Task ExecuteAsync(object model) => Task.FromResult(null); @@ -43,9 +45,9 @@ namespace Umbraco.Web.Install.InstallSteps return value; } - var state = Current.RuntimeState; // TODO: inject - var currentState = FormatGuidState(state.CurrentMigrationState); - var newState = FormatGuidState(state.FinalMigrationState); + + var currentState = FormatGuidState(_runtimeState.CurrentMigrationState); + var newState = FormatGuidState(_runtimeState.FinalMigrationState); var reportUrl = $"https://our.umbraco.com/contribute/releases/compare?from={currentVersion}&to={newVersion}¬es=1"; diff --git a/src/Umbraco.Web/Install/Models/DatabaseModel.cs b/src/Umbraco.Core/Install/Models/DatabaseModel.cs similarity index 100% rename from src/Umbraco.Web/Install/Models/DatabaseModel.cs rename to src/Umbraco.Core/Install/Models/DatabaseModel.cs diff --git a/src/Umbraco.Web/Install/Models/DatabaseType.cs b/src/Umbraco.Core/Install/Models/DatabaseType.cs similarity index 100% rename from src/Umbraco.Web/Install/Models/DatabaseType.cs rename to src/Umbraco.Core/Install/Models/DatabaseType.cs diff --git a/src/Umbraco.Web/Install/Models/InstallInstructions.cs b/src/Umbraco.Core/Install/Models/InstallInstructions.cs similarity index 80% rename from src/Umbraco.Web/Install/Models/InstallInstructions.cs rename to src/Umbraco.Core/Install/Models/InstallInstructions.cs index da4dfb1671..159edda9e6 100644 --- a/src/Umbraco.Web/Install/Models/InstallInstructions.cs +++ b/src/Umbraco.Core/Install/Models/InstallInstructions.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Runtime.Serialization; -using Newtonsoft.Json.Linq; namespace Umbraco.Web.Install.Models { @@ -9,7 +8,7 @@ namespace Umbraco.Web.Install.Models public class InstallInstructions { [DataMember(Name = "instructions")] - public IDictionary Instructions { get; set; } + public IDictionary Instructions { get; set; } [DataMember(Name = "installId")] public Guid InstallId { get; set; } diff --git a/src/Umbraco.Web/Install/Models/InstallProgressResultModel.cs b/src/Umbraco.Core/Install/Models/InstallProgressResultModel.cs similarity index 100% rename from src/Umbraco.Web/Install/Models/InstallProgressResultModel.cs rename to src/Umbraco.Core/Install/Models/InstallProgressResultModel.cs diff --git a/src/Umbraco.Web/Install/Models/InstallSetup.cs b/src/Umbraco.Core/Install/Models/InstallSetup.cs similarity index 100% rename from src/Umbraco.Web/Install/Models/InstallSetup.cs rename to src/Umbraco.Core/Install/Models/InstallSetup.cs diff --git a/src/Umbraco.Web/Install/Models/InstallSetupResult.cs b/src/Umbraco.Core/Install/Models/InstallSetupResult.cs similarity index 100% rename from src/Umbraco.Web/Install/Models/InstallSetupResult.cs rename to src/Umbraco.Core/Install/Models/InstallSetupResult.cs diff --git a/src/Umbraco.Web/Install/Models/InstallSetupStep.cs b/src/Umbraco.Core/Install/Models/InstallSetupStep.cs similarity index 100% rename from src/Umbraco.Web/Install/Models/InstallSetupStep.cs rename to src/Umbraco.Core/Install/Models/InstallSetupStep.cs diff --git a/src/Umbraco.Web/Install/Models/InstallSetupStepAttribute.cs b/src/Umbraco.Core/Install/Models/InstallSetupStepAttribute.cs similarity index 100% rename from src/Umbraco.Web/Install/Models/InstallSetupStepAttribute.cs rename to src/Umbraco.Core/Install/Models/InstallSetupStepAttribute.cs diff --git a/src/Umbraco.Web/Install/Models/InstallTrackingItem.cs b/src/Umbraco.Core/Install/Models/InstallTrackingItem.cs similarity index 96% rename from src/Umbraco.Web/Install/Models/InstallTrackingItem.cs rename to src/Umbraco.Core/Install/Models/InstallTrackingItem.cs index 1b1985dd1e..9bc8201ba9 100644 --- a/src/Umbraco.Web/Install/Models/InstallTrackingItem.cs +++ b/src/Umbraco.Core/Install/Models/InstallTrackingItem.cs @@ -3,7 +3,7 @@ using System.Runtime.Serialization; namespace Umbraco.Web.Install.Models { - internal class InstallTrackingItem + public class InstallTrackingItem { public InstallTrackingItem(string name, int serverOrder) { diff --git a/src/Umbraco.Web/Install/Models/InstallationType.cs b/src/Umbraco.Core/Install/Models/InstallationType.cs similarity index 100% rename from src/Umbraco.Web/Install/Models/InstallationType.cs rename to src/Umbraco.Core/Install/Models/InstallationType.cs diff --git a/src/Umbraco.Web/Install/Models/Package.cs b/src/Umbraco.Core/Install/Models/Package.cs similarity index 100% rename from src/Umbraco.Web/Install/Models/Package.cs rename to src/Umbraco.Core/Install/Models/Package.cs diff --git a/src/Umbraco.Web/Install/Models/UserModel.cs b/src/Umbraco.Core/Install/Models/UserModel.cs similarity index 100% rename from src/Umbraco.Web/Install/Models/UserModel.cs rename to src/Umbraco.Core/Install/Models/UserModel.cs diff --git a/src/Umbraco.Core/MediaTypeExtensions.cs b/src/Umbraco.Core/MediaTypeExtensions.cs index 4e2ae5822a..3a2a3ba6e2 100644 --- a/src/Umbraco.Core/MediaTypeExtensions.cs +++ b/src/Umbraco.Core/MediaTypeExtensions.cs @@ -1,8 +1,8 @@ namespace Umbraco.Core.Models { - internal static class MediaTypeExtensions + public static class MediaTypeExtensions { - internal static bool IsSystemMediaType(this IMediaType mediaType) => + public static bool IsSystemMediaType(this IMediaType mediaType) => mediaType.Alias == Constants.Conventions.MediaTypes.File || mediaType.Alias == Constants.Conventions.MediaTypes.Folder || mediaType.Alias == Constants.Conventions.MediaTypes.Image; diff --git a/src/Umbraco.Core/Models/ContentEditing/Permission.cs b/src/Umbraco.Core/Models/ContentEditing/Permission.cs index 7b444e5959..2bb905200a 100644 --- a/src/Umbraco.Core/Models/ContentEditing/Permission.cs +++ b/src/Umbraco.Core/Models/ContentEditing/Permission.cs @@ -22,7 +22,7 @@ namespace Umbraco.Web.Models.ContentEditing /// We'll use this to map the categories but it wont' be returned in the json /// [IgnoreDataMember] - internal string Category { get; set; } + public string Category { get; set; } /// /// The letter from the IAction diff --git a/src/Umbraco.Core/Models/DataTypeExtensions.cs b/src/Umbraco.Core/Models/DataTypeExtensions.cs index c2116c6c45..4f4bd4d6c3 100644 --- a/src/Umbraco.Core/Models/DataTypeExtensions.cs +++ b/src/Umbraco.Core/Models/DataTypeExtensions.cs @@ -75,7 +75,7 @@ namespace Umbraco.Core.Models /// /// The data type definition. /// - internal static bool IsBuildInDataType(this IDataType dataType) + public static bool IsBuildInDataType(this IDataType dataType) { return IsBuildInDataType(dataType.Key); } @@ -83,7 +83,7 @@ namespace Umbraco.Core.Models /// /// Returns true if this date type is build-in/default. /// - internal static bool IsBuildInDataType(Guid key) + public static bool IsBuildInDataType(Guid key) { return IdsOfBuildInDataTypes.Contains(key); } diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicMapper.cs b/src/Umbraco.Core/Models/Mapping/ContentPropertyBasicMapper.cs similarity index 100% rename from src/Umbraco.Web/Models/Mapping/ContentPropertyBasicMapper.cs rename to src/Umbraco.Core/Models/Mapping/ContentPropertyBasicMapper.cs diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayMapper.cs b/src/Umbraco.Core/Models/Mapping/ContentPropertyDisplayMapper.cs similarity index 100% rename from src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayMapper.cs rename to src/Umbraco.Core/Models/Mapping/ContentPropertyDisplayMapper.cs diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyDtoMapper.cs b/src/Umbraco.Core/Models/Mapping/ContentPropertyDtoMapper.cs similarity index 100% rename from src/Umbraco.Web/Models/Mapping/ContentPropertyDtoMapper.cs rename to src/Umbraco.Core/Models/Mapping/ContentPropertyDtoMapper.cs diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyMapDefinition.cs b/src/Umbraco.Core/Models/Mapping/ContentPropertyMapDefinition.cs similarity index 100% rename from src/Umbraco.Web/Models/Mapping/ContentPropertyMapDefinition.cs rename to src/Umbraco.Core/Models/Mapping/ContentPropertyMapDefinition.cs diff --git a/src/Umbraco.Infrastructure/Models/Mapping/MapperContextExtensions.cs b/src/Umbraco.Core/Models/Mapping/MapperContextExtensions.cs similarity index 100% rename from src/Umbraco.Infrastructure/Models/Mapping/MapperContextExtensions.cs rename to src/Umbraco.Core/Models/Mapping/MapperContextExtensions.cs diff --git a/src/Umbraco.Web/PasswordConfigurationExtensions.cs b/src/Umbraco.Core/PasswordConfigurationExtensions.cs similarity index 96% rename from src/Umbraco.Web/PasswordConfigurationExtensions.cs rename to src/Umbraco.Core/PasswordConfigurationExtensions.cs index 1105fc31a7..be13b574ed 100644 --- a/src/Umbraco.Web/PasswordConfigurationExtensions.cs +++ b/src/Umbraco.Core/PasswordConfigurationExtensions.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Services; namespace Umbraco.Web { - internal static class PasswordConfigurationExtensions + public static class PasswordConfigurationExtensions { /// /// Returns the configuration of the membership provider used to configure change password editors diff --git a/src/Umbraco.Core/Properties/AssemblyInfo.cs b/src/Umbraco.Core/Properties/AssemblyInfo.cs index 6d5520f975..f129ca7731 100644 --- a/src/Umbraco.Core/Properties/AssemblyInfo.cs +++ b/src/Umbraco.Core/Properties/AssemblyInfo.cs @@ -8,7 +8,6 @@ using System.Runtime.InteropServices; // Umbraco Cms [assembly: InternalsVisibleTo("Umbraco.Web")] [assembly: InternalsVisibleTo("Umbraco.Web.UI")] -[assembly: InternalsVisibleTo("Umbraco.Examine")] [assembly: InternalsVisibleTo("Umbraco.ModelsBuilder.Embedded")] [assembly: InternalsVisibleTo("Umbraco.Tests")] diff --git a/src/Umbraco.Core/PublishedCache/IPublishedSnapshotService.cs b/src/Umbraco.Core/PublishedCache/IPublishedSnapshotService.cs index a1894c902c..b23c8ae10f 100644 --- a/src/Umbraco.Core/PublishedCache/IPublishedSnapshotService.cs +++ b/src/Umbraco.Core/PublishedCache/IPublishedSnapshotService.cs @@ -167,7 +167,7 @@ namespace Umbraco.Web.PublishedCache string StatusUrl { get; } - #endregion + #endregion void Collect(); } diff --git a/src/Umbraco.Core/Routing/DomainUtilities.cs b/src/Umbraco.Core/Routing/DomainUtilities.cs index 26801cfd27..c459ae4d14 100644 --- a/src/Umbraco.Core/Routing/DomainUtilities.cs +++ b/src/Umbraco.Core/Routing/DomainUtilities.cs @@ -344,7 +344,7 @@ namespace Umbraco.Web.Routing /// The current domain root node identifier, or null. /// The deepest wildcard Domain in the path, or null. /// Looks _under_ rootNodeId but not _at_ rootNodeId. - internal static Domain FindWildcardDomainInPath(IEnumerable domains, string path, int? rootNodeId) + public static Domain FindWildcardDomainInPath(IEnumerable domains, string path, int? rootNodeId) { var stopNodeId = rootNodeId ?? -1; diff --git a/src/Umbraco.Core/Scheduling/KeepAlive.cs b/src/Umbraco.Core/Scheduling/KeepAlive.cs index d1d9352ed6..c677c66b83 100644 --- a/src/Umbraco.Core/Scheduling/KeepAlive.cs +++ b/src/Umbraco.Core/Scheduling/KeepAlive.cs @@ -9,7 +9,7 @@ using Umbraco.Core.Sync; namespace Umbraco.Web.Scheduling { - internal class KeepAlive : RecurringTaskBase + public class KeepAlive : RecurringTaskBase { private readonly IRuntimeState _runtime; private readonly IKeepAliveSection _keepAliveSection; diff --git a/src/Umbraco.Core/Scheduling/TempFileCleanup.cs b/src/Umbraco.Core/Scheduling/TempFileCleanup.cs index 5d28bbfdb1..aefaf605db 100644 --- a/src/Umbraco.Core/Scheduling/TempFileCleanup.cs +++ b/src/Umbraco.Core/Scheduling/TempFileCleanup.cs @@ -10,7 +10,7 @@ namespace Umbraco.Web.Scheduling /// /// Used to cleanup temporary file locations /// - internal class TempFileCleanup : RecurringTaskBase + public class TempFileCleanup : RecurringTaskBase { private readonly DirectoryInfo[] _tempFolders; private readonly TimeSpan _age; diff --git a/src/Umbraco.Core/Sync/IBatchedDatabaseServerMessenger.cs b/src/Umbraco.Core/Sync/IBatchedDatabaseServerMessenger.cs new file mode 100644 index 0000000000..d63478ef96 --- /dev/null +++ b/src/Umbraco.Core/Sync/IBatchedDatabaseServerMessenger.cs @@ -0,0 +1,10 @@ +namespace Umbraco.Core.Sync +{ + /// + /// An implementation that works by storing messages in the database. + /// + public interface IBatchedDatabaseServerMessenger : IServerMessenger + { + void FlushBatch(); + } +} diff --git a/src/Umbraco.Web/Templates/ITemplateRenderer.cs b/src/Umbraco.Core/Templates/ITemplateRenderer.cs similarity index 100% rename from src/Umbraco.Web/Templates/ITemplateRenderer.cs rename to src/Umbraco.Core/Templates/ITemplateRenderer.cs diff --git a/src/Umbraco.Core/Trees/IMenuItemCollectionFactory.cs b/src/Umbraco.Core/Trees/IMenuItemCollectionFactory.cs new file mode 100644 index 0000000000..dc4c53bac9 --- /dev/null +++ b/src/Umbraco.Core/Trees/IMenuItemCollectionFactory.cs @@ -0,0 +1,17 @@ +using Umbraco.Web.Models.Trees; + +namespace Umbraco.Web.Trees +{ + + /// + /// Represents a factory to create . + /// + public interface IMenuItemCollectionFactory + { + /// + /// Creates an empty . + /// + /// An empty . + MenuItemCollection Create(); + } +} diff --git a/src/Umbraco.Web/Models/Trees/MenuItemCollection.cs b/src/Umbraco.Core/Trees/MenuItemCollection.cs similarity index 72% rename from src/Umbraco.Web/Models/Trees/MenuItemCollection.cs rename to src/Umbraco.Core/Trees/MenuItemCollection.cs index e6a75b15d4..84d46c0d11 100644 --- a/src/Umbraco.Web/Models/Trees/MenuItemCollection.cs +++ b/src/Umbraco.Core/Trees/MenuItemCollection.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Runtime.Serialization; +using Umbraco.Web.Actions; namespace Umbraco.Web.Models.Trees { @@ -9,17 +10,16 @@ namespace Umbraco.Web.Models.Trees [DataContract(Name = "menuItems", Namespace = "")] public class MenuItemCollection { - public static MenuItemCollection Empty => new MenuItemCollection(); + private readonly MenuItemList _menuItems; - private readonly MenuItemList _menuItems = new MenuItemList(); - - public MenuItemCollection() + public MenuItemCollection(ActionCollection actionCollection) { + _menuItems = new MenuItemList(actionCollection); } - public MenuItemCollection(IEnumerable items) + public MenuItemCollection(ActionCollection actionCollection, IEnumerable items) { - _menuItems = new MenuItemList(items); + _menuItems = new MenuItemList(actionCollection, items); } /// diff --git a/src/Umbraco.Core/Trees/MenuItemCollectionFactory.cs b/src/Umbraco.Core/Trees/MenuItemCollectionFactory.cs new file mode 100644 index 0000000000..0a8ea000e3 --- /dev/null +++ b/src/Umbraco.Core/Trees/MenuItemCollectionFactory.cs @@ -0,0 +1,21 @@ +using Umbraco.Web.Actions; +using Umbraco.Web.Models.Trees; + +namespace Umbraco.Web.Trees +{ + public class MenuItemCollectionFactory: IMenuItemCollectionFactory + { + private readonly ActionCollection _actionCollection; + + public MenuItemCollectionFactory(ActionCollection actionCollection) + { + _actionCollection = actionCollection; + } + + public MenuItemCollection Create() + { + return new MenuItemCollection(_actionCollection); + } + + } +} diff --git a/src/Umbraco.Web/Models/Trees/MenuItemList.cs b/src/Umbraco.Core/Trees/MenuItemList.cs similarity index 82% rename from src/Umbraco.Web/Models/Trees/MenuItemList.cs rename to src/Umbraco.Core/Trees/MenuItemList.cs index 7bfa5eca48..546fa0390f 100644 --- a/src/Umbraco.Web/Models/Trees/MenuItemList.cs +++ b/src/Umbraco.Core/Trees/MenuItemList.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using Umbraco.Core.Services; using Umbraco.Web.Actions; -using Umbraco.Web.Composing; namespace Umbraco.Web.Models.Trees { @@ -13,13 +12,17 @@ namespace Umbraco.Web.Models.Trees /// public class MenuItemList : List { - public MenuItemList() + private readonly ActionCollection _actionCollection; + + public MenuItemList(ActionCollection actionCollection) { + _actionCollection = actionCollection; } - public MenuItemList( IEnumerable items) + public MenuItemList(ActionCollection actionCollection, IEnumerable items) : base(items) { + _actionCollection = actionCollection; } /// @@ -44,7 +47,7 @@ namespace Umbraco.Web.Models.Trees private MenuItem CreateMenuItem(ILocalizedTextService textService, bool hasSeparator = false, bool opensDialog = false) where T : IAction { - var item = Current.Actions.GetAction(); + var item = _actionCollection.GetAction(); if (item == null) return null; var menuItem = new MenuItem(item, textService.Localize($"actions/{item.Alias}")) diff --git a/src/Umbraco.Examine.Lucene/Umbraco.Examine.Lucene.csproj b/src/Umbraco.Examine.Lucene/Umbraco.Examine.Lucene.csproj index 1e9d344530..932d6d318b 100644 --- a/src/Umbraco.Examine.Lucene/Umbraco.Examine.Lucene.csproj +++ b/src/Umbraco.Examine.Lucene/Umbraco.Examine.Lucene.csproj @@ -27,7 +27,6 @@ - diff --git a/src/Umbraco.Examine/Umbraco.Examine.csproj b/src/Umbraco.Examine/Umbraco.Examine.csproj deleted file mode 100644 index 5fbd34a4d1..0000000000 --- a/src/Umbraco.Examine/Umbraco.Examine.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - netstandard2.0 - Umbraco.Examine - Umbraco.Examine - 8 - - - - - - - - - - - - diff --git a/src/Umbraco.Web/Cache/DistributedCacheBinder.cs b/src/Umbraco.Infrastructure/Cache/DistributedCacheBinder.cs similarity index 98% rename from src/Umbraco.Web/Cache/DistributedCacheBinder.cs rename to src/Umbraco.Infrastructure/Cache/DistributedCacheBinder.cs index e56d2bfe88..92ed7de881 100644 --- a/src/Umbraco.Web/Cache/DistributedCacheBinder.cs +++ b/src/Umbraco.Infrastructure/Cache/DistributedCacheBinder.cs @@ -4,10 +4,8 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using Umbraco.Core; -using Umbraco.Core.Cache; using Umbraco.Core.Events; using Umbraco.Core.Logging; -using Umbraco.Core.Serialization; namespace Umbraco.Web.Cache { diff --git a/src/Umbraco.Web/Cache/DistributedCacheBinderComposer.cs b/src/Umbraco.Infrastructure/Cache/DistributedCacheBinderComposer.cs similarity index 100% rename from src/Umbraco.Web/Cache/DistributedCacheBinderComposer.cs rename to src/Umbraco.Infrastructure/Cache/DistributedCacheBinderComposer.cs diff --git a/src/Umbraco.Web/Cache/DistributedCacheBinder_Handlers.cs b/src/Umbraco.Infrastructure/Cache/DistributedCacheBinder_Handlers.cs similarity index 99% rename from src/Umbraco.Web/Cache/DistributedCacheBinder_Handlers.cs rename to src/Umbraco.Infrastructure/Cache/DistributedCacheBinder_Handlers.cs index b9de06c2d3..c0200933ab 100644 --- a/src/Umbraco.Web/Cache/DistributedCacheBinder_Handlers.cs +++ b/src/Umbraco.Infrastructure/Cache/DistributedCacheBinder_Handlers.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Umbraco.Core.Cache; using Umbraco.Core.Events; using Umbraco.Core.Logging; using Umbraco.Core.Models; @@ -9,7 +8,6 @@ using Umbraco.Core.Models.Membership; using Umbraco.Core.Services; using Umbraco.Core.Services.Changes; using Umbraco.Core.Services.Implement; -using Umbraco.Web.Services; namespace Umbraco.Web.Cache { diff --git a/src/Umbraco.Web/Editors/UserEditorAuthorizationHelper.cs b/src/Umbraco.Infrastructure/Editors/UserEditorAuthorizationHelper.cs similarity index 99% rename from src/Umbraco.Web/Editors/UserEditorAuthorizationHelper.cs rename to src/Umbraco.Infrastructure/Editors/UserEditorAuthorizationHelper.cs index 320580aaf9..63b5cc90dc 100644 --- a/src/Umbraco.Web/Editors/UserEditorAuthorizationHelper.cs +++ b/src/Umbraco.Infrastructure/Editors/UserEditorAuthorizationHelper.cs @@ -8,7 +8,7 @@ using Umbraco.Core.Services; namespace Umbraco.Web.Editors { - internal class UserEditorAuthorizationHelper + public class UserEditorAuthorizationHelper { private readonly IContentService _contentService; private readonly IMediaService _mediaService; diff --git a/src/Umbraco.Examine/BaseValueSetBuilder.cs b/src/Umbraco.Infrastructure/Examine/BaseValueSetBuilder.cs similarity index 100% rename from src/Umbraco.Examine/BaseValueSetBuilder.cs rename to src/Umbraco.Infrastructure/Examine/BaseValueSetBuilder.cs diff --git a/src/Umbraco.Examine/ContentIndexPopulator.cs b/src/Umbraco.Infrastructure/Examine/ContentIndexPopulator.cs similarity index 100% rename from src/Umbraco.Examine/ContentIndexPopulator.cs rename to src/Umbraco.Infrastructure/Examine/ContentIndexPopulator.cs diff --git a/src/Umbraco.Examine/ContentValueSetBuilder.cs b/src/Umbraco.Infrastructure/Examine/ContentValueSetBuilder.cs similarity index 100% rename from src/Umbraco.Examine/ContentValueSetBuilder.cs rename to src/Umbraco.Infrastructure/Examine/ContentValueSetBuilder.cs diff --git a/src/Umbraco.Examine/ContentValueSetValidator.cs b/src/Umbraco.Infrastructure/Examine/ContentValueSetValidator.cs similarity index 100% rename from src/Umbraco.Examine/ContentValueSetValidator.cs rename to src/Umbraco.Infrastructure/Examine/ContentValueSetValidator.cs diff --git a/src/Umbraco.Web/ExamineExtensions.cs b/src/Umbraco.Infrastructure/Examine/ExamineExtensions.cs similarity index 100% rename from src/Umbraco.Web/ExamineExtensions.cs rename to src/Umbraco.Infrastructure/Examine/ExamineExtensions.cs diff --git a/src/Umbraco.Examine/GenericIndexDiagnostics.cs b/src/Umbraco.Infrastructure/Examine/GenericIndexDiagnostics.cs similarity index 100% rename from src/Umbraco.Examine/GenericIndexDiagnostics.cs rename to src/Umbraco.Infrastructure/Examine/GenericIndexDiagnostics.cs diff --git a/src/Umbraco.Examine/IBackOfficeExamineSearcher.cs b/src/Umbraco.Infrastructure/Examine/IBackOfficeExamineSearcher.cs similarity index 100% rename from src/Umbraco.Examine/IBackOfficeExamineSearcher.cs rename to src/Umbraco.Infrastructure/Examine/IBackOfficeExamineSearcher.cs diff --git a/src/Umbraco.Examine/IContentValueSetBuilder.cs b/src/Umbraco.Infrastructure/Examine/IContentValueSetBuilder.cs similarity index 100% rename from src/Umbraco.Examine/IContentValueSetBuilder.cs rename to src/Umbraco.Infrastructure/Examine/IContentValueSetBuilder.cs diff --git a/src/Umbraco.Examine/IContentValueSetValidator.cs b/src/Umbraco.Infrastructure/Examine/IContentValueSetValidator.cs similarity index 100% rename from src/Umbraco.Examine/IContentValueSetValidator.cs rename to src/Umbraco.Infrastructure/Examine/IContentValueSetValidator.cs diff --git a/src/Umbraco.Examine/IIndexCreator.cs b/src/Umbraco.Infrastructure/Examine/IIndexCreator.cs similarity index 100% rename from src/Umbraco.Examine/IIndexCreator.cs rename to src/Umbraco.Infrastructure/Examine/IIndexCreator.cs diff --git a/src/Umbraco.Examine/IIndexDiagnostics.cs b/src/Umbraco.Infrastructure/Examine/IIndexDiagnostics.cs similarity index 100% rename from src/Umbraco.Examine/IIndexDiagnostics.cs rename to src/Umbraco.Infrastructure/Examine/IIndexDiagnostics.cs diff --git a/src/Umbraco.Examine/IIndexDiagnosticsFactory.cs b/src/Umbraco.Infrastructure/Examine/IIndexDiagnosticsFactory.cs similarity index 100% rename from src/Umbraco.Examine/IIndexDiagnosticsFactory.cs rename to src/Umbraco.Infrastructure/Examine/IIndexDiagnosticsFactory.cs diff --git a/src/Umbraco.Examine/IIndexPopulator.cs b/src/Umbraco.Infrastructure/Examine/IIndexPopulator.cs similarity index 100% rename from src/Umbraco.Examine/IIndexPopulator.cs rename to src/Umbraco.Infrastructure/Examine/IIndexPopulator.cs diff --git a/src/Umbraco.Examine/IPublishedContentValueSetBuilder.cs b/src/Umbraco.Infrastructure/Examine/IPublishedContentValueSetBuilder.cs similarity index 100% rename from src/Umbraco.Examine/IPublishedContentValueSetBuilder.cs rename to src/Umbraco.Infrastructure/Examine/IPublishedContentValueSetBuilder.cs diff --git a/src/Umbraco.Examine/IUmbracoContentIndex.cs b/src/Umbraco.Infrastructure/Examine/IUmbracoContentIndex.cs similarity index 100% rename from src/Umbraco.Examine/IUmbracoContentIndex.cs rename to src/Umbraco.Infrastructure/Examine/IUmbracoContentIndex.cs diff --git a/src/Umbraco.Examine/IUmbracoIndex.cs b/src/Umbraco.Infrastructure/Examine/IUmbracoIndex.cs similarity index 100% rename from src/Umbraco.Examine/IUmbracoIndex.cs rename to src/Umbraco.Infrastructure/Examine/IUmbracoIndex.cs diff --git a/src/Umbraco.Examine/IUmbracoIndexConfig.cs b/src/Umbraco.Infrastructure/Examine/IUmbracoIndexConfig.cs similarity index 100% rename from src/Umbraco.Examine/IUmbracoIndexConfig.cs rename to src/Umbraco.Infrastructure/Examine/IUmbracoIndexConfig.cs diff --git a/src/Umbraco.Examine/IUmbracoIndexesCreator.cs b/src/Umbraco.Infrastructure/Examine/IUmbracoIndexesCreator.cs similarity index 100% rename from src/Umbraco.Examine/IUmbracoIndexesCreator.cs rename to src/Umbraco.Infrastructure/Examine/IUmbracoIndexesCreator.cs diff --git a/src/Umbraco.Examine/IUmbracoMemberIndex.cs b/src/Umbraco.Infrastructure/Examine/IUmbracoMemberIndex.cs similarity index 100% rename from src/Umbraco.Examine/IUmbracoMemberIndex.cs rename to src/Umbraco.Infrastructure/Examine/IUmbracoMemberIndex.cs diff --git a/src/Umbraco.Examine/IUmbracoTreeSearcherFields.cs b/src/Umbraco.Infrastructure/Examine/IUmbracoTreeSearcherFields.cs similarity index 100% rename from src/Umbraco.Examine/IUmbracoTreeSearcherFields.cs rename to src/Umbraco.Infrastructure/Examine/IUmbracoTreeSearcherFields.cs diff --git a/src/Umbraco.Examine/IValueSetBuilder.cs b/src/Umbraco.Infrastructure/Examine/IValueSetBuilder.cs similarity index 100% rename from src/Umbraco.Examine/IValueSetBuilder.cs rename to src/Umbraco.Infrastructure/Examine/IValueSetBuilder.cs diff --git a/src/Umbraco.Examine/IndexDiagnosticsFactory.cs b/src/Umbraco.Infrastructure/Examine/IndexDiagnosticsFactory.cs similarity index 100% rename from src/Umbraco.Examine/IndexDiagnosticsFactory.cs rename to src/Umbraco.Infrastructure/Examine/IndexDiagnosticsFactory.cs diff --git a/src/Umbraco.Examine/IndexPopulator.cs b/src/Umbraco.Infrastructure/Examine/IndexPopulator.cs similarity index 100% rename from src/Umbraco.Examine/IndexPopulator.cs rename to src/Umbraco.Infrastructure/Examine/IndexPopulator.cs diff --git a/src/Umbraco.Examine/IndexRebuilder.cs b/src/Umbraco.Infrastructure/Examine/IndexRebuilder.cs similarity index 100% rename from src/Umbraco.Examine/IndexRebuilder.cs rename to src/Umbraco.Infrastructure/Examine/IndexRebuilder.cs diff --git a/src/Umbraco.Examine/IndexRebuildingEventArgs.cs b/src/Umbraco.Infrastructure/Examine/IndexRebuildingEventArgs.cs similarity index 100% rename from src/Umbraco.Examine/IndexRebuildingEventArgs.cs rename to src/Umbraco.Infrastructure/Examine/IndexRebuildingEventArgs.cs diff --git a/src/Umbraco.Examine/IndexTypes.cs b/src/Umbraco.Infrastructure/Examine/IndexTypes.cs similarity index 100% rename from src/Umbraco.Examine/IndexTypes.cs rename to src/Umbraco.Infrastructure/Examine/IndexTypes.cs diff --git a/src/Umbraco.Examine/MediaIndexPopulator.cs b/src/Umbraco.Infrastructure/Examine/MediaIndexPopulator.cs similarity index 100% rename from src/Umbraco.Examine/MediaIndexPopulator.cs rename to src/Umbraco.Infrastructure/Examine/MediaIndexPopulator.cs diff --git a/src/Umbraco.Examine/MediaValueSetBuilder.cs b/src/Umbraco.Infrastructure/Examine/MediaValueSetBuilder.cs similarity index 100% rename from src/Umbraco.Examine/MediaValueSetBuilder.cs rename to src/Umbraco.Infrastructure/Examine/MediaValueSetBuilder.cs diff --git a/src/Umbraco.Examine/MemberIndexPopulator.cs b/src/Umbraco.Infrastructure/Examine/MemberIndexPopulator.cs similarity index 100% rename from src/Umbraco.Examine/MemberIndexPopulator.cs rename to src/Umbraco.Infrastructure/Examine/MemberIndexPopulator.cs diff --git a/src/Umbraco.Examine/MemberValueSetBuilder.cs b/src/Umbraco.Infrastructure/Examine/MemberValueSetBuilder.cs similarity index 100% rename from src/Umbraco.Examine/MemberValueSetBuilder.cs rename to src/Umbraco.Infrastructure/Examine/MemberValueSetBuilder.cs diff --git a/src/Umbraco.Examine/MemberValueSetValidator.cs b/src/Umbraco.Infrastructure/Examine/MemberValueSetValidator.cs similarity index 100% rename from src/Umbraco.Examine/MemberValueSetValidator.cs rename to src/Umbraco.Infrastructure/Examine/MemberValueSetValidator.cs diff --git a/src/Umbraco.Examine/PublishedContentIndexPopulator.cs b/src/Umbraco.Infrastructure/Examine/PublishedContentIndexPopulator.cs similarity index 100% rename from src/Umbraco.Examine/PublishedContentIndexPopulator.cs rename to src/Umbraco.Infrastructure/Examine/PublishedContentIndexPopulator.cs diff --git a/src/Umbraco.Examine/UmbracoExamineExtensions.cs b/src/Umbraco.Infrastructure/Examine/UmbracoExamineExtensions.cs similarity index 100% rename from src/Umbraco.Examine/UmbracoExamineExtensions.cs rename to src/Umbraco.Infrastructure/Examine/UmbracoExamineExtensions.cs diff --git a/src/Umbraco.Examine/UmbracoExamineFieldNames.cs b/src/Umbraco.Infrastructure/Examine/UmbracoExamineFieldNames.cs similarity index 100% rename from src/Umbraco.Examine/UmbracoExamineFieldNames.cs rename to src/Umbraco.Infrastructure/Examine/UmbracoExamineFieldNames.cs diff --git a/src/Umbraco.Examine/UmbracoFieldDefinitionCollection.cs b/src/Umbraco.Infrastructure/Examine/UmbracoFieldDefinitionCollection.cs similarity index 100% rename from src/Umbraco.Examine/UmbracoFieldDefinitionCollection.cs rename to src/Umbraco.Infrastructure/Examine/UmbracoFieldDefinitionCollection.cs diff --git a/src/Umbraco.Examine/UmbracoIndexConfig.cs b/src/Umbraco.Infrastructure/Examine/UmbracoIndexConfig.cs similarity index 100% rename from src/Umbraco.Examine/UmbracoIndexConfig.cs rename to src/Umbraco.Infrastructure/Examine/UmbracoIndexConfig.cs diff --git a/src/Umbraco.Examine/ValueSetValidator.cs b/src/Umbraco.Infrastructure/Examine/ValueSetValidator.cs similarity index 100% rename from src/Umbraco.Examine/ValueSetValidator.cs rename to src/Umbraco.Infrastructure/Examine/ValueSetValidator.cs diff --git a/src/Umbraco.Web/IPublishedContentQuery.cs b/src/Umbraco.Infrastructure/IPublishedContentQuery.cs similarity index 99% rename from src/Umbraco.Web/IPublishedContentQuery.cs rename to src/Umbraco.Infrastructure/IPublishedContentQuery.cs index 7066475dc9..6a1621b229 100644 --- a/src/Umbraco.Web/IPublishedContentQuery.cs +++ b/src/Umbraco.Infrastructure/IPublishedContentQuery.cs @@ -8,8 +8,6 @@ using Umbraco.Core.Xml; namespace Umbraco.Web { - using Examine = global::Examine; - /// /// Query methods used for accessing strongly typed content in templates /// diff --git a/src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs b/src/Umbraco.Infrastructure/Intall/InstallSteps/DatabaseConfigureStep.cs similarity index 98% rename from src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs rename to src/Umbraco.Infrastructure/Intall/InstallSteps/DatabaseConfigureStep.cs index dbf664bc93..3a978cc47a 100644 --- a/src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs +++ b/src/Umbraco.Infrastructure/Intall/InstallSteps/DatabaseConfigureStep.cs @@ -11,7 +11,7 @@ namespace Umbraco.Web.Install.InstallSteps [InstallSetupStep(InstallationType.NewInstall, "DatabaseConfigure", "database", 10, "Setting up a database, so Umbraco has a place to store your website", PerformsAppRestart = true)] - internal class DatabaseConfigureStep : InstallSetupStep + public class DatabaseConfigureStep : InstallSetupStep { private readonly DatabaseBuilder _databaseBuilder; private readonly ILogger _logger; diff --git a/src/Umbraco.Web/Install/InstallSteps/DatabaseInstallStep.cs b/src/Umbraco.Infrastructure/Intall/InstallSteps/DatabaseInstallStep.cs similarity index 79% rename from src/Umbraco.Web/Install/InstallSteps/DatabaseInstallStep.cs rename to src/Umbraco.Infrastructure/Intall/InstallSteps/DatabaseInstallStep.cs index 843b5ff887..a7b3dcc218 100644 --- a/src/Umbraco.Web/Install/InstallSteps/DatabaseInstallStep.cs +++ b/src/Umbraco.Infrastructure/Intall/InstallSteps/DatabaseInstallStep.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Configuration; using System.Threading.Tasks; using Umbraco.Core; using Umbraco.Core.Configuration; @@ -13,19 +12,21 @@ namespace Umbraco.Web.Install.InstallSteps { [InstallSetupStep(InstallationType.NewInstall | InstallationType.Upgrade, "DatabaseInstall", 11, "")] - internal class DatabaseInstallStep : InstallSetupStep + public class DatabaseInstallStep : InstallSetupStep { private readonly DatabaseBuilder _databaseBuilder; private readonly IRuntimeState _runtime; private readonly ILogger _logger; private readonly IIOHelper _ioHelper; + private readonly IConnectionStrings _connectionStrings; - public DatabaseInstallStep(DatabaseBuilder databaseBuilder, IRuntimeState runtime, ILogger logger, IIOHelper ioHelper) + public DatabaseInstallStep(DatabaseBuilder databaseBuilder, IRuntimeState runtime, ILogger logger, IIOHelper ioHelper, IConnectionStrings connectionStrings) { _databaseBuilder = databaseBuilder; _runtime = runtime; _logger = logger; _ioHelper = ioHelper; + _connectionStrings = connectionStrings; } public override Task ExecuteAsync(object model) @@ -42,7 +43,7 @@ namespace Umbraco.Web.Install.InstallSteps if (result.RequiresUpgrade == false) { - HandleConnectionStrings(_logger, _ioHelper); + HandleConnectionStrings(_logger, _ioHelper, _connectionStrings); return Task.FromResult(null); } @@ -53,12 +54,18 @@ namespace Umbraco.Web.Install.InstallSteps })); } - internal static void HandleConnectionStrings(ILogger logger, IIOHelper ioHelper) + internal static void HandleConnectionStrings(ILogger logger, IIOHelper ioHelper, IConnectionStrings connectionStrings) { + + + var databaseSettings = connectionStrings[Constants.System.UmbracoConnectionName]; + + + // Remove legacy umbracoDbDsn configuration setting if it exists and connectionstring also exists - if (ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName] != null) + if (databaseSettings != null) { - GlobalSettings.RemoveSetting(Constants.System.UmbracoConnectionName, ioHelper); + connectionStrings.RemoveConnectionString(Constants.System.UmbracoConnectionName); } else { diff --git a/src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs b/src/Umbraco.Infrastructure/Intall/InstallSteps/DatabaseUpgradeStep.cs similarity index 97% rename from src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs rename to src/Umbraco.Infrastructure/Intall/InstallSteps/DatabaseUpgradeStep.cs index 603fbd726c..3cd3c1ca56 100644 --- a/src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs +++ b/src/Umbraco.Infrastructure/Intall/InstallSteps/DatabaseUpgradeStep.cs @@ -7,7 +7,6 @@ using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Migrations.Install; using Umbraco.Core.Migrations.Upgrade; -using Umbraco.Web.Composing; using Umbraco.Web.Install.Models; using Umbraco.Web.Migrations.PostMigrations; @@ -15,7 +14,7 @@ namespace Umbraco.Web.Install.InstallSteps { [InstallSetupStep(InstallationType.Upgrade | InstallationType.NewInstall, "DatabaseUpgrade", 12, "")] - internal class DatabaseUpgradeStep : InstallSetupStep + public class DatabaseUpgradeStep : InstallSetupStep { private readonly DatabaseBuilder _databaseBuilder; private readonly IRuntimeState _runtime; @@ -56,7 +55,7 @@ namespace Umbraco.Web.Install.InstallSteps throw new InstallException("The database failed to upgrade. ERROR: " + result.Message); } - DatabaseInstallStep.HandleConnectionStrings(_logger, _ioHelper); + DatabaseInstallStep.HandleConnectionStrings(_logger, _ioHelper, _connectionStrings); } return Task.FromResult(null); diff --git a/src/Umbraco.Web/Models/ContentEditing/UserInvite.cs b/src/Umbraco.Infrastructure/Models/ContentEditing/UserInvite.cs similarity index 97% rename from src/Umbraco.Web/Models/ContentEditing/UserInvite.cs rename to src/Umbraco.Infrastructure/Models/ContentEditing/UserInvite.cs index 3adf10c467..f1c6cf6c04 100644 --- a/src/Umbraco.Web/Models/ContentEditing/UserInvite.cs +++ b/src/Umbraco.Infrastructure/Models/ContentEditing/UserInvite.cs @@ -2,8 +2,8 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Runtime.Serialization; +using Umbraco.Composing; using Umbraco.Core; -using Umbraco.Web.Composing; namespace Umbraco.Web.Models.ContentEditing { diff --git a/src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs b/src/Umbraco.Infrastructure/Models/Mapping/ContentTypeMapDefinition.cs similarity index 99% rename from src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs rename to src/Umbraco.Infrastructure/Models/Mapping/ContentTypeMapDefinition.cs index de64b15a0f..f7a2d6376b 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs +++ b/src/Umbraco.Infrastructure/Models/Mapping/ContentTypeMapDefinition.cs @@ -18,7 +18,7 @@ namespace Umbraco.Web.Models.Mapping /// /// Defines mappings for content/media/members type mappings /// - internal class ContentTypeMapDefinition : IMapDefinition + public class ContentTypeMapDefinition : IMapDefinition { private readonly PropertyEditorCollection _propertyEditors; private readonly IDataTypeService _dataTypeService; @@ -591,7 +591,7 @@ namespace Umbraco.Web.Models.Mapping return aliases.OrderBy(x => x); } - internal static Udi MapContentTypeUdi(IContentTypeComposition source) + public static Udi MapContentTypeUdi(IContentTypeComposition source) { if (source == null) return null; diff --git a/src/Umbraco.Web/Models/Mapping/DataTypeMapDefinition.cs b/src/Umbraco.Infrastructure/Models/Mapping/DataTypeMapDefinition.cs similarity index 98% rename from src/Umbraco.Web/Models/Mapping/DataTypeMapDefinition.cs rename to src/Umbraco.Infrastructure/Models/Mapping/DataTypeMapDefinition.cs index 0446c397bc..d57809c844 100644 --- a/src/Umbraco.Web/Models/Mapping/DataTypeMapDefinition.cs +++ b/src/Umbraco.Infrastructure/Models/Mapping/DataTypeMapDefinition.cs @@ -7,12 +7,11 @@ using Umbraco.Core.Logging; using Umbraco.Core.Mapping; using Umbraco.Core.Models; using Umbraco.Core.PropertyEditors; -using Umbraco.Web.Composing; using Umbraco.Web.Models.ContentEditing; namespace Umbraco.Web.Models.Mapping { - internal class DataTypeMapDefinition : IMapDefinition + public class DataTypeMapDefinition : IMapDefinition { private readonly PropertyEditorCollection _propertyEditors; private readonly ILogger _logger; @@ -142,7 +141,7 @@ namespace Umbraco.Web.Models.Mapping // an empty fields list, which made no sense since there would be nothing to map to - and besides, // a datatype without an editor alias is a serious issue - v8 wants an editor here - if (string.IsNullOrWhiteSpace(dataType.EditorAlias) || !Current.PropertyEditors.TryGet(dataType.EditorAlias, out var editor)) + if (string.IsNullOrWhiteSpace(dataType.EditorAlias) || !_propertyEditors.TryGet(dataType.EditorAlias, out var editor)) throw new InvalidOperationException($"Could not find a property editor with alias \"{dataType.EditorAlias}\"."); var configurationEditor = editor.GetConfigurationEditor(); diff --git a/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesMapper.cs b/src/Umbraco.Infrastructure/Models/Mapping/MemberTabsAndPropertiesMapper.cs similarity index 93% rename from src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesMapper.cs rename to src/Umbraco.Infrastructure/Models/Mapping/MemberTabsAndPropertiesMapper.cs index 7dc3d55087..2cb226bec2 100644 --- a/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesMapper.cs +++ b/src/Umbraco.Infrastructure/Models/Mapping/MemberTabsAndPropertiesMapper.cs @@ -3,12 +3,12 @@ using System.Collections.Generic; using System.Linq; using Umbraco.Core; using Umbraco.Core.Mapping; -using Umbraco.Web.Composing; using Umbraco.Core.Models; using Umbraco.Core.Services; using Umbraco.Web.Models.ContentEditing; using Umbraco.Core.Dictionary; using Umbraco.Core.Configuration; +using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.Models.Mapping { @@ -20,7 +20,7 @@ namespace Umbraco.Web.Models.Mapping /// This also ensures that the IsLocked out property is readonly when the member is not locked out - this is because /// an admin cannot actually set isLockedOut = true, they can only unlock. /// - internal class MemberTabsAndPropertiesMapper : TabsAndPropertiesMapper + public class MemberTabsAndPropertiesMapper : TabsAndPropertiesMapper { private readonly IUmbracoContextAccessor _umbracoContextAccessor; private readonly ILocalizedTextService _localizedTextService; @@ -28,8 +28,17 @@ namespace Umbraco.Web.Models.Mapping private readonly IMemberService _memberService; private readonly IMemberGroupService _memberGroupService; private readonly IMemberPasswordConfiguration _memberPasswordConfiguration; + private readonly PropertyEditorCollection _propertyEditorCollection; - public MemberTabsAndPropertiesMapper(ICultureDictionary cultureDictionary, IUmbracoContextAccessor umbracoContextAccessor, ILocalizedTextService localizedTextService, IMemberTypeService memberTypeService, IMemberService memberService, IMemberGroupService memberGroupService, IMemberPasswordConfiguration memberPasswordConfiguration, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider) + public MemberTabsAndPropertiesMapper(ICultureDictionary cultureDictionary, + IUmbracoContextAccessor umbracoContextAccessor, + ILocalizedTextService localizedTextService, + IMemberTypeService memberTypeService, + IMemberService memberService, + IMemberGroupService memberGroupService, + IMemberPasswordConfiguration memberPasswordConfiguration, + IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, + PropertyEditorCollection propertyEditorCollection) : base(cultureDictionary, localizedTextService, contentTypeBaseServiceProvider) { _umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor)); @@ -38,6 +47,7 @@ namespace Umbraco.Web.Models.Mapping _memberService = memberService ?? throw new ArgumentNullException(nameof(memberService)); _memberGroupService = memberGroupService ?? throw new ArgumentNullException(nameof(memberGroupService)); _memberPasswordConfiguration = memberPasswordConfiguration; + _propertyEditorCollection = propertyEditorCollection; } /// @@ -108,7 +118,7 @@ namespace Umbraco.Web.Models.Mapping Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}doctype", Label = _localizedTextService.Localize("content/membertype"), Value = _localizedTextService.UmbracoDictionaryTranslate(CultureDictionary, member.ContentType.Name), - View = Current.PropertyEditors[Constants.PropertyEditors.Aliases.Label].GetValueEditor().View + View = _propertyEditorCollection[Constants.PropertyEditors.Aliases.Label].GetValueEditor().View }, GetLoginProperty(_memberTypeService, member, _localizedTextService), new ContentPropertyDisplay diff --git a/src/Umbraco.Web/Models/Mapping/PropertyTypeGroupMapper.cs b/src/Umbraco.Infrastructure/Models/Mapping/PropertyTypeGroupMapper.cs similarity index 99% rename from src/Umbraco.Web/Models/Mapping/PropertyTypeGroupMapper.cs rename to src/Umbraco.Infrastructure/Models/Mapping/PropertyTypeGroupMapper.cs index 000e37f31f..5cdc9c5fa4 100644 --- a/src/Umbraco.Web/Models/Mapping/PropertyTypeGroupMapper.cs +++ b/src/Umbraco.Infrastructure/Models/Mapping/PropertyTypeGroupMapper.cs @@ -7,7 +7,6 @@ using Umbraco.Core.Models; using Umbraco.Core.PropertyEditors; using Umbraco.Core.Services; using Umbraco.Core.Strings; -using Umbraco.Web.Composing; using Umbraco.Web.Models.ContentEditing; namespace Umbraco.Web.Models.Mapping diff --git a/src/Umbraco.Web/Models/Mapping/RedirectUrlMapDefinition.cs b/src/Umbraco.Infrastructure/Models/Mapping/RedirectUrlMapDefinition.cs similarity index 95% rename from src/Umbraco.Web/Models/Mapping/RedirectUrlMapDefinition.cs rename to src/Umbraco.Infrastructure/Models/Mapping/RedirectUrlMapDefinition.cs index 9386c60918..08c89b34f8 100644 --- a/src/Umbraco.Web/Models/Mapping/RedirectUrlMapDefinition.cs +++ b/src/Umbraco.Infrastructure/Models/Mapping/RedirectUrlMapDefinition.cs @@ -5,7 +5,7 @@ using Umbraco.Web.Routing; namespace Umbraco.Web.Models.Mapping { - internal class RedirectUrlMapDefinition : IMapDefinition + public class RedirectUrlMapDefinition : IMapDefinition { private readonly IPublishedUrlProvider _publishedUrlProvider; diff --git a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesMapper.cs b/src/Umbraco.Infrastructure/Models/Mapping/TabsAndPropertiesMapper.cs similarity index 97% rename from src/Umbraco.Web/Models/Mapping/TabsAndPropertiesMapper.cs rename to src/Umbraco.Infrastructure/Models/Mapping/TabsAndPropertiesMapper.cs index ea062de9eb..d9c76b5ebc 100644 --- a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesMapper.cs +++ b/src/Umbraco.Infrastructure/Models/Mapping/TabsAndPropertiesMapper.cs @@ -6,12 +6,11 @@ using Umbraco.Core.Mapping; using Umbraco.Core.Models; using Umbraco.Core.Services; using Umbraco.Web.Models.ContentEditing; -using Umbraco.Web.Composing; using Umbraco.Core.Dictionary; namespace Umbraco.Web.Models.Mapping { - internal abstract class TabsAndPropertiesMapper + public abstract class TabsAndPropertiesMapper { protected ICultureDictionary CultureDictionary { get; } protected ILocalizedTextService LocalizedTextService { get; } @@ -115,7 +114,7 @@ namespace Umbraco.Web.Models.Mapping /// /// Creates the tabs collection with properties assigned for display models /// - internal class TabsAndPropertiesMapper : TabsAndPropertiesMapper + public class TabsAndPropertiesMapper : TabsAndPropertiesMapper where TSource : IContentBase { private readonly IContentTypeBaseServiceProvider _contentTypeBaseServiceProvider; diff --git a/src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs b/src/Umbraco.Infrastructure/Models/Mapping/UserMapDefinition.cs similarity index 99% rename from src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs rename to src/Umbraco.Infrastructure/Models/Mapping/UserMapDefinition.cs index 556b15d72b..19a78bcbe4 100644 --- a/src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs +++ b/src/Umbraco.Infrastructure/Models/Mapping/UserMapDefinition.cs @@ -4,7 +4,6 @@ using System.Globalization; using System.Linq; using Umbraco.Core; using Umbraco.Core.Cache; -using Umbraco.Web.Composing; using Umbraco.Core.Configuration; using Umbraco.Core.IO; using Umbraco.Core.Mapping; @@ -20,7 +19,7 @@ using Umbraco.Web.Services; namespace Umbraco.Web.Models.Mapping { - internal class UserMapDefinition : IMapDefinition + public class UserMapDefinition : IMapDefinition { private readonly ISectionService _sectionService; private readonly IEntityService _entityService; diff --git a/src/Umbraco.Web/PublishedContentQuery.cs b/src/Umbraco.Infrastructure/PublishedContentQuery.cs similarity index 100% rename from src/Umbraco.Web/PublishedContentQuery.cs rename to src/Umbraco.Infrastructure/PublishedContentQuery.cs diff --git a/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs b/src/Umbraco.Infrastructure/Routing/ContentFinderByConfigured404.cs similarity index 100% rename from src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs rename to src/Umbraco.Infrastructure/Routing/ContentFinderByConfigured404.cs diff --git a/src/Umbraco.Web/Routing/NotFoundHandlerHelper.cs b/src/Umbraco.Infrastructure/Routing/NotFoundHandlerHelper.cs similarity index 99% rename from src/Umbraco.Web/Routing/NotFoundHandlerHelper.cs rename to src/Umbraco.Infrastructure/Routing/NotFoundHandlerHelper.cs index 38ecb09b2b..335e1f868a 100644 --- a/src/Umbraco.Web/Routing/NotFoundHandlerHelper.cs +++ b/src/Umbraco.Infrastructure/Routing/NotFoundHandlerHelper.cs @@ -1,13 +1,13 @@ using System; using System.Globalization; using System.Linq; +using Umbraco.Composing; using Umbraco.Core; using Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Services; using Umbraco.Core.Xml; -using Umbraco.Web.Composing; namespace Umbraco.Web.Routing { diff --git a/src/Umbraco.Infrastructure/Runtime/CoreInitialComposer.cs b/src/Umbraco.Infrastructure/Runtime/CoreInitialComposer.cs index 689ee44eb2..2586fcd9f5 100644 --- a/src/Umbraco.Infrastructure/Runtime/CoreInitialComposer.cs +++ b/src/Umbraco.Infrastructure/Runtime/CoreInitialComposer.cs @@ -26,6 +26,8 @@ using Umbraco.Web.Models.PublishedContent; using Umbraco.Web.PublishedCache; using Umbraco.Web; using Umbraco.Web.Migrations.PostMigrations; +using Umbraco.Web.Install; +using Umbraco.Web.Trees; using Umbraco.Web.PropertyEditors; using Umbraco.Web.Services; using IntegerValidator = Umbraco.Core.PropertyEditors.Validators.IntegerValidator; @@ -59,6 +61,8 @@ namespace Umbraco.Core.Runtime composition.RegisterUnique(f => f.GetInstance()); composition.RegisterUnique(); + composition.RegisterUnique(); + composition.RegisterUnique(); // register database builder // *not* a singleton, don't want to keep it around diff --git a/src/Umbraco.Web/Scheduling/ScheduledPublishing.cs b/src/Umbraco.Infrastructure/Scheduling/ScheduledPublishing.cs similarity index 91% rename from src/Umbraco.Web/Scheduling/ScheduledPublishing.cs rename to src/Umbraco.Infrastructure/Scheduling/ScheduledPublishing.cs index 2e79e40d7a..b074704033 100644 --- a/src/Umbraco.Web/Scheduling/ScheduledPublishing.cs +++ b/src/Umbraco.Infrastructure/Scheduling/ScheduledPublishing.cs @@ -7,21 +7,23 @@ using Umbraco.Core.Sync; namespace Umbraco.Web.Scheduling { - internal class ScheduledPublishing : RecurringTaskBase + public class ScheduledPublishing : RecurringTaskBase { private readonly IRuntimeState _runtime; private readonly IContentService _contentService; private readonly IUmbracoContextFactory _umbracoContextFactory; private readonly ILogger _logger; + private readonly IServerMessenger _serverMessenger; public ScheduledPublishing(IBackgroundTaskRunner runner, int delayMilliseconds, int periodMilliseconds, - IRuntimeState runtime, IContentService contentService, IUmbracoContextFactory umbracoContextFactory, ILogger logger) + IRuntimeState runtime, IContentService contentService, IUmbracoContextFactory umbracoContextFactory, ILogger logger, IServerMessenger serverMessenger) : base(runner, delayMilliseconds, periodMilliseconds) { _runtime = runtime; _contentService = contentService; _umbracoContextFactory = umbracoContextFactory; _logger = logger; + _serverMessenger = serverMessenger; } public override bool PerformRun() @@ -76,7 +78,7 @@ namespace Umbraco.Web.Scheduling finally { // if running on a temp context, we have to flush the messenger - if (contextReference.IsRoot && Composing.Current.ServerMessenger is BatchedDatabaseServerMessenger m) + if (contextReference.IsRoot && _serverMessenger is IBatchedDatabaseServerMessenger m) m.FlushBatch(); } } diff --git a/src/Umbraco.Web/Search/BackgroundIndexRebuilder.cs b/src/Umbraco.Infrastructure/Search/BackgroundIndexRebuilder.cs similarity index 100% rename from src/Umbraco.Web/Search/BackgroundIndexRebuilder.cs rename to src/Umbraco.Infrastructure/Search/BackgroundIndexRebuilder.cs diff --git a/src/Umbraco.Web/Search/ExamineComponent.cs b/src/Umbraco.Infrastructure/Search/ExamineComponent.cs similarity index 100% rename from src/Umbraco.Web/Search/ExamineComponent.cs rename to src/Umbraco.Infrastructure/Search/ExamineComponent.cs diff --git a/src/Umbraco.Web/Search/ExamineComposer.cs b/src/Umbraco.Infrastructure/Search/ExamineComposer.cs similarity index 100% rename from src/Umbraco.Web/Search/ExamineComposer.cs rename to src/Umbraco.Infrastructure/Search/ExamineComposer.cs diff --git a/src/Umbraco.Web/Search/ExamineFinalComponent.cs b/src/Umbraco.Infrastructure/Search/ExamineFinalComponent.cs similarity index 100% rename from src/Umbraco.Web/Search/ExamineFinalComponent.cs rename to src/Umbraco.Infrastructure/Search/ExamineFinalComponent.cs diff --git a/src/Umbraco.Web/Search/ExamineFinalComposer.cs b/src/Umbraco.Infrastructure/Search/ExamineFinalComposer.cs similarity index 100% rename from src/Umbraco.Web/Search/ExamineFinalComposer.cs rename to src/Umbraco.Infrastructure/Search/ExamineFinalComposer.cs diff --git a/src/Umbraco.Web/Search/ExamineIndexModel.cs b/src/Umbraco.Infrastructure/Search/ExamineIndexModel.cs similarity index 100% rename from src/Umbraco.Web/Search/ExamineIndexModel.cs rename to src/Umbraco.Infrastructure/Search/ExamineIndexModel.cs diff --git a/src/Umbraco.Web/Search/ExamineSearcherModel.cs b/src/Umbraco.Infrastructure/Search/ExamineSearcherModel.cs similarity index 100% rename from src/Umbraco.Web/Search/ExamineSearcherModel.cs rename to src/Umbraco.Infrastructure/Search/ExamineSearcherModel.cs diff --git a/src/Umbraco.Web/Search/ExamineUserComponent.cs b/src/Umbraco.Infrastructure/Search/ExamineUserComponent.cs similarity index 100% rename from src/Umbraco.Web/Search/ExamineUserComponent.cs rename to src/Umbraco.Infrastructure/Search/ExamineUserComponent.cs diff --git a/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs b/src/Umbraco.Infrastructure/Search/UmbracoTreeSearcher.cs similarity index 100% rename from src/Umbraco.Web/Search/UmbracoTreeSearcher.cs rename to src/Umbraco.Infrastructure/Search/UmbracoTreeSearcher.cs diff --git a/src/Umbraco.Web/Search/UmbracoTreeSearcherFields.cs b/src/Umbraco.Infrastructure/Search/UmbracoTreeSearcherFields.cs similarity index 100% rename from src/Umbraco.Web/Search/UmbracoTreeSearcherFields.cs rename to src/Umbraco.Infrastructure/Search/UmbracoTreeSearcherFields.cs diff --git a/src/Umbraco.Web/Suspendable.cs b/src/Umbraco.Infrastructure/Suspendable.cs similarity index 88% rename from src/Umbraco.Web/Suspendable.cs rename to src/Umbraco.Infrastructure/Suspendable.cs index a1d79d3619..7287d1c364 100644 --- a/src/Umbraco.Web/Suspendable.cs +++ b/src/Umbraco.Infrastructure/Suspendable.cs @@ -1,6 +1,6 @@ -using Umbraco.Core; +using Umbraco.Composing; +using Umbraco.Core.Cache; using Umbraco.Core.Logging; -using Umbraco.Web.Composing; using Umbraco.Examine; using Umbraco.Web.Cache; using Umbraco.Web.Search; @@ -34,7 +34,7 @@ namespace Umbraco.Web _suspended = true; } - public static void ResumeDocumentCache() + public static void ResumeDocumentCache(CacheRefresherCollection cacheRefresherCollection) { _suspended = false; @@ -43,7 +43,7 @@ namespace Umbraco.Web if (_tried == false) return; _tried = false; - var pageRefresher = Current.CacheRefreshers[ContentCacheRefresher.UniqueId]; + var pageRefresher = cacheRefresherCollection[ContentCacheRefresher.UniqueId]; pageRefresher.RefreshAll(); } } @@ -70,7 +70,7 @@ namespace Umbraco.Web _suspended = true; } - public static void ResumeIndexers(IndexRebuilder indexRebuilder, ILogger logger) + public static void ResumeIndexers(IndexRebuilder indexRebuilder, ILogger logger, BackgroundIndexRebuilder backgroundIndexRebuilder) { _suspended = false; @@ -79,7 +79,7 @@ namespace Umbraco.Web if (_tried == false) return; _tried = false; - Current.Factory.GetInstance().RebuildIndexes(false); + backgroundIndexRebuilder.RebuildIndexes(false); } } diff --git a/src/Umbraco.Web/TagQuery.cs b/src/Umbraco.Infrastructure/TagQuery.cs similarity index 100% rename from src/Umbraco.Web/TagQuery.cs rename to src/Umbraco.Infrastructure/TagQuery.cs diff --git a/src/Umbraco.Web/Trees/TreeNode.cs b/src/Umbraco.Infrastructure/Trees/TreeNode.cs similarity index 97% rename from src/Umbraco.Web/Trees/TreeNode.cs rename to src/Umbraco.Infrastructure/Trees/TreeNode.cs index 7661387b3d..cc130b1b97 100644 --- a/src/Umbraco.Web/Trees/TreeNode.cs +++ b/src/Umbraco.Infrastructure/Trees/TreeNode.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Runtime.Serialization; +using Umbraco.Composing; using Umbraco.Core; -using Umbraco.Web.Composing; using Umbraco.Web.Models.ContentEditing; namespace Umbraco.Web.Models.Trees @@ -23,7 +23,7 @@ namespace Umbraco.Web.Models.Trees /// The parent id for the current node /// /// - internal TreeNode(string nodeId, string parentId, string getChildNodesUrl, string menuUrl) + public TreeNode(string nodeId, string parentId, string getChildNodesUrl, string menuUrl) { if (nodeId == null) throw new ArgumentNullException(nameof(nodeId)); if (string.IsNullOrWhiteSpace(nodeId)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(nodeId)); diff --git a/src/Umbraco.Web/Models/Trees/TreeNodeCollection.cs b/src/Umbraco.Infrastructure/Trees/TreeNodeCollection.cs similarity index 100% rename from src/Umbraco.Web/Models/Trees/TreeNodeCollection.cs rename to src/Umbraco.Infrastructure/Trees/TreeNodeCollection.cs diff --git a/src/Umbraco.Web/Models/Trees/TreeNodeExtensions.cs b/src/Umbraco.Infrastructure/Trees/TreeNodeExtensions.cs similarity index 100% rename from src/Umbraco.Web/Models/Trees/TreeNodeExtensions.cs rename to src/Umbraco.Infrastructure/Trees/TreeNodeExtensions.cs diff --git a/src/Umbraco.Web/Models/Trees/TreeRootNode.cs b/src/Umbraco.Infrastructure/Trees/TreeRootNode.cs similarity index 100% rename from src/Umbraco.Web/Models/Trees/TreeRootNode.cs rename to src/Umbraco.Infrastructure/Trees/TreeRootNode.cs diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj index f26378a501..41fd2bfe75 100644 --- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj +++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj @@ -27,6 +27,7 @@ + diff --git a/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotService.cs b/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotService.cs index 5d99aa6aaa..68b7ee596a 100644 --- a/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotService.cs +++ b/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotService.cs @@ -12,6 +12,7 @@ using Umbraco.Core.Composing; using Umbraco.Core.Configuration; using Umbraco.Core.Hosting; using Umbraco.Core.Install; +using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.Membership; @@ -26,6 +27,7 @@ using Umbraco.Core.Services.Changes; using Umbraco.Core.Services.Implement; using Umbraco.Core.Strings; using Umbraco.Web.Cache; +using Umbraco.Web.Install; using Umbraco.Web.PublishedCache.NuCache.DataSource; using Umbraco.Web.Routing; using File = System.IO.File; @@ -50,7 +52,7 @@ namespace Umbraco.Web.PublishedCache.NuCache private readonly ITypeFinder _typeFinder; private readonly IHostingEnvironment _hostingEnvironment; private readonly IShortStringHelper _shortStringHelper; - private readonly IFilePermissionHelper _filePermissionHelper; + private readonly IIOHelper _ioHelper; // volatile because we read it with no lock private volatile bool _isReady; @@ -88,7 +90,7 @@ namespace Umbraco.Web.PublishedCache.NuCache ITypeFinder typeFinder, IHostingEnvironment hostingEnvironment, IShortStringHelper shortStringHelper, - IFilePermissionHelper filePermissionHelper) + IIOHelper ioHelper) : base(publishedSnapshotAccessor, variationContextAccessor) { //if (Interlocked.Increment(ref _singletonCheck) > 1) @@ -108,7 +110,7 @@ namespace Umbraco.Web.PublishedCache.NuCache _typeFinder = typeFinder; _hostingEnvironment = hostingEnvironment; _shortStringHelper = shortStringHelper; - _filePermissionHelper = filePermissionHelper; + _ioHelper = ioHelper; // we need an Xml serializer here so that the member cache can support XPath, // for members this is done by navigating the serialized-to-xml member @@ -362,7 +364,7 @@ namespace Umbraco.Web.PublishedCache.NuCache public override bool EnsureEnvironment(out IEnumerable errors) { // must have app_data and be able to write files into it - var ok = _filePermissionHelper.TryCreateDirectory(GetLocalFilesPath()); + var ok = _ioHelper.TryCreateDirectory(GetLocalFilesPath()); errors = ok ? Enumerable.Empty() : new[] { "NuCache local files." }; return ok; } diff --git a/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs b/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs index 1bc517ab07..5fb4b19168 100644 --- a/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs +++ b/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs @@ -165,7 +165,8 @@ namespace Umbraco.Tests.Cache Mock.Of(), IOHelper, UriUtility, - httpContextAccessor); + httpContextAccessor, + new AspNetCookieManager(httpContextAccessor)); // just assert it does not throw var refreshers = new DistributedCacheBinder(null, umbracoContextFactory, null); diff --git a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs index a7ef0ff721..b096235708 100644 --- a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs +++ b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs @@ -83,7 +83,8 @@ namespace Umbraco.Tests.Cache.PublishedCache globalSettings, new TestVariationContextAccessor(), IOHelper, - UriUtility); + UriUtility, + new AspNetCookieManager(httpContextAccessor)); _cache = _umbracoContext.Content; } diff --git a/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs b/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs index 42e446c4d3..1f153a0a5e 100644 --- a/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs +++ b/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs @@ -10,6 +10,7 @@ using Umbraco.Core.Configuration; using Umbraco.Core.Events; using Umbraco.Core.Hosting; using Umbraco.Core.Install; +using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; @@ -144,7 +145,6 @@ namespace Umbraco.Tests.PublishedContent var typeFinder = new TypeFinder(Mock.Of()); - var filePermissionHelper = Mock.Of(); // at last, create the complete NuCache snapshot service! var options = new PublishedSnapshotServiceOptions { IgnoreLocalDb = true }; @@ -169,7 +169,7 @@ namespace Umbraco.Tests.PublishedContent typeFinder, hostingEnvironment, new MockShortStringHelper(), - filePermissionHelper); + TestHelper.IOHelper); // invariant is the current default _variationAccesor.VariationContext = new VariationContext(); @@ -971,7 +971,7 @@ namespace Umbraco.Tests.PublishedContent documents = snapshot.Content.GetById(2).Children(_variationAccesor).ToArray(); AssertDocuments(documents, "N9", "N8", "N7"); - + } [Test] diff --git a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs index 08e68ce652..b0f0eb7722 100644 --- a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs +++ b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs @@ -186,8 +186,6 @@ namespace Umbraco.Tests.PublishedContent var typeFinder = new TypeFinder(Mock.Of()); - var filePermissionHelper = Mock.Of(); - // at last, create the complete NuCache snapshot service! var options = new PublishedSnapshotServiceOptions { IgnoreLocalDb = true }; _snapshotService = new PublishedSnapshotService(options, @@ -211,7 +209,7 @@ namespace Umbraco.Tests.PublishedContent typeFinder, TestHelper.GetHostingEnvironment(), new MockShortStringHelper(), - filePermissionHelper); + TestHelper.IOHelper); // invariant is the current default _variationAccesor.VariationContext = new VariationContext(); diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentSnapshotTestBase.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentSnapshotTestBase.cs index 6dbb531d98..1806493cdd 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentSnapshotTestBase.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentSnapshotTestBase.cs @@ -77,7 +77,8 @@ namespace Umbraco.Tests.PublishedContent globalSettings, new TestVariationContextAccessor(), IOHelper, - UriUtility); + UriUtility, + new AspNetCookieManager(httpContextAccessor)); return umbracoContext; } diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs index fc184e8da0..704ce3fff4 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs @@ -53,8 +53,6 @@ namespace Umbraco.Tests.PublishedContent var dataTypeService = new TestObjects.TestDataTypeService( new DataType(new RichTextPropertyEditor( Mock.Of(), - Mock.Of(), - Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs index ecfcca0e0d..04dbcc454c 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs @@ -59,7 +59,7 @@ namespace Umbraco.Tests.PublishedContent var dataTypeService = new TestObjects.TestDataTypeService( new DataType(new VoidEditor(logger, Mock.Of(), localizationService, LocalizedTextService, ShortStringHelper)) { Id = 1 }, new DataType(new TrueFalsePropertyEditor(logger, Mock.Of(), localizationService, IOHelper, ShortStringHelper, LocalizedTextService)) { Id = 1001 }, - new DataType(new RichTextPropertyEditor(logger, mediaService, contentTypeBaseServiceProvider, umbracoContextAccessor, Mock.Of(), localizationService, imageSourceParser, linkParser, pastedImages, ShortStringHelper, IOHelper, LocalizedTextService, Mock.Of())) { Id = 1002 }, + new DataType(new RichTextPropertyEditor(logger,umbracoContextAccessor, Mock.Of(), localizationService, imageSourceParser, linkParser, pastedImages, ShortStringHelper, IOHelper, LocalizedTextService, Mock.Of())) { Id = 1002 }, new DataType(new IntegerPropertyEditor(logger, Mock.Of(), localizationService, ShortStringHelper, LocalizedTextService)) { Id = 1003 }, new DataType(new TextboxPropertyEditor(logger, Mock.Of(), localizationService, IOHelper, ShortStringHelper, LocalizedTextService)) { Id = 1004 }, new DataType(new MediaPickerPropertyEditor(logger, Mock.Of(), localizationService, IOHelper, ShortStringHelper, LocalizedTextService)) { Id = 1005 }); diff --git a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs index 3798213a87..9cf6b3d773 100644 --- a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs +++ b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs @@ -84,7 +84,6 @@ namespace Umbraco.Tests.Scoping var mediaRepository = Mock.Of(); var memberRepository = Mock.Of(); var hostingEnvironment = TestHelper.GetHostingEnvironment(); - var filePermissionHelper = Mock.Of(); var typeFinder = new TypeFinder(Mock.Of()); @@ -108,7 +107,7 @@ namespace Umbraco.Tests.Scoping typeFinder, hostingEnvironment, new MockShortStringHelper(), - filePermissionHelper); + IOHelper); } protected IUmbracoContext GetUmbracoContextNu(string url, int templateId = 1234, RouteData routeData = null, bool setSingleton = false, IUmbracoSettingsSection umbracoSettings = null, IEnumerable urlProviders = null) @@ -126,7 +125,8 @@ namespace Umbraco.Tests.Scoping globalSettings, new TestVariationContextAccessor(), IOHelper, - UriUtility); + UriUtility, + new AspNetCookieManager(httpContextAccessor)); if (setSingleton) Umbraco.Web.Composing.Current.UmbracoContextAccessor.UmbracoContext = umbracoContext; diff --git a/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs b/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs index 83e2a654c4..16b8859bed 100644 --- a/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs +++ b/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs @@ -37,7 +37,8 @@ namespace Umbraco.Tests.Security new WebSecurity(httpContextAccessor, ServiceContext.UserService, globalSettings, IOHelper), globalSettings, new TestVariationContextAccessor(), IOHelper, - UriUtility); + UriUtility, + new AspNetCookieManager(httpContextAccessor)); var runtime = Mock.Of(x => x.Level == RuntimeLevel.Install); var mgr = new BackOfficeCookieManager( @@ -60,7 +61,8 @@ namespace Umbraco.Tests.Security globalSettings, new TestVariationContextAccessor(), IOHelper, - UriUtility); + UriUtility, + new AspNetCookieManager(httpContextAccessor)); var runtime = Mock.Of(x => x.Level == RuntimeLevel.Run); var mgr = new BackOfficeCookieManager(Mock.Of(accessor => accessor.UmbracoContext == umbCtx), runtime, TestObjects.GetGlobalSettings(), IOHelper, AppCaches.RequestCache); diff --git a/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs b/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs index 2c22b98262..1a485ec546 100644 --- a/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs +++ b/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs @@ -57,7 +57,6 @@ namespace Umbraco.Tests.Services var mediaRepository = Mock.Of(); var memberRepository = Mock.Of(); var hostingEnvironment = Mock.Of(); - var filePermissionHelper = Mock.Of(); var typeFinder = new TypeFinder(Mock.Of()); @@ -81,7 +80,7 @@ namespace Umbraco.Tests.Services typeFinder, hostingEnvironment, new MockShortStringHelper(), - filePermissionHelper); + IOHelper); } public class LocalServerMessenger : ServerMessengerBase diff --git a/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs b/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs index 055203b1cc..2b0186f634 100644 --- a/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs +++ b/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs @@ -144,7 +144,8 @@ namespace Umbraco.Tests.TestHelpers.ControllerTesting globalSettings, new TestVariationContextAccessor(), TestHelper.IOHelper, - TestHelper.UriUtility); + TestHelper.UriUtility, + new AspNetCookieManager(httpContextAccessor)); //replace it umbracoContextAccessor.UmbracoContext = umbCtx; diff --git a/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs b/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs index 25588bed62..5dabb7ed06 100644 --- a/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs +++ b/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs @@ -134,7 +134,8 @@ namespace Umbraco.Tests.TestHelpers Mock.Of(), TestHelper.IOHelper, TestHelper.UriUtility, - httpContextAccessor); + httpContextAccessor, + new AspNetCookieManager(httpContextAccessor)); return umbracoContextFactory.EnsureUmbracoContext().UmbracoContext; } diff --git a/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs b/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs index 0ce667ea4e..b02af84e09 100644 --- a/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs +++ b/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs @@ -380,7 +380,8 @@ namespace Umbraco.Tests.TestHelpers globalSettings ?? Factory.GetInstance(), new TestVariationContextAccessor(), IOHelper, - UriUtility); + UriUtility, + new AspNetCookieManager(httpContextAccessor)); if (setSingleton) Umbraco.Web.Composing.Current.UmbracoContextAccessor.UmbracoContext = umbracoContext; diff --git a/src/Umbraco.Tests/Testing/Objects/TestUmbracoContextFactory.cs b/src/Umbraco.Tests/Testing/Objects/TestUmbracoContextFactory.cs index 26bed55cbc..20b18fa728 100644 --- a/src/Umbraco.Tests/Testing/Objects/TestUmbracoContextFactory.cs +++ b/src/Umbraco.Tests/Testing/Objects/TestUmbracoContextFactory.cs @@ -45,7 +45,8 @@ namespace Umbraco.Tests.Testing.Objects Mock.Of(), TestHelper.IOHelper, TestHelper.UriUtility, - httpContextAccessor); + httpContextAccessor, + new AspNetCookieManager(httpContextAccessor)); return umbracoContextFactory; } diff --git a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs index 7018940af6..c87b92f1c9 100644 --- a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs +++ b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs @@ -55,7 +55,9 @@ using Umbraco.Core.Models.Identity; using Umbraco.Core.Security; using Umbraco.Core.Services; using Umbraco.Net; +using Umbraco.Web.Install; using Umbraco.Web.Security; +using Umbraco.Web.Trees; using Current = Umbraco.Web.Composing.Current; namespace Umbraco.Tests.Testing { @@ -415,6 +417,8 @@ namespace Umbraco.Tests.Testing Composition.RegisterUnique(); Composition.RegisterUnique(); + Composition.RegisterUnique(); + Composition.RegisterUnique(); // register filesystems Composition.RegisterUnique(factory => TestObjects.GetFileSystemsMock()); diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 70df913d01..9c8bba7631 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -569,10 +569,6 @@ {0fad7d2a-d7dd-45b1-91fd-488bb6cdacea} Umbraco.Examine.Lucene - - {f9b7fe05-0f93-4d0d-9c10-690b33ecbbd8} - Umbraco.Examine - {3ae7bf57-966b-45a5-910a-954d7c554441} Umbraco.Infrastructure diff --git a/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs b/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs index 98301076ef..bdd7c6eb93 100644 --- a/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs @@ -74,7 +74,8 @@ namespace Umbraco.Tests.Web.Mvc Mock.Of(), TestHelper.IOHelper, TestHelper.UriUtility, - httpContextAccessor); + httpContextAccessor, + new AspNetCookieManager(httpContextAccessor)); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(); var umbCtx = umbracoContextReference.UmbracoContext; @@ -105,7 +106,8 @@ namespace Umbraco.Tests.Web.Mvc Mock.Of(), TestHelper.IOHelper, TestHelper.UriUtility, - httpContextAccessor); + httpContextAccessor, + new AspNetCookieManager(httpContextAccessor)); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(); var umbCtx = umbracoContextReference.UmbracoContext; @@ -136,7 +138,8 @@ namespace Umbraco.Tests.Web.Mvc Mock.Of(), TestHelper.IOHelper, TestHelper.UriUtility, - httpContextAccessor); + httpContextAccessor, + new AspNetCookieManager(httpContextAccessor)); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(); var umbCtx = umbracoContextReference.UmbracoContext; @@ -167,7 +170,8 @@ namespace Umbraco.Tests.Web.Mvc Mock.Of(), TestHelper.IOHelper, TestHelper.UriUtility, - httpContextAccessor); + httpContextAccessor, + new AspNetCookieManager(httpContextAccessor)); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(); var umbCtx = umbracoContextReference.UmbracoContext; diff --git a/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs b/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs index d519fa0d2f..2a5ca083ba 100644 --- a/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; @@ -7,7 +6,6 @@ using System.Web.Security; using Moq; using NUnit.Framework; using Umbraco.Core.Cache; -using Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Core.Dictionary; using Umbraco.Core.Logging; using Umbraco.Core.Models.PublishedContent; @@ -18,7 +16,6 @@ using Umbraco.Tests.Testing.Objects.Accessors; using Umbraco.Web; using Umbraco.Web.Mvc; using Umbraco.Web.PublishedCache; -using Umbraco.Web.Routing; using Umbraco.Web.Security; using Umbraco.Web.Security.Providers; using Current = Umbraco.Web.Composing.Current; @@ -50,7 +47,8 @@ namespace Umbraco.Tests.Web.Mvc Mock.Of(), IOHelper, UriUtility, - httpContextAccessor); + httpContextAccessor, + new AspNetCookieManager(httpContextAccessor)); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(); var umbracoContext = umbracoContextReference.UmbracoContext; @@ -79,7 +77,8 @@ namespace Umbraco.Tests.Web.Mvc Mock.Of(), IOHelper, UriUtility, - httpContextAccessor); + httpContextAccessor, + new AspNetCookieManager(httpContextAccessor)); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(); var umbCtx = umbracoContextReference.UmbracoContext; @@ -111,7 +110,8 @@ namespace Umbraco.Tests.Web.Mvc Mock.Of(), IOHelper, UriUtility, - httpContextAccessor); + httpContextAccessor, + new AspNetCookieManager(httpContextAccessor)); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(); var umbracoContext = umbracoContextReference.UmbracoContext; @@ -137,7 +137,6 @@ namespace Umbraco.Tests.Web.Mvc [Test] public void Mock_Current_Page() { - var webRoutingSettings = Mock.Of(section => section.UrlProviderMode == "Auto"); var globalSettings = TestObjects.GetGlobalSettings(); var httpContextAccessor = TestHelper.GetHttpContextAccessor(); @@ -150,7 +149,8 @@ namespace Umbraco.Tests.Web.Mvc Mock.Of(), IOHelper, UriUtility, - httpContextAccessor); + httpContextAccessor, + new AspNetCookieManager(httpContextAccessor)); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(); var umbracoContext = umbracoContextReference.UmbracoContext; diff --git a/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs b/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs index a8fb6abe2d..bc2b896b49 100644 --- a/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs @@ -445,7 +445,8 @@ namespace Umbraco.Tests.Web.Mvc globalSettings, new TestVariationContextAccessor(), IOHelper, - UriUtility); + UriUtility, + new AspNetCookieManager(httpContextAccessor)); //if (setSingleton) //{ diff --git a/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs b/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs index aad66eff23..08cd84744b 100644 --- a/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs +++ b/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs @@ -36,7 +36,8 @@ namespace Umbraco.Tests.Web TestObjects.GetGlobalSettings(), new TestVariationContextAccessor(), IOHelper, - UriUtility); + UriUtility, + new AspNetCookieManager(httpContextAccessor)); var r1 = new RouteData(); r1.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, umbCtx); @@ -56,7 +57,8 @@ namespace Umbraco.Tests.Web TestObjects.GetGlobalSettings(), new TestVariationContextAccessor(), IOHelper, - UriUtility); + UriUtility, + new AspNetCookieManager(httpContextAccessor)); var r1 = new RouteData(); r1.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, umbCtx); @@ -86,7 +88,8 @@ namespace Umbraco.Tests.Web TestObjects.GetGlobalSettings(), new TestVariationContextAccessor(), IOHelper, - UriUtility); + UriUtility, + new AspNetCookieManager(httpContextAccessor)); var httpContext = Mock.Of(); diff --git a/src/Umbraco.Web/Net/AspNetBackOfficeInfo.cs b/src/Umbraco.Web/AspNet/AspNetBackOfficeInfo.cs similarity index 100% rename from src/Umbraco.Web/Net/AspNetBackOfficeInfo.cs rename to src/Umbraco.Web/AspNet/AspNetBackOfficeInfo.cs diff --git a/src/Umbraco.Web/AspNet/AspNetCookieManager.cs b/src/Umbraco.Web/AspNet/AspNetCookieManager.cs new file mode 100644 index 0000000000..d8fcefa0e1 --- /dev/null +++ b/src/Umbraco.Web/AspNet/AspNetCookieManager.cs @@ -0,0 +1,35 @@ +using System.Web; +using Umbraco.Core.Cookie; + +namespace Umbraco.Web +{ + public class AspNetCookieManager : ICookieManager + { + private readonly IHttpContextAccessor _httpContextAccessor; + + public AspNetCookieManager(IHttpContextAccessor httpContextAccessor) + { + _httpContextAccessor = httpContextAccessor; + } + + public void ExpireCookie(string cookieName) + { + _httpContextAccessor.HttpContext?.ExpireCookie(cookieName); + } + + public string GetCookieValue(string cookieName) + { + return _httpContextAccessor.HttpContext?.Request.GetCookieValue(cookieName); + } + + public void SetCookieValue(string cookieName, string value) + { + _httpContextAccessor.HttpContext?.Response.Cookies.Set(new HttpCookie(cookieName, value)); + } + + public bool HasCookie(string cookieName) + { + return !(GetCookieValue(cookieName) is null); + } + } +} diff --git a/src/Umbraco.Web/Hosting/AspNetHostingEnvironment.cs b/src/Umbraco.Web/AspNet/AspNetHostingEnvironment.cs similarity index 100% rename from src/Umbraco.Web/Hosting/AspNetHostingEnvironment.cs rename to src/Umbraco.Web/AspNet/AspNetHostingEnvironment.cs diff --git a/src/Umbraco.Web/Net/AspNetHttpContextAccessor.cs b/src/Umbraco.Web/AspNet/AspNetHttpContextAccessor.cs similarity index 100% rename from src/Umbraco.Web/Net/AspNetHttpContextAccessor.cs rename to src/Umbraco.Web/AspNet/AspNetHttpContextAccessor.cs diff --git a/src/Umbraco.Web/Net/AspNetIpResolver.cs b/src/Umbraco.Web/AspNet/AspNetIpResolver.cs similarity index 100% rename from src/Umbraco.Web/Net/AspNetIpResolver.cs rename to src/Umbraco.Web/AspNet/AspNetIpResolver.cs diff --git a/src/Umbraco.Web/Net/AspNetPasswordHasher.cs b/src/Umbraco.Web/AspNet/AspNetPasswordHasher.cs similarity index 100% rename from src/Umbraco.Web/Net/AspNetPasswordHasher.cs rename to src/Umbraco.Web/AspNet/AspNetPasswordHasher.cs diff --git a/src/Umbraco.Web/Net/AspNetSessionIdResolver.cs b/src/Umbraco.Web/AspNet/AspNetSessionIdResolver.cs similarity index 100% rename from src/Umbraco.Web/Net/AspNetSessionIdResolver.cs rename to src/Umbraco.Web/AspNet/AspNetSessionIdResolver.cs diff --git a/src/Umbraco.Web/FrameworkMarchal.cs b/src/Umbraco.Web/AspNet/FrameworkMarchal.cs similarity index 100% rename from src/Umbraco.Web/FrameworkMarchal.cs rename to src/Umbraco.Web/AspNet/FrameworkMarchal.cs diff --git a/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs b/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs index a893fa6b49..a62aad3e5d 100644 --- a/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs +++ b/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs @@ -25,7 +25,7 @@ namespace Umbraco.Web /// /// This binds to appropriate umbraco events in order to trigger the Boot(), Sync() & FlushBatch() calls /// - public class BatchedDatabaseServerMessenger : DatabaseServerMessenger + public class BatchedDatabaseServerMessenger : DatabaseServerMessenger, IBatchedDatabaseServerMessenger { private readonly IUmbracoDatabaseFactory _databaseFactory; private readonly IRequestCache _requestCache; diff --git a/src/Umbraco.Web/Composing/Current.cs b/src/Umbraco.Web/Composing/Current.cs index 40985e97bf..8d4af6703e 100644 --- a/src/Umbraco.Web/Composing/Current.cs +++ b/src/Umbraco.Web/Composing/Current.cs @@ -27,6 +27,7 @@ using Umbraco.Web.Mvc; using Umbraco.Web.PublishedCache; using Umbraco.Web.Routing; using Umbraco.Web.Services; +using Umbraco.Web.Trees; using Umbraco.Web.WebApi; namespace Umbraco.Web.Composing @@ -260,6 +261,7 @@ namespace Umbraco.Web.Composing public static IIpResolver IpResolver => Factory.GetInstance(); public static IUmbracoVersion UmbracoVersion => Factory.GetInstance(); public static IPublishedUrlProvider PublishedUrlProvider => Factory.GetInstance(); + public static IMenuItemCollectionFactory MenuItemCollectionFactory => Factory.GetInstance(); #endregion } diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs index 8cbe51054a..fc7189cf6f 100644 --- a/src/Umbraco.Web/Editors/ContentTypeController.cs +++ b/src/Umbraco.Web/Editors/ContentTypeController.cs @@ -68,8 +68,9 @@ namespace Umbraco.Web.Editors IShortStringHelper shortStringHelper, UmbracoMapper umbracoMapper, IIOHelper ioHelper, - IPublishedUrlProvider publishedUrlProvider) - : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper, umbracoMapper, publishedUrlProvider) + IPublishedUrlProvider publishedUrlProvider, + EditorValidatorCollection editorValidatorCollection) + : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper, umbracoMapper, publishedUrlProvider, editorValidatorCollection) { _serializer = serializer; _globalSettings = globalSettings; diff --git a/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs b/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs index 4abd7d8c02..bca8c28f64 100644 --- a/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs +++ b/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs @@ -5,6 +5,7 @@ using System.Net; using System.Net.Http; using System.Text; using System.Web.Http; +using System.Web.Http.ModelBinding; using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Configuration; @@ -31,6 +32,8 @@ namespace Umbraco.Web.Editors public abstract class ContentTypeControllerBase : UmbracoAuthorizedJsonController where TContentType : class, IContentTypeComposition { + private readonly EditorValidatorCollection _editorValidatorCollection; + protected ContentTypeControllerBase( ICultureDictionary cultureDictionary, IGlobalSettings globalSettings, @@ -43,9 +46,11 @@ namespace Umbraco.Web.Editors UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper, UmbracoMapper umbracoMapper, - IPublishedUrlProvider publishedUrlProvider) + IPublishedUrlProvider publishedUrlProvider, + EditorValidatorCollection editorValidatorCollection) : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper, umbracoMapper, publishedUrlProvider) { + _editorValidatorCollection = editorValidatorCollection; CultureDictionary = cultureDictionary; } @@ -272,7 +277,7 @@ namespace Umbraco.Web.Editors } // execute the external validators - EditorValidator.Validate(ModelState, contentTypeSave); + ValidateExternalValidators(ModelState, contentTypeSave); if (ModelState.IsValid == false) { @@ -364,6 +369,20 @@ namespace Umbraco.Web.Editors } } + private void ValidateExternalValidators(ModelStateDictionary modelState, object model) + { + var modelType = model.GetType(); + + var validationResults = _editorValidatorCollection + .Where(x => x.ModelType == modelType) + .SelectMany(x => x.Validate(model)) + .Where(x => !string.IsNullOrWhiteSpace(x.ErrorMessage) && x.MemberNames.Any()); + + foreach (var r in validationResults) + foreach (var m in r.MemberNames) + modelState.AddModelError(m, r.ErrorMessage); + } + /// /// Move /// diff --git a/src/Umbraco.Web/Editors/EditorValidator.cs b/src/Umbraco.Web/Editors/EditorValidator.cs deleted file mode 100644 index af355206a5..0000000000 --- a/src/Umbraco.Web/Editors/EditorValidator.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Linq; -using System.Web.Http.ModelBinding; -using Umbraco.Web.Composing; - -namespace Umbraco.Web.Editors -{ - /// - /// Provides a method to validate an object using validation. - /// - internal static class EditorValidator - { - /// - /// Validates an object. - /// - public static void Validate(ModelStateDictionary modelState, object model) - { - var modelType = model.GetType(); - - var validationResults = Current.EditorValidators // TODO: inject - .Where(x => x.ModelType == modelType) - .SelectMany(x => x.Validate(model)) - .Where(x => !string.IsNullOrWhiteSpace(x.ErrorMessage) && x.MemberNames.Any()); - - foreach (var r in validationResults) - foreach (var m in r.MemberNames) - modelState.AddModelError(m, r.ErrorMessage); - } - } -} diff --git a/src/Umbraco.Web/Editors/DataTypeValidateAttribute.cs b/src/Umbraco.Web/Editors/Filters/DataTypeValidateAttribute.cs similarity index 100% rename from src/Umbraco.Web/Editors/DataTypeValidateAttribute.cs rename to src/Umbraco.Web/Editors/Filters/DataTypeValidateAttribute.cs diff --git a/src/Umbraco.Web/Editors/MediaTypeController.cs b/src/Umbraco.Web/Editors/MediaTypeController.cs index 7aa2c028a2..f4c8f89e28 100644 --- a/src/Umbraco.Web/Editors/MediaTypeController.cs +++ b/src/Umbraco.Web/Editors/MediaTypeController.cs @@ -55,8 +55,9 @@ namespace Umbraco.Web.Editors IShortStringHelper shortStringHelper, UmbracoMapper umbracoMapper, IEntityService entityService, - IPublishedUrlProvider publishedUrlProvider) - : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper, umbracoMapper, publishedUrlProvider) + IPublishedUrlProvider publishedUrlProvider, + EditorValidatorCollection editorValidatorCollection) + : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper, umbracoMapper, publishedUrlProvider, editorValidatorCollection) { _shortStringHelper = shortStringHelper; _entityService = entityService ?? throw new ArgumentNullException(nameof(entityService)); diff --git a/src/Umbraco.Web/Editors/MemberTypeController.cs b/src/Umbraco.Web/Editors/MemberTypeController.cs index 9176de3e37..fd071d5e5c 100644 --- a/src/Umbraco.Web/Editors/MemberTypeController.cs +++ b/src/Umbraco.Web/Editors/MemberTypeController.cs @@ -42,8 +42,9 @@ namespace Umbraco.Web.Editors UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper, UmbracoMapper umbracoMapper, - IPublishedUrlProvider publishedUrlProvider) - : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper, umbracoMapper, publishedUrlProvider) + IPublishedUrlProvider publishedUrlProvider, + EditorValidatorCollection editorValidatorCollection) + : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper, umbracoMapper, publishedUrlProvider, editorValidatorCollection) { } diff --git a/src/Umbraco.Web/Editors/PreviewController.cs b/src/Umbraco.Web/Editors/PreviewController.cs index 0b7b4e2b43..eedc134d36 100644 --- a/src/Umbraco.Web/Editors/PreviewController.cs +++ b/src/Umbraco.Web/Editors/PreviewController.cs @@ -6,6 +6,7 @@ using System.Web.UI; using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.UmbracoSettings; +using Umbraco.Core.Cookie; using Umbraco.Core.Hosting; using Umbraco.Core.IO; using Umbraco.Core.Services; @@ -34,6 +35,7 @@ namespace Umbraco.Web.Editors private readonly TreeCollection _treeCollection; private readonly IHttpContextAccessor _httpContextAccessor; private readonly IHostingEnvironment _hostingEnvironment; + private readonly ICookieManager _cookieManager; public PreviewController( UmbracoFeatures features, @@ -46,7 +48,8 @@ namespace Umbraco.Web.Editors IIOHelper ioHelper, TreeCollection treeCollection, IHttpContextAccessor httpContextAccessor, - IHostingEnvironment hostingEnvironment) + IHostingEnvironment hostingEnvironment, + ICookieManager cookieManager) { _features = features; _globalSettings = globalSettings; @@ -59,6 +62,7 @@ namespace Umbraco.Web.Editors _treeCollection = treeCollection; _httpContextAccessor = httpContextAccessor; _hostingEnvironment = hostingEnvironment; + _cookieManager = cookieManager; } [UmbracoAuthorize(redirectToUmbracoLogin: true)] @@ -117,7 +121,7 @@ namespace Umbraco.Web.Editors public ActionResult End(string redir = null) { - var previewToken = Request.GetPreviewCookieValue(); + var previewToken = _cookieManager.GetPreviewCookieValue(); var service = Current.PublishedSnapshotService; service.ExitPreview(previewToken); diff --git a/src/Umbraco.Web/HttpCookieExtensions.cs b/src/Umbraco.Web/HttpCookieExtensions.cs index 5f520653f5..26490771cd 100644 --- a/src/Umbraco.Web/HttpCookieExtensions.cs +++ b/src/Umbraco.Web/HttpCookieExtensions.cs @@ -5,6 +5,7 @@ using System.Net.Http.Headers; using System.Web; using Microsoft.Owin; using Umbraco.Core; +using Umbraco.Core.Cookie; namespace Umbraco.Web { @@ -97,34 +98,18 @@ namespace Umbraco.Web return null; } - public static string GetPreviewCookieValue(this HttpRequestBase request) + public static string GetPreviewCookieValue(this ICookieManager cookieManager) { - return request.GetCookieValue(Constants.Web.PreviewCookieName); + return cookieManager.GetCookieValue(Constants.Web.PreviewCookieName); } - - public static string GetPreviewCookieValue(this HttpRequest request) - { - return new HttpRequestWrapper(request).GetPreviewCookieValue(); - } - /// /// Does a preview cookie exist ? /// /// /// - public static bool HasPreviewCookie(this HttpRequestBase request) + public static bool HasPreviewCookie(this ICookieManager cookieManager) { - return request.Cookies[Constants.Web.PreviewCookieName] != null; - } - - /// - /// Does a preview cookie exist ? - /// - /// - /// - public static bool HasPreviewCookie(this HttpRequest request) - { - return new HttpRequestWrapper(request).HasPreviewCookie(); + return cookieManager.HasCookie(Constants.Web.PreviewCookieName); } /// diff --git a/src/Umbraco.Web/Install/Controllers/InstallApiController.cs b/src/Umbraco.Web/Install/Controllers/InstallApiController.cs index d151df46f7..3b8e9b48d3 100644 --- a/src/Umbraco.Web/Install/Controllers/InstallApiController.cs +++ b/src/Umbraco.Web/Install/Controllers/InstallApiController.cs @@ -20,13 +20,15 @@ namespace Umbraco.Web.Install.Controllers private readonly DatabaseBuilder _databaseBuilder; private readonly IProfilingLogger _proflog; private readonly InstallStepCollection _installSteps; + private readonly InstallStatusTracker _installStatusTracker; private readonly ILogger _logger; - public InstallApiController(DatabaseBuilder databaseBuilder, IProfilingLogger proflog, InstallHelper installHelper, InstallStepCollection installSteps) + public InstallApiController(DatabaseBuilder databaseBuilder, IProfilingLogger proflog, InstallHelper installHelper, InstallStepCollection installSteps, InstallStatusTracker installStatusTracker) { _databaseBuilder = databaseBuilder ?? throw new ArgumentNullException(nameof(databaseBuilder)); _proflog = proflog ?? throw new ArgumentNullException(nameof(proflog)); _installSteps = installSteps; + _installStatusTracker = installStatusTracker; InstallHelper = installHelper; _logger = _proflog; } @@ -56,7 +58,7 @@ namespace Umbraco.Web.Install.Controllers steps.AddRange(installSteps); setup.Steps = steps; - InstallStatusTracker.Initialize(setup.InstallId, installSteps); + _installStatusTracker.Initialize(setup.InstallId, installSteps); return setup; } @@ -78,7 +80,7 @@ namespace Umbraco.Web.Install.Controllers //there won't be any statuses returned if the app pool has restarted so we need to re-read from file. if (status.Any() == false) { - status = InstallStatusTracker.InitializeFromFile(installModel.InstallId).ToArray(); + status = _installStatusTracker.InitializeFromFile(installModel.InstallId).ToArray(); } //create a new queue of the non-finished ones @@ -95,7 +97,7 @@ namespace Umbraco.Web.Install.Controllers if (StepRequiresExecution(step, instruction) == false) { // set this as complete and continue - InstallStatusTracker.SetComplete(installModel.InstallId, item.Name); + _installStatusTracker.SetComplete(installModel.InstallId, item.Name); continue; } @@ -104,7 +106,7 @@ namespace Umbraco.Web.Install.Controllers var setupData = await ExecuteStepAsync(step, instruction); // update the status - InstallStatusTracker.SetComplete(installModel.InstallId, step.Name, setupData?.SavedStepData); + _installStatusTracker.SetComplete(installModel.InstallId, step.Name, setupData?.SavedStepData); // determine's the next step in the queue and dequeue's any items that don't need to execute var nextStep = IterateSteps(step, queue, installModel.InstallId, installModel); @@ -147,7 +149,7 @@ namespace Umbraco.Web.Install.Controllers } } - InstallStatusTracker.Reset(); + _installStatusTracker.Reset(); return new InstallProgressResultModel(true, "", ""); } @@ -175,7 +177,7 @@ namespace Umbraco.Web.Install.Controllers var step = _installSteps.GetAllSteps().Single(x => x.Name == item.Name); // if this step has any instructions then extract them - JToken instruction; + object instruction; installModel.Instructions.TryGetValue(item.Name, out instruction); // else null // if the step requires execution then return its name @@ -187,7 +189,7 @@ namespace Umbraco.Web.Install.Controllers queue.Dequeue(); // complete - InstallStatusTracker.SetComplete(installId, step.Name); + _installStatusTracker.SetComplete(installId, step.Name); // and continue current = step; @@ -197,9 +199,17 @@ namespace Umbraco.Web.Install.Controllers } // determines whether the step requires execution - internal bool StepRequiresExecution(InstallSetupStep step, JToken instruction) + internal bool StepRequiresExecution(InstallSetupStep step, object instruction) { - var model = instruction?.ToObject(step.StepType); + if (step == null) throw new ArgumentNullException(nameof(step)); + + var modelAttempt = instruction.TryConvertTo(step.StepType); + if (!modelAttempt.Success) + { + throw new InvalidCastException($"Cannot cast/convert {step.GetType().FullName} into {step.StepType.FullName}"); + } + + var model = modelAttempt.Result; var genericStepType = typeof(InstallSetupStep<>); Type[] typeArgs = { step.StepType }; var typedStepType = genericStepType.MakeGenericType(typeArgs); @@ -216,11 +226,11 @@ namespace Umbraco.Web.Install.Controllers } // executes the step - internal async Task ExecuteStepAsync(InstallSetupStep step, JToken instruction) + internal async Task ExecuteStepAsync(InstallSetupStep step, object instruction) { using (_proflog.TraceDuration($"Executing installation step: '{step.Name}'.", "Step completed")) { - var model = instruction?.ToObject(step.StepType); + var model = Convert.ChangeType(instruction, step.StepType); var genericStepType = typeof(InstallSetupStep<>); Type[] typeArgs = { step.StepType }; var typedStepType = genericStepType.MakeGenericType(typeArgs); diff --git a/src/Umbraco.Web/Install/FilePermissionHelper.cs b/src/Umbraco.Web/Install/FilePermissionHelper.cs index 7fc40a1202..24649b4391 100644 --- a/src/Umbraco.Web/Install/FilePermissionHelper.cs +++ b/src/Umbraco.Web/Install/FilePermissionHelper.cs @@ -7,11 +7,11 @@ using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Core.Install; using Umbraco.Core.IO; -using Umbraco.Web.Composing; +using Umbraco.Web.PublishedCache; namespace Umbraco.Web.Install { - internal class FilePermissionHelper : IFilePermissionHelper + public class FilePermissionHelper : IFilePermissionHelper { // ensure that these directories exist and Umbraco can write to them private readonly string[] _permissionDirs; @@ -21,11 +21,13 @@ namespace Umbraco.Web.Install private readonly string[] _permissionFiles = { }; private readonly IGlobalSettings _globalSettings; private readonly IIOHelper _ioHelper; + private readonly IPublishedSnapshotService _publishedSnapshotService; - public FilePermissionHelper(IGlobalSettings globalSettings, IIOHelper ioHelper) + public FilePermissionHelper(IGlobalSettings globalSettings, IIOHelper ioHelper, IPublishedSnapshotService publishedSnapshotService) { _globalSettings = globalSettings; _ioHelper = ioHelper; + _publishedSnapshotService = publishedSnapshotService; _permissionDirs = new[] { _globalSettings.UmbracoCssPath, Constants.SystemDirectories.Config, Constants.SystemDirectories.Data, _globalSettings.UmbracoMediaPath, Constants.SystemDirectories.Preview }; _packagesPermissionsDirs = new[] { Constants.SystemDirectories.Bin, _globalSettings.UmbracoPath, Constants.SystemDirectories.Packages }; } @@ -48,7 +50,7 @@ namespace Umbraco.Web.Install if (TestPublishedSnapshotService(out errors) == false) report["Published snapshot environment check failed"] = errors.ToList(); - if (EnsureCanCreateSubDirectory(Current.Configs.Global().UmbracoMediaPath, out errors) == false) + if (EnsureCanCreateSubDirectory(_globalSettings.UmbracoMediaPath, out errors) == false) report["Media folder creation failed"] = errors.ToList(); } @@ -129,8 +131,7 @@ namespace Umbraco.Web.Install public bool TestPublishedSnapshotService(out IEnumerable errors) { - var publishedSnapshotService = Current.PublishedSnapshotService; - return publishedSnapshotService.EnsureEnvironment(out errors); + return _publishedSnapshotService.EnsureEnvironment(out errors); } // tries to create a sub-directory @@ -140,7 +141,7 @@ namespace Umbraco.Web.Install { try { - var path = _ioHelper.MapPath(dir + "/" + CreateRandomName()); + var path = _ioHelper.MapPath(dir + "/" + _ioHelper.CreateRandomFileName()); Directory.CreateDirectory(path); Directory.Delete(path); return true; @@ -151,29 +152,6 @@ namespace Umbraco.Web.Install } } - // tries to create a file - // if successful, the file is deleted - // creates the directory if needed - does not delete it - public bool TryCreateDirectory(string dir) - { - try - { - var dirPath = _ioHelper.MapPath(dir); - - if (Directory.Exists(dirPath) == false) - Directory.CreateDirectory(dirPath); - - var filePath = dirPath + "/" + CreateRandomName() + ".tmp"; - File.WriteAllText(filePath, "This is an Umbraco internal test file. It is safe to delete it."); - File.Delete(filePath); - return true; - } - catch - { - return false; - } - } - // tries to create a file // if successful, the file is deleted // @@ -193,7 +171,7 @@ namespace Umbraco.Web.Install if (canWrite) { - var filePath = dirPath + "/" + CreateRandomName() + ".tmp"; + var filePath = dirPath + "/" + _ioHelper.CreateRandomFileName() + ".tmp"; File.WriteAllText(filePath, "This is an Umbraco internal test file. It is safe to delete it."); File.Delete(filePath); return true; @@ -260,10 +238,5 @@ namespace Umbraco.Web.Install return false; } } - - private string CreateRandomName() - { - return "umbraco-test." + Guid.NewGuid().ToString("N").Substring(0, 8); - } } } diff --git a/src/Umbraco.Web/Install/InstallHelper.cs b/src/Umbraco.Web/Install/InstallHelper.cs index 14845f832c..f7344d0b0b 100644 --- a/src/Umbraco.Web/Install/InstallHelper.cs +++ b/src/Umbraco.Web/Install/InstallHelper.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Web; using Umbraco.Core; using Umbraco.Core.Configuration; +using Umbraco.Core.Cookie; using Umbraco.Core.Logging; using Umbraco.Core.Migrations.Install; using Umbraco.Core.Models; @@ -27,6 +28,7 @@ namespace Umbraco.Web.Install private readonly IUmbracoVersion _umbracoVersion; private readonly IConnectionStrings _connectionStrings; private readonly IInstallationService _installationService; + private readonly ICookieManager _cookieManager; private InstallationType? _installationType; public InstallHelper(IHttpContextAccessor httpContextAccessor, @@ -35,7 +37,8 @@ namespace Umbraco.Web.Install IGlobalSettings globalSettings, IUmbracoVersion umbracoVersion, IConnectionStrings connectionStrings, - IInstallationService installationService) + IInstallationService installationService, + ICookieManager cookieManager) { _httpContextAccessor = httpContextAccessor; _logger = logger; @@ -44,6 +47,7 @@ namespace Umbraco.Web.Install _databaseBuilder = databaseBuilder; _connectionStrings = connectionStrings ?? throw new ArgumentNullException(nameof(connectionStrings)); _installationService = installationService; + _cookieManager = cookieManager; } public InstallationType GetInstallationType() @@ -51,17 +55,18 @@ namespace Umbraco.Web.Install return _installationType ?? (_installationType = IsBrandNewInstall ? InstallationType.NewInstall : InstallationType.Upgrade).Value; } - internal async Task InstallStatus(bool isCompleted, string errorMsg) + public async Task InstallStatus(bool isCompleted, string errorMsg) { + + var httpContext = _httpContextAccessor.GetRequiredHttpContext(); try { - var httpContext = _httpContextAccessor.GetRequiredHttpContext(); var userAgent = httpContext.Request.UserAgent; // Check for current install Id var installId = Guid.NewGuid(); - var installCookie = httpContext.Request.GetCookieValue(Constants.Web.InstallerCookieName); + var installCookie = _cookieManager.GetCookieValue(Constants.Web.InstallerCookieName); if (string.IsNullOrEmpty(installCookie) == false) { if (Guid.TryParse(installCookie, out installId)) @@ -75,7 +80,8 @@ namespace Umbraco.Web.Install installId = Guid.NewGuid(); // Guid.TryParse will have reset installId to Guid.Empty } } - httpContext.Response.Cookies.Set(new HttpCookie(Constants.Web.InstallerCookieName, installId.ToString())); + + _cookieManager.SetCookieValue(Constants.Web.InstallerCookieName, installId.ToString()); var dbProvider = string.Empty; if (IsBrandNewInstall == false) @@ -143,7 +149,7 @@ namespace Umbraco.Web.Install } } - internal IEnumerable GetStarterKits() + public IEnumerable GetStarterKits() { if (_httpClient == null) _httpClient = new HttpClient(); diff --git a/src/Umbraco.Web/Macros/MacroRenderer.cs b/src/Umbraco.Web/Macros/MacroRenderer.cs index a776c4f65e..013f54c5fc 100755 --- a/src/Umbraco.Web/Macros/MacroRenderer.cs +++ b/src/Umbraco.Web/Macros/MacroRenderer.cs @@ -7,6 +7,7 @@ using System.Text; using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Configuration.UmbracoSettings; +using Umbraco.Core.Cookie; using Umbraco.Core.Events; using Umbraco.Core.IO; using Umbraco.Core.Logging; @@ -27,10 +28,11 @@ namespace Umbraco.Web.Macros private readonly AppCaches _appCaches; private readonly IMacroService _macroService; private readonly IIOHelper _ioHelper; + private readonly ICookieManager _cookieManager; private readonly IUserService _userService; private readonly IHttpContextAccessor _httpContextAccessor; - public MacroRenderer(IProfilingLogger plogger, IUmbracoContextAccessor umbracoContextAccessor, IContentSection contentSection, ILocalizedTextService textService, AppCaches appCaches, IMacroService macroService, IUserService userService, IHttpContextAccessor httpContextAccessor, IIOHelper ioHelper) + public MacroRenderer(IProfilingLogger plogger, IUmbracoContextAccessor umbracoContextAccessor, IContentSection contentSection, ILocalizedTextService textService, AppCaches appCaches, IMacroService macroService, IUserService userService, IHttpContextAccessor httpContextAccessor, IIOHelper ioHelper, ICookieManager cookieManager) { _plogger = plogger ?? throw new ArgumentNullException(nameof(plogger)); _umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor)); @@ -39,6 +41,7 @@ namespace Umbraco.Web.Macros _appCaches = appCaches ?? throw new ArgumentNullException(nameof(appCaches)); _macroService = macroService ?? throw new ArgumentNullException(nameof(macroService)); _ioHelper = ioHelper ?? throw new ArgumentNullException(nameof(ioHelper)); + _cookieManager = cookieManager; _userService = userService ?? throw new ArgumentNullException(nameof(userService)); _httpContextAccessor = httpContextAccessor; } @@ -419,7 +422,7 @@ namespace Umbraco.Web.Macros case '%': attributeValue = context?.Session[name]?.ToString(); if (string.IsNullOrEmpty(attributeValue)) - attributeValue = context?.Request.GetCookieValue(name); + attributeValue = _cookieManager.GetCookieValue(name); break; case '#': attributeValue = pageElements[name]?.ToString(); diff --git a/src/Umbraco.Web/Models/Mapping/CommonMapper.cs b/src/Umbraco.Web/Models/Mapping/CommonMapper.cs index 748ffe07f9..b1e511670f 100644 --- a/src/Umbraco.Web/Models/Mapping/CommonMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/CommonMapper.cs @@ -17,24 +17,24 @@ using UserProfile = Umbraco.Web.Models.ContentEditing.UserProfile; namespace Umbraco.Web.Models.Mapping { - internal class CommonMapper + public class CommonMapper { private readonly IUserService _userService; private readonly IContentTypeBaseServiceProvider _contentTypeBaseServiceProvider; - private readonly IUmbracoContextAccessor _umbracoContextAccessor; private readonly ContentAppFactoryCollection _contentAppDefinitions; private readonly ILocalizedTextService _localizedTextService; private readonly IHttpContextAccessor _httpContextAccessor; + private readonly IUmbracoContextAccessor _umbracoContextAccessor; public CommonMapper(IUserService userService, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IUmbracoContextAccessor umbracoContextAccessor, ContentAppFactoryCollection contentAppDefinitions, ILocalizedTextService localizedTextService, IHttpContextAccessor httpContextAccessor) { _userService = userService; _contentTypeBaseServiceProvider = contentTypeBaseServiceProvider; - _umbracoContextAccessor = umbracoContextAccessor; _contentAppDefinitions = contentAppDefinitions; _localizedTextService = localizedTextService; _httpContextAccessor = httpContextAccessor; + _umbracoContextAccessor = umbracoContextAccessor; } public UserProfile GetOwner(IContentBase source, MapperContext context) diff --git a/src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs index d02e88ef4b..f42e8d5d37 100644 --- a/src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs +++ b/src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs @@ -15,7 +15,7 @@ namespace Umbraco.Web.Models.Mapping /// /// Declares model mappings for media. /// - internal class MediaMapDefinition : IMapDefinition + public class MediaMapDefinition : IMapDefinition { private readonly CommonMapper _commonMapper; private readonly IMediaService _mediaService; diff --git a/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs index ee241f3245..d47f9df7c7 100644 --- a/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs +++ b/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs @@ -8,7 +8,7 @@ namespace Umbraco.Web.Models.Mapping /// /// Declares model mappings for members. /// - internal class MemberMapDefinition : IMapDefinition + public class MemberMapDefinition : IMapDefinition { private readonly CommonMapper _commonMapper; private readonly MemberTabsAndPropertiesMapper _tabsAndPropertiesMapper; diff --git a/src/Umbraco.Web/Net/AspNetCookieManager.cs b/src/Umbraco.Web/Net/AspNetCookieManager.cs deleted file mode 100644 index 2b5318110d..0000000000 --- a/src/Umbraco.Web/Net/AspNetCookieManager.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Umbraco.Core.Cookie; - -namespace Umbraco.Web -{ - public class AspNetCookieManager : ICookieManager - { - private readonly IHttpContextAccessor _httpContextAccessor; - - public AspNetCookieManager(IHttpContextAccessor httpContextAccessor) - { - _httpContextAccessor = httpContextAccessor; - } - - public void ExpireCookie(string cookieName) - { - _httpContextAccessor.HttpContext?.ExpireCookie(cookieName); - } - } -} diff --git a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs index da3342a682..32076af7af 100644 --- a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs @@ -40,8 +40,6 @@ namespace Umbraco.Web.PropertyEditors /// public RichTextPropertyEditor( ILogger logger, - IMediaService mediaService, - IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IUmbracoContextAccessor umbracoContextAccessor, IDataTypeService dataTypeService, ILocalizationService localizationService, diff --git a/src/Umbraco.Web/PropertyEditors/ValueConverters/RteMacroRenderingValueConverter.cs b/src/Umbraco.Web/PropertyEditors/ValueConverters/RteMacroRenderingValueConverter.cs index 67031faaa0..60857fd76c 100644 --- a/src/Umbraco.Web/PropertyEditors/ValueConverters/RteMacroRenderingValueConverter.cs +++ b/src/Umbraco.Web/PropertyEditors/ValueConverters/RteMacroRenderingValueConverter.cs @@ -1,17 +1,12 @@ using System.Text; using Umbraco.Core; -using Umbraco.Core.Macros; using Umbraco.Core.PropertyEditors; using Umbraco.Core.Models.PublishedContent; using Umbraco.Core.PropertyEditors.ValueConverters; using Umbraco.Web.Templates; using System.Linq; using HtmlAgilityPack; -using Umbraco.Core.Cache; -using Umbraco.Core.Services; -using Umbraco.Web.Composing; using Umbraco.Web.Macros; -using System.Web; using Umbraco.Core.Strings; namespace Umbraco.Web.PropertyEditors.ValueConverters diff --git a/src/Umbraco.Web/Scheduling/SchedulerComponent.cs b/src/Umbraco.Web/Scheduling/SchedulerComponent.cs index ca6f0729eb..061f42b9ba 100644 --- a/src/Umbraco.Web/Scheduling/SchedulerComponent.cs +++ b/src/Umbraco.Web/Scheduling/SchedulerComponent.cs @@ -11,9 +11,9 @@ using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Scoping; using Umbraco.Core.Services; +using Umbraco.Core.Sync; using Umbraco.Web.HealthCheck; using Umbraco.Web.Routing; -using Current = Umbraco.Web.Composing.Current; namespace Umbraco.Web.Scheduling { @@ -36,6 +36,7 @@ namespace Umbraco.Web.Scheduling private readonly IHealthChecks _healthChecksConfig; private readonly IUmbracoSettingsSection _umbracoSettingsSection; private readonly IIOHelper _ioHelper; + private readonly IServerMessenger _serverMessenger; private BackgroundTaskRunner _keepAliveRunner; private BackgroundTaskRunner _publishingRunner; @@ -53,7 +54,7 @@ namespace Umbraco.Web.Scheduling HealthCheckCollection healthChecks, HealthCheckNotificationMethodCollection notifications, IScopeProvider scopeProvider, IUmbracoContextFactory umbracoContextFactory, IProfilingLogger logger, IHostingEnvironment hostingEnvironment, IHealthChecks healthChecksConfig, - IUmbracoSettingsSection umbracoSettingsSection, IIOHelper ioHelper) + IUmbracoSettingsSection umbracoSettingsSection, IIOHelper ioHelper, IServerMessenger serverMessenger) { _runtime = runtime; _contentService = contentService; @@ -68,6 +69,7 @@ namespace Umbraco.Web.Scheduling _healthChecksConfig = healthChecksConfig ?? throw new ArgumentNullException(nameof(healthChecksConfig)); _umbracoSettingsSection = umbracoSettingsSection ?? throw new ArgumentNullException(nameof(umbracoSettingsSection)); _ioHelper = ioHelper; + _serverMessenger = serverMessenger; } public void Initialize() @@ -140,7 +142,7 @@ namespace Umbraco.Web.Scheduling { // scheduled publishing/unpublishing // install on all, will only run on non-replica servers - var task = new ScheduledPublishing(_publishingRunner, DefaultDelayMilliseconds, OneMinuteMilliseconds, _runtime, _contentService, _umbracoContextFactory, _logger); + var task = new ScheduledPublishing(_publishingRunner, DefaultDelayMilliseconds, OneMinuteMilliseconds, _runtime, _contentService, _umbracoContextFactory, _logger, _serverMessenger); _publishingRunner.TryAdd(task); return task; } diff --git a/src/Umbraco.Web/Security/IdentityAuditEventArgs.cs b/src/Umbraco.Web/Security/IdentityAuditEventArgs.cs index 81407afe50..5847250b41 100644 --- a/src/Umbraco.Web/Security/IdentityAuditEventArgs.cs +++ b/src/Umbraco.Web/Security/IdentityAuditEventArgs.cs @@ -1,6 +1,6 @@ using System; using System.Threading; -using Umbraco.Core.Security; + namespace Umbraco.Web.Security { diff --git a/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs b/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs index fd05f7cfbd..843a1cef0c 100644 --- a/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs @@ -1,11 +1,18 @@ using System.Linq; using System.Net.Http.Formatting; using Umbraco.Core; +using Umbraco.Core.Cache; +using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; +using Umbraco.Core.Mapping; using Umbraco.Core.Models; using Umbraco.Core.Models.Entities; +using Umbraco.Core.Persistence; +using Umbraco.Core.Services; using Umbraco.Web.Actions; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; +using Umbraco.Web.Routing; using Umbraco.Web.WebApi.Filters; using Constants = Umbraco.Core.Constants; @@ -23,6 +30,24 @@ namespace Umbraco.Web.Trees [CoreTree] public class ContentBlueprintTreeController : TreeController { + private readonly IMenuItemCollectionFactory _menuItemCollectionFactory; + + public ContentBlueprintTreeController( + IGlobalSettings globalSettings, + IUmbracoContextAccessor umbracoContextAccessor, + ISqlContext sqlContext, + ServiceContext services, + AppCaches appCaches, + IProfilingLogger logger, + IRuntimeState runtimeState, + UmbracoHelper umbracoHelper, + UmbracoMapper umbracoMapper, + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) + : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) + { + _menuItemCollectionFactory = menuItemCollectionFactory; + } protected override TreeNode CreateRootNode(FormDataCollection queryStrings) { @@ -89,7 +114,7 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { - var menu = new MenuItemCollection(); + var menu = _menuItemCollectionFactory.Create(); if (id == Constants.System.RootString) { diff --git a/src/Umbraco.Web/Trees/ContentTreeController.cs b/src/Umbraco.Web/Trees/ContentTreeController.cs index bb7613422e..9b64111b85 100644 --- a/src/Umbraco.Web/Trees/ContentTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTreeController.cs @@ -42,6 +42,7 @@ namespace Umbraco.Web.Trees private readonly UmbracoTreeSearcher _treeSearcher; private readonly ActionCollection _actions; private readonly IGlobalSettings _globalSettings; + private readonly IMenuItemCollectionFactory _menuItemCollectionFactory; protected override int RecycleBinId => Constants.System.RecycleBinContent; @@ -64,12 +65,14 @@ namespace Umbraco.Web.Trees IRuntimeState runtimeState, UmbracoHelper umbracoHelper, UmbracoMapper umbracoMapper, - IPublishedUrlProvider publishedUrlProvider) - : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) + : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider, menuItemCollectionFactory) { _treeSearcher = treeSearcher; _actions = actions; _globalSettings = globalSettings; + _menuItemCollectionFactory = menuItemCollectionFactory; } /// @@ -133,7 +136,7 @@ namespace Umbraco.Web.Trees { if (id == Constants.System.RootString) { - var menu = new MenuItemCollection(); + var menu = _menuItemCollectionFactory.Create(); // if the user's start node is not the root then the only menu item to display is refresh if (UserStartNodes.Contains(Constants.System.Root) == false) @@ -184,7 +187,7 @@ namespace Umbraco.Web.Trees //if the user has no path access for this node, all they can do is refresh if (!Security.CurrentUser.HasContentPathAccess(item, Services.EntityService)) { - var menu = new MenuItemCollection(); + var menu = _menuItemCollectionFactory.Create(); menu.Items.Add(new RefreshNode(Services.TextService, true)); return menu; } @@ -246,7 +249,7 @@ namespace Umbraco.Web.Trees /// protected MenuItemCollection GetAllNodeMenuItems(IUmbracoEntity item) { - var menu = new MenuItemCollection(); + var menu = _menuItemCollectionFactory.Create(); AddActionNode(item, menu, opensDialog: true); AddActionNode(item, menu, opensDialog: true); AddActionNode(item, menu, opensDialog: true); @@ -282,7 +285,7 @@ namespace Umbraco.Web.Trees /// protected MenuItemCollection GetNodeMenuItemsForDeletedContent(IUmbracoEntity item) { - var menu = new MenuItemCollection(); + var menu = _menuItemCollectionFactory.Create(); menu.Items.Add(Services.TextService, opensDialog: true); menu.Items.Add(Services.TextService, opensDialog: true); menu.Items.Add(Services.TextService, opensDialog: true); diff --git a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs index 71196b84c3..7646a71e7d 100644 --- a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs +++ b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs @@ -28,6 +28,8 @@ namespace Umbraco.Web.Trees { public abstract class ContentTreeControllerBase : TreeController { + public IMenuItemCollectionFactory MenuItemCollectionFactory { get; } + protected ContentTreeControllerBase( IGlobalSettings globalSettings, @@ -39,9 +41,11 @@ namespace Umbraco.Web.Trees IRuntimeState runtimeState, UmbracoHelper umbracoHelper, UmbracoMapper umbracoMapper, - IPublishedUrlProvider publishedUrlProvider) + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) { + MenuItemCollectionFactory = menuItemCollectionFactory; } protected ContentTreeControllerBase() @@ -430,7 +434,7 @@ namespace Umbraco.Web.Trees deleteAllowed = perms.FirstOrDefault(x => x.Contains(deleteAction.Letter)) != null; } - var menu = new MenuItemCollection(); + var menu = MenuItemCollectionFactory.Create(); // only add empty recycle bin if the current user is allowed to delete by default if (deleteAllowed) { diff --git a/src/Umbraco.Web/Trees/ContentTypeTreeController.cs b/src/Umbraco.Web/Trees/ContentTypeTreeController.cs index f150eb8ba0..afd89f967a 100644 --- a/src/Umbraco.Web/Trees/ContentTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTypeTreeController.cs @@ -27,6 +27,7 @@ namespace Umbraco.Web.Trees public class ContentTypeTreeController : TreeController, ISearchableTree { private readonly UmbracoTreeSearcher _treeSearcher; + private readonly IMenuItemCollectionFactory _menuItemCollectionFactory; public ContentTypeTreeController( UmbracoTreeSearcher treeSearcher, @@ -39,10 +40,12 @@ namespace Umbraco.Web.Trees IRuntimeState runtimeState, UmbracoHelper umbracoHelper, UmbracoMapper umbracoMapper, - IPublishedUrlProvider publishedUrlProvider) + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) { _treeSearcher = treeSearcher; + _menuItemCollectionFactory = menuItemCollectionFactory; } protected override TreeNode CreateRootNode(FormDataCollection queryStrings) @@ -103,7 +106,7 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { - var menu = new MenuItemCollection(); + var menu = _menuItemCollectionFactory.Create(); if (id == Constants.System.RootString) { diff --git a/src/Umbraco.Web/Trees/DataTypeTreeController.cs b/src/Umbraco.Web/Trees/DataTypeTreeController.cs index 7c4da2cf0f..100a5ffe7a 100644 --- a/src/Umbraco.Web/Trees/DataTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/DataTypeTreeController.cs @@ -29,6 +29,7 @@ namespace Umbraco.Web.Trees public class DataTypeTreeController : TreeController, ISearchableTree { private readonly UmbracoTreeSearcher _treeSearcher; + private readonly IMenuItemCollectionFactory _menuItemCollectionFactory; public DataTypeTreeController( UmbracoTreeSearcher treeSearcher, @@ -41,10 +42,12 @@ namespace Umbraco.Web.Trees IRuntimeState runtimeState, UmbracoHelper umbracoHelper, UmbracoMapper umbracoMapper, - IPublishedUrlProvider publishedUrlProvider) + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) { _treeSearcher = treeSearcher; + _menuItemCollectionFactory = menuItemCollectionFactory; } protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) @@ -128,7 +131,7 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { - var menu = new MenuItemCollection(); + var menu = _menuItemCollectionFactory.Create(); if (id == Constants.System.RootString) { diff --git a/src/Umbraco.Web/Trees/DictionaryTreeController.cs b/src/Umbraco.Web/Trees/DictionaryTreeController.cs index 3f7b89bcdf..b8d16062ba 100644 --- a/src/Umbraco.Web/Trees/DictionaryTreeController.cs +++ b/src/Umbraco.Web/Trees/DictionaryTreeController.cs @@ -2,9 +2,16 @@ using System.Linq; using System.Net.Http.Formatting; using Umbraco.Core; +using Umbraco.Core.Cache; +using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; +using Umbraco.Core.Mapping; using Umbraco.Core.Models; +using Umbraco.Core.Persistence; +using Umbraco.Core.Services; using Umbraco.Web.Actions; using Umbraco.Web.Models.Trees; +using Umbraco.Web.Routing; using Umbraco.Web.WebApi.Filters; namespace Umbraco.Web.Trees @@ -21,6 +28,25 @@ namespace Umbraco.Web.Trees [Tree(Constants.Applications.Translation, Constants.Trees.Dictionary, TreeGroup = Constants.Trees.Groups.Settings)] public class DictionaryTreeController : TreeController { + private readonly IMenuItemCollectionFactory _menuItemCollectionFactory; + + public DictionaryTreeController( + IGlobalSettings globalSettings, + IUmbracoContextAccessor umbracoContextAccessor, + ISqlContext sqlContext, + ServiceContext services, + AppCaches appCaches, + IProfilingLogger logger, + IRuntimeState runtimeState, + UmbracoHelper umbracoHelper, + UmbracoMapper umbracoMapper, + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) + : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) + { + _menuItemCollectionFactory = menuItemCollectionFactory; + } + protected override TreeNode CreateRootNode(FormDataCollection queryStrings) { var root = base.CreateRootNode(queryStrings); @@ -100,7 +126,7 @@ namespace Umbraco.Web.Trees /// protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { - var menu = new MenuItemCollection(); + var menu = _menuItemCollectionFactory.Create(); menu.Items.Add(Services.TextService, opensDialog: true); diff --git a/src/Umbraco.Web/Trees/FileSystemTreeController.cs b/src/Umbraco.Web/Trees/FileSystemTreeController.cs index 9bbe05b0ce..e4bfbc53f7 100644 --- a/src/Umbraco.Web/Trees/FileSystemTreeController.cs +++ b/src/Umbraco.Web/Trees/FileSystemTreeController.cs @@ -4,15 +4,46 @@ using System.Linq; using System.Net.Http.Formatting; using System.Web; using Umbraco.Core; +using Umbraco.Core.Cache; +using Umbraco.Core.Configuration; using Umbraco.Core.IO; +using Umbraco.Core.Logging; +using Umbraco.Core.Mapping; +using Umbraco.Core.Persistence; +using Umbraco.Core.Services; using Umbraco.Web.Actions; +using Umbraco.Web.Composing; using Umbraco.Web.Models.Trees; +using Umbraco.Web.Routing; namespace Umbraco.Web.Trees { public abstract class FileSystemTreeController : TreeController { + protected FileSystemTreeController() + { + MenuItemCollectionFactory = Current.MenuItemCollectionFactory; + } + + protected FileSystemTreeController( + IGlobalSettings globalSettings, + IUmbracoContextAccessor umbracoContextAccessor, + ISqlContext sqlContext, + ServiceContext services, + AppCaches appCaches, + IProfilingLogger logger, + IRuntimeState runtimeState, + UmbracoHelper umbracoHelper, + UmbracoMapper umbracoMapper, + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) + : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) + { + MenuItemCollectionFactory = menuItemCollectionFactory; + } + protected abstract IFileSystem FileSystem { get; } + protected IMenuItemCollectionFactory MenuItemCollectionFactory { get; } protected abstract string[] Extensions { get; } protected abstract string FileIcon { get; } @@ -88,7 +119,7 @@ namespace Umbraco.Web.Trees protected virtual MenuItemCollection GetMenuForRootNode(FormDataCollection queryStrings) { - var menu = new MenuItemCollection(); + var menu = MenuItemCollectionFactory.Create(); //set the default to create menu.DefaultMenuAlias = ActionNew.ActionAlias; @@ -102,7 +133,7 @@ namespace Umbraco.Web.Trees protected virtual MenuItemCollection GetMenuForFolder(string path, FormDataCollection queryStrings) { - var menu = new MenuItemCollection(); + var menu = MenuItemCollectionFactory.Create(); //set the default to create menu.DefaultMenuAlias = ActionNew.ActionAlias; @@ -126,7 +157,7 @@ namespace Umbraco.Web.Trees protected virtual MenuItemCollection GetMenuForFile(string path, FormDataCollection queryStrings) { - var menu = new MenuItemCollection(); + var menu = MenuItemCollectionFactory.Create(); //if it's not a directory then we only allow to delete the item menu.Items.Add(Services.TextService, opensDialog: true); @@ -142,7 +173,7 @@ namespace Umbraco.Web.Trees return GetMenuForRootNode(queryStrings); } - var menu = new MenuItemCollection(); + var menu = MenuItemCollectionFactory.Create(); var path = string.IsNullOrEmpty(id) == false && id != Constants.System.RootString ? HttpUtility.UrlDecode(id).TrimStart("/") diff --git a/src/Umbraco.Web/Trees/MacrosTreeController.cs b/src/Umbraco.Web/Trees/MacrosTreeController.cs index cbe1946779..5c03e11c37 100644 --- a/src/Umbraco.Web/Trees/MacrosTreeController.cs +++ b/src/Umbraco.Web/Trees/MacrosTreeController.cs @@ -1,10 +1,17 @@ using System.Linq; using System.Net.Http.Formatting; using Umbraco.Core; +using Umbraco.Core.Cache; +using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; +using Umbraco.Core.Mapping; +using Umbraco.Core.Persistence; +using Umbraco.Core.Services; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; using Umbraco.Web.Actions; +using Umbraco.Web.Routing; using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees @@ -15,6 +22,25 @@ namespace Umbraco.Web.Trees [CoreTree] public class MacrosTreeController : TreeController { + private readonly IMenuItemCollectionFactory _menuItemCollectionFactory; + + public MacrosTreeController( + IGlobalSettings globalSettings, + IUmbracoContextAccessor umbracoContextAccessor, + ISqlContext sqlContext, + ServiceContext services, + AppCaches appCaches, + IProfilingLogger logger, + IRuntimeState runtimeState, + UmbracoHelper umbracoHelper, + UmbracoMapper umbracoMapper, + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) + : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) + { + _menuItemCollectionFactory = menuItemCollectionFactory; + } + protected override TreeNode CreateRootNode(FormDataCollection queryStrings) { var root = base.CreateRootNode(queryStrings); @@ -46,7 +72,7 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { - var menu = new MenuItemCollection(); + var menu = _menuItemCollectionFactory.Create(); if (id == Constants.System.RootString) { @@ -60,7 +86,7 @@ namespace Umbraco.Web.Trees } var macro = Services.MacroService.GetById(int.Parse(id)); - if (macro == null) return new MenuItemCollection(); + if (macro == null) return menu; //add delete option for all macros menu.Items.Add(Services.TextService, opensDialog: true); diff --git a/src/Umbraco.Web/Trees/MediaTreeController.cs b/src/Umbraco.Web/Trees/MediaTreeController.cs index 6983e84dd8..05b7e0e2ad 100644 --- a/src/Umbraco.Web/Trees/MediaTreeController.cs +++ b/src/Umbraco.Web/Trees/MediaTreeController.cs @@ -52,8 +52,9 @@ namespace Umbraco.Web.Trees IRuntimeState runtimeState, UmbracoHelper umbracoHelper, UmbracoMapper umbracoMapper, - IPublishedUrlProvider publishedUrlProvider) - : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) + : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider, menuItemCollectionFactory) { _treeSearcher = treeSearcher; } @@ -99,7 +100,7 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection PerformGetMenuForNode(string id, FormDataCollection queryStrings) { - var menu = new MenuItemCollection(); + var menu = MenuItemCollectionFactory.Create(); //set the default menu.DefaultMenuAlias = ActionNew.ActionAlias; diff --git a/src/Umbraco.Web/Trees/MediaTypeTreeController.cs b/src/Umbraco.Web/Trees/MediaTypeTreeController.cs index 1c7f6ca3ae..d89e93bb49 100644 --- a/src/Umbraco.Web/Trees/MediaTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/MediaTypeTreeController.cs @@ -27,6 +27,7 @@ namespace Umbraco.Web.Trees public class MediaTypeTreeController : TreeController, ISearchableTree { private readonly UmbracoTreeSearcher _treeSearcher; + private readonly IMenuItemCollectionFactory _menuItemCollectionFactory; public MediaTypeTreeController( UmbracoTreeSearcher treeSearcher, @@ -39,10 +40,12 @@ namespace Umbraco.Web.Trees IRuntimeState runtimeState, UmbracoHelper umbracoHelper, UmbracoMapper umbracoMapper, - IPublishedUrlProvider publishedUrlProvider) + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) { _treeSearcher = treeSearcher; + _menuItemCollectionFactory = menuItemCollectionFactory; } protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) @@ -87,7 +90,7 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { - var menu = new MenuItemCollection(); + var menu = _menuItemCollectionFactory.Create(); if (id == Constants.System.RootString) { diff --git a/src/Umbraco.Web/Trees/MemberTreeController.cs b/src/Umbraco.Web/Trees/MemberTreeController.cs index 84909d5fda..490fe3d646 100644 --- a/src/Umbraco.Web/Trees/MemberTreeController.cs +++ b/src/Umbraco.Web/Trees/MemberTreeController.cs @@ -7,7 +7,12 @@ using System.Net.Http.Formatting; using System.Web.Http; using System.Web.Http.ModelBinding; using Umbraco.Core; +using Umbraco.Core.Cache; +using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; +using Umbraco.Core.Mapping; using Umbraco.Core.Models; +using Umbraco.Core.Persistence; using Umbraco.Core.Services; using Umbraco.Core.Security; using Umbraco.Web.Actions; @@ -15,6 +20,7 @@ using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; using Umbraco.Web.Models.ContentEditing; +using Umbraco.Web.Routing; using Umbraco.Web.Search; using Constants = Umbraco.Core.Constants; using Umbraco.Web.Security; @@ -33,12 +39,29 @@ namespace Umbraco.Web.Trees [SearchableTree("searchResultFormatter", "configureMemberResult")] public class MemberTreeController : TreeController, ISearchableTree { - public MemberTreeController(UmbracoTreeSearcher treeSearcher) - { - _treeSearcher = treeSearcher; - } + private readonly UmbracoTreeSearcher _treeSearcher; + private readonly IMenuItemCollectionFactory _menuItemCollectionFactory; + + public MemberTreeController( + IGlobalSettings globalSettings, + IUmbracoContextAccessor umbracoContextAccessor, + ISqlContext sqlContext, + ServiceContext services, + AppCaches appCaches, + IProfilingLogger logger, + IRuntimeState runtimeState, + UmbracoHelper umbracoHelper, + UmbracoMapper umbracoMapper, + IPublishedUrlProvider publishedUrlProvider, + UmbracoTreeSearcher treeSearcher, + IMenuItemCollectionFactory menuItemCollectionFactory) + : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) + { + _treeSearcher = treeSearcher; + _menuItemCollectionFactory = menuItemCollectionFactory; + } /// /// Gets an individual tree node @@ -111,7 +134,7 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { - var menu = new MenuItemCollection(); + var menu = _menuItemCollectionFactory.Create(); if (id == Constants.System.RootString) { diff --git a/src/Umbraco.Web/Trees/MemberTypeAndGroupTreeControllerBase.cs b/src/Umbraco.Web/Trees/MemberTypeAndGroupTreeControllerBase.cs index 5e71266bca..e54b200fea 100644 --- a/src/Umbraco.Web/Trees/MemberTypeAndGroupTreeControllerBase.cs +++ b/src/Umbraco.Web/Trees/MemberTypeAndGroupTreeControllerBase.cs @@ -1,8 +1,16 @@ using System.Collections.Generic; using System.Net.Http.Formatting; using Umbraco.Core; +using Umbraco.Core.Cache; +using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; +using Umbraco.Core.Mapping; +using Umbraco.Core.Persistence; +using Umbraco.Core.Services; using Umbraco.Web.Actions; +using Umbraco.Web.Composing; using Umbraco.Web.Models.Trees; +using Umbraco.Web.Routing; namespace Umbraco.Web.Trees { @@ -10,6 +18,30 @@ namespace Umbraco.Web.Trees [CoreTree] public abstract class MemberTypeAndGroupTreeControllerBase : TreeController { + public IMenuItemCollectionFactory MenuItemCollectionFactory { get; } + + protected MemberTypeAndGroupTreeControllerBase() + { + MenuItemCollectionFactory = Current.MenuItemCollectionFactory; + } + + protected MemberTypeAndGroupTreeControllerBase( + IGlobalSettings globalSettings, + IUmbracoContextAccessor umbracoContextAccessor, + ISqlContext sqlContext, + ServiceContext services, + AppCaches appCaches, + IProfilingLogger logger, + IRuntimeState runtimeState, + UmbracoHelper umbracoHelper, + UmbracoMapper umbracoMapper, + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) + : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) + { + MenuItemCollectionFactory = menuItemCollectionFactory; + } + protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { var nodes = new TreeNodeCollection(); @@ -19,7 +51,7 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { - var menu = new MenuItemCollection(); + var menu = MenuItemCollectionFactory.Create(); if (id == Constants.System.RootString) { diff --git a/src/Umbraco.Web/Trees/PackagesTreeController.cs b/src/Umbraco.Web/Trees/PackagesTreeController.cs index 90a41c050c..5608196109 100644 --- a/src/Umbraco.Web/Trees/PackagesTreeController.cs +++ b/src/Umbraco.Web/Trees/PackagesTreeController.cs @@ -1,7 +1,14 @@ using System.Net.Http.Formatting; using Umbraco.Core; +using Umbraco.Core.Cache; +using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; +using Umbraco.Core.Mapping; +using Umbraco.Core.Persistence; +using Umbraco.Core.Services; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; +using Umbraco.Web.Routing; using Umbraco.Web.WebApi.Filters; using Constants = Umbraco.Core.Constants; @@ -13,6 +20,25 @@ namespace Umbraco.Web.Trees [CoreTree] public class PackagesTreeController : TreeController { + private readonly IMenuItemCollectionFactory _menuItemCollectionFactory; + + public PackagesTreeController( + IGlobalSettings globalSettings, + IUmbracoContextAccessor umbracoContextAccessor, + ISqlContext sqlContext, + ServiceContext services, + AppCaches appCaches, + IProfilingLogger logger, + IRuntimeState runtimeState, + UmbracoHelper umbracoHelper, + UmbracoMapper umbracoMapper, + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) + : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) + { + _menuItemCollectionFactory = menuItemCollectionFactory; + } + /// /// Helper method to create a root model for a tree /// @@ -39,7 +65,7 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { //doesn't have a menu, this is a full screen app without tree nodes - return MenuItemCollection.Empty; + return _menuItemCollectionFactory.Create(); } } } diff --git a/src/Umbraco.Web/Trees/PartialViewsTreeController.cs b/src/Umbraco.Web/Trees/PartialViewsTreeController.cs index 9fa0c025d6..e1e848df76 100644 --- a/src/Umbraco.Web/Trees/PartialViewsTreeController.cs +++ b/src/Umbraco.Web/Trees/PartialViewsTreeController.cs @@ -1,6 +1,5 @@ using Umbraco.Core.IO; using Umbraco.Web.Composing; -using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; using Constants = Umbraco.Core.Constants; diff --git a/src/Umbraco.Web/Trees/RelationTypeTreeController.cs b/src/Umbraco.Web/Trees/RelationTypeTreeController.cs index d2d2253f20..5601af0da3 100644 --- a/src/Umbraco.Web/Trees/RelationTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/RelationTypeTreeController.cs @@ -3,8 +3,14 @@ using System.Net.Http.Formatting; using Umbraco.Web.Models.Trees; using Umbraco.Web.WebApi.Filters; using Umbraco.Core; +using Umbraco.Core.Cache; +using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; +using Umbraco.Core.Mapping; +using Umbraco.Core.Persistence; using Umbraco.Core.Services; using Umbraco.Web.Actions; +using Umbraco.Web.Routing; namespace Umbraco.Web.Trees { @@ -14,11 +20,30 @@ namespace Umbraco.Web.Trees [CoreTree] public class RelationTypeTreeController : TreeController { + private readonly IMenuItemCollectionFactory _menuItemCollectionFactory; + + public RelationTypeTreeController( + IGlobalSettings globalSettings, + IUmbracoContextAccessor umbracoContextAccessor, + ISqlContext sqlContext, + ServiceContext services, + AppCaches appCaches, + IProfilingLogger logger, + IRuntimeState runtimeState, + UmbracoHelper umbracoHelper, + UmbracoMapper umbracoMapper, + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) + : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) + { + _menuItemCollectionFactory = menuItemCollectionFactory; + } + protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { //TODO: Do not allow deleting built in types - var menu = new MenuItemCollection(); + var menu = _menuItemCollectionFactory.Create(); if (id == Constants.System.RootString) { @@ -32,7 +57,7 @@ namespace Umbraco.Web.Trees } var relationType = Services.RelationService.GetRelationTypeById(int.Parse(id)); - if (relationType == null) return new MenuItemCollection(); + if (relationType == null) return menu; menu.Items.Add(Services.TextService); diff --git a/src/Umbraco.Web/Trees/TemplatesTreeController.cs b/src/Umbraco.Web/Trees/TemplatesTreeController.cs index 6c8b23030e..647683e5c5 100644 --- a/src/Umbraco.Web/Trees/TemplatesTreeController.cs +++ b/src/Umbraco.Web/Trees/TemplatesTreeController.cs @@ -29,6 +29,7 @@ namespace Umbraco.Web.Trees public class TemplatesTreeController : TreeController, ISearchableTree { private readonly UmbracoTreeSearcher _treeSearcher; + private readonly IMenuItemCollectionFactory _menuItemCollectionFactory; public TemplatesTreeController( UmbracoTreeSearcher treeSearcher, @@ -41,10 +42,12 @@ namespace Umbraco.Web.Trees IRuntimeState runtimeState, UmbracoHelper umbracoHelper, UmbracoMapper umbracoMapper, - IPublishedUrlProvider publishedUrlProvider) + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) { _treeSearcher = treeSearcher; + _menuItemCollectionFactory = menuItemCollectionFactory; } protected override TreeNode CreateRootNode(FormDataCollection queryStrings) @@ -97,7 +100,7 @@ namespace Umbraco.Web.Trees /// protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { - var menu = new MenuItemCollection(); + var menu = _menuItemCollectionFactory.Create(); //Create the normal create action var item = menu.Items.Add(Services.TextService, opensDialog: true); @@ -112,7 +115,7 @@ namespace Umbraco.Web.Trees } var template = Services.FileService.GetTemplate(int.Parse(id)); - if (template == null) return new MenuItemCollection(); + if (template == null) return menu; var entity = FromTemplate(template); //don't allow delete if it has child layouts diff --git a/src/Umbraco.Web/Trees/UserTreeController.cs b/src/Umbraco.Web/Trees/UserTreeController.cs index 475fbad2a8..648e9ef29c 100644 --- a/src/Umbraco.Web/Trees/UserTreeController.cs +++ b/src/Umbraco.Web/Trees/UserTreeController.cs @@ -1,7 +1,14 @@ using System.Net.Http.Formatting; using Umbraco.Core; +using Umbraco.Core.Cache; +using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; +using Umbraco.Core.Mapping; +using Umbraco.Core.Persistence; +using Umbraco.Core.Services; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; +using Umbraco.Web.Routing; using Umbraco.Web.WebApi.Filters; using Constants = Umbraco.Core.Constants; @@ -13,6 +20,25 @@ namespace Umbraco.Web.Trees [CoreTree] public class UserTreeController : TreeController { + private readonly IMenuItemCollectionFactory _menuItemCollectionFactory; + + public UserTreeController( + IGlobalSettings globalSettings, + IUmbracoContextAccessor umbracoContextAccessor, + ISqlContext sqlContext, + ServiceContext services, + AppCaches appCaches, + IProfilingLogger logger, + IRuntimeState runtimeState, + UmbracoHelper umbracoHelper, + UmbracoMapper umbracoMapper, + IPublishedUrlProvider publishedUrlProvider, + IMenuItemCollectionFactory menuItemCollectionFactory) + : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider) + { + _menuItemCollectionFactory = menuItemCollectionFactory; + } + /// /// Helper method to create a root model for a tree /// @@ -38,7 +64,7 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { //doesn't have a menu, this is a full screen app without tree nodes - return MenuItemCollection.Empty; + return _menuItemCollectionFactory.Create(); } } } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index b9808e08e5..5e7654e896 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -134,19 +134,20 @@ - - - + + + - + + @@ -154,13 +155,12 @@ - - - + + @@ -169,43 +169,27 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + @@ -213,10 +197,8 @@ - - - - + + @@ -230,10 +212,8 @@ - - @@ -241,12 +221,9 @@ - - - @@ -280,10 +257,6 @@ - - - - @@ -295,15 +268,11 @@ - - - - @@ -311,17 +280,13 @@ - - - - @@ -330,14 +295,12 @@ - - @@ -363,7 +326,6 @@ - @@ -404,36 +366,13 @@ - - - - - - - - - - - - - - - - - - - - - - - @@ -453,16 +392,13 @@ - - - @@ -470,7 +406,6 @@ - @@ -509,7 +444,6 @@ - @@ -545,7 +479,6 @@ - True @@ -587,9 +520,7 @@ - - @@ -610,11 +541,8 @@ - - - diff --git a/src/Umbraco.Web/UmbracoContext.cs b/src/Umbraco.Web/UmbracoContext.cs index 99d0b68d89..ded6182e17 100644 --- a/src/Umbraco.Web/UmbracoContext.cs +++ b/src/Umbraco.Web/UmbracoContext.cs @@ -2,6 +2,7 @@ using System; using System.Web; using Umbraco.Core; using Umbraco.Core.Configuration; +using Umbraco.Core.Cookie; using Umbraco.Core.IO; using Umbraco.Core.Models.PublishedContent; using Umbraco.Web.Composing; @@ -20,6 +21,7 @@ namespace Umbraco.Web private readonly IGlobalSettings _globalSettings; private readonly IIOHelper _ioHelper; private readonly UriUtility _uriUtility; + private readonly ICookieManager _cookieManager; private readonly Lazy _publishedSnapshot; private string _previewToken; private bool? _previewing; @@ -34,7 +36,8 @@ namespace Umbraco.Web IGlobalSettings globalSettings, IVariationContextAccessor variationContextAccessor, IIOHelper ioHelper, - UriUtility uriUtility) + UriUtility uriUtility, + ICookieManager cookieManager) { if (httpContextAccessor == null) throw new ArgumentNullException(nameof(httpContextAccessor)); if (publishedSnapshotService == null) throw new ArgumentNullException(nameof(publishedSnapshotService)); @@ -44,6 +47,7 @@ namespace Umbraco.Web _globalSettings = globalSettings ?? throw new ArgumentNullException(nameof(globalSettings)); _ioHelper = ioHelper ?? throw new ArgumentNullException(nameof(ioHelper)); _uriUtility = uriUtility; + _cookieManager = cookieManager; // ensure that this instance is disposed when the request terminates, though we *also* ensure // this happens in the Umbraco module since the UmbracoCOntext is added to the HttpContext items. @@ -183,7 +187,7 @@ namespace Umbraco.Web && request.Url.IsBackOfficeRequest(HttpRuntime.AppDomainAppVirtualPath, _globalSettings, _ioHelper) == false && Security.CurrentUser != null) { - var previewToken = request.GetPreviewCookieValue(); // may be null or empty + var previewToken = _cookieManager.GetPreviewCookieValue(); // may be null or empty _previewToken = previewToken.IsNullOrWhiteSpace() ? null : previewToken; } diff --git a/src/Umbraco.Web/UmbracoContextFactory.cs b/src/Umbraco.Web/UmbracoContextFactory.cs index a84e51eda3..466bf68576 100644 --- a/src/Umbraco.Web/UmbracoContextFactory.cs +++ b/src/Umbraco.Web/UmbracoContextFactory.cs @@ -2,6 +2,7 @@ using System.IO; using System.Text; using Umbraco.Core.Configuration; +using Umbraco.Core.Cookie; using Umbraco.Core.IO; using Umbraco.Core.Models.PublishedContent; using Umbraco.Core.Services; @@ -26,6 +27,7 @@ namespace Umbraco.Web private readonly IUserService _userService; private readonly IIOHelper _ioHelper; private readonly IHttpContextAccessor _httpContextAccessor; + private readonly ICookieManager _cookieManager; private readonly UriUtility _uriUtility; /// @@ -40,7 +42,8 @@ namespace Umbraco.Web IUserService userService, IIOHelper ioHelper, UriUtility uriUtility, - IHttpContextAccessor httpContextAccessor) + IHttpContextAccessor httpContextAccessor, + ICookieManager cookieManager) { _umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor)); _publishedSnapshotService = publishedSnapshotService ?? throw new ArgumentNullException(nameof(publishedSnapshotService)); @@ -51,6 +54,7 @@ namespace Umbraco.Web _ioHelper = ioHelper; _uriUtility = uriUtility; _httpContextAccessor = httpContextAccessor; + _cookieManager = cookieManager; } private IUmbracoContext CreateUmbracoContext() @@ -69,7 +73,7 @@ namespace Umbraco.Web var webSecurity = new WebSecurity(_httpContextAccessor, _userService, _globalSettings, _ioHelper); - return new UmbracoContext(_httpContextAccessor, _publishedSnapshotService, webSecurity, _globalSettings, _variationContextAccessor, _ioHelper, _uriUtility); + return new UmbracoContext(_httpContextAccessor, _publishedSnapshotService, webSecurity, _globalSettings, _variationContextAccessor, _ioHelper, _uriUtility, _cookieManager); } /// diff --git a/src/Umbraco.Web/WebApi/UmbracoApiControllerBase.cs b/src/Umbraco.Web/WebApi/UmbracoApiControllerBase.cs index 3087630edd..b20ebe7e09 100644 --- a/src/Umbraco.Web/WebApi/UmbracoApiControllerBase.cs +++ b/src/Umbraco.Web/WebApi/UmbracoApiControllerBase.cs @@ -10,18 +10,21 @@ using Umbraco.Core.Logging; using Umbraco.Core.Mapping; using Umbraco.Core.Persistence; using Umbraco.Core.Services; +using Umbraco.Web.Features; using Umbraco.Web.Routing; using Umbraco.Web.Security; using Umbraco.Web.WebApi.Filters; namespace Umbraco.Web.WebApi { + + /// /// Provides a base class for Umbraco API controllers. /// /// These controllers are NOT auto-routed. [FeatureAuthorize] - public abstract class UmbracoApiControllerBase : ApiController + public abstract class UmbracoApiControllerBase : ApiController, IUmbracoFeature { // note: all Umbraco controllers have two constructors: one with all dependencies, which should be used, diff --git a/src/umbraco.sln b/src/umbraco.sln index 05dee0b90b..9d9512cfc6 100644 --- a/src/umbraco.sln +++ b/src/umbraco.sln @@ -113,8 +113,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.TestData", "Umbraco EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.PublishedCache.NuCache", "Umbraco.PublishedCache.NuCache\Umbraco.PublishedCache.NuCache.csproj", "{F6DE8DA0-07CC-4EF2-8A59-2BC81DBB3830}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Examine", "Umbraco.Examine\Umbraco.Examine.csproj", "{F9B7FE05-0F93-4D0D-9C10-690B33ECBBD8}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Examine.Lucene", "Umbraco.Examine.Lucene\Umbraco.Examine.Lucene.csproj", "{0FAD7D2A-D7DD-45B1-91FD-488BB6CDACEA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Web.BackOffice", "Umbraco.Web.BackOffice\Umbraco.Web.BackOffice.csproj", "{9B95EEF7-63FE-4432-8C63-166BE9C1A929}" @@ -171,10 +169,6 @@ Global {F6DE8DA0-07CC-4EF2-8A59-2BC81DBB3830}.Debug|Any CPU.Build.0 = Debug|Any CPU {F6DE8DA0-07CC-4EF2-8A59-2BC81DBB3830}.Release|Any CPU.ActiveCfg = Release|Any CPU {F6DE8DA0-07CC-4EF2-8A59-2BC81DBB3830}.Release|Any CPU.Build.0 = Release|Any CPU - {F9B7FE05-0F93-4D0D-9C10-690B33ECBBD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F9B7FE05-0F93-4D0D-9C10-690B33ECBBD8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F9B7FE05-0F93-4D0D-9C10-690B33ECBBD8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F9B7FE05-0F93-4D0D-9C10-690B33ECBBD8}.Release|Any CPU.Build.0 = Release|Any CPU {0FAD7D2A-D7DD-45B1-91FD-488BB6CDACEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0FAD7D2A-D7DD-45B1-91FD-488BB6CDACEA}.Debug|Any CPU.Build.0 = Debug|Any CPU {0FAD7D2A-D7DD-45B1-91FD-488BB6CDACEA}.Release|Any CPU.ActiveCfg = Release|Any CPU