Merge pull request #7691 from umbraco/netcore/feature/move-mappings-after-httpcontext
NetCore: Move more files
This commit is contained in:
@@ -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<IConnectionStrings>(() => new ConnectionStrings());
|
||||
configs.Add<IConnectionStrings>(() => new ConnectionStrings(ioHelper));
|
||||
configs.AddCoreConfigs(ioHelper);
|
||||
return configs;
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,27 +254,7 @@ namespace Umbraco.Core.Configuration
|
||||
ConfigurationManager.RefreshSection("appSettings");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a setting from the configuration file.
|
||||
/// </summary>
|
||||
/// <param name="key">Key of the setting to be removed.</param>
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the time out in minutes.
|
||||
/// </summary>
|
||||
|
||||
@@ -6,5 +6,7 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
void RemoveConnectionString(string umbracoConnectionName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -1,5 +1,4 @@
|
||||
using Umbraco.Core.Collections;
|
||||
using Umbraco.Web.WebApi;
|
||||
|
||||
namespace Umbraco.Web.Features
|
||||
{
|
||||
@@ -13,19 +12,19 @@ namespace Umbraco.Web.Features
|
||||
/// </summary>
|
||||
public DisabledFeatures()
|
||||
{
|
||||
Controllers = new TypeList<UmbracoApiControllerBase>();
|
||||
Controllers = new TypeList<IUmbracoFeature>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the disabled controllers.
|
||||
/// </summary>
|
||||
public TypeList<UmbracoApiControllerBase> Controllers { get; }
|
||||
public TypeList<IUmbracoFeature> Controllers { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Disables the device preview feature of previewing.
|
||||
/// </summary>
|
||||
public bool DisableDevicePreview { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// If true, all references to templates will be removed in the back office and routing
|
||||
/// </summary>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Umbraco.Web.Features
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a marker interface to allow controllers to be disabled if also marked with FeatureAuthorizeAttribute.
|
||||
/// </summary>
|
||||
public interface IUmbracoFeature
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the disabled features.
|
||||
/// </summary>
|
||||
@@ -32,7 +31,7 @@ namespace Umbraco.Web.Features
|
||||
/// </summary>
|
||||
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.");
|
||||
@@ -75,5 +75,6 @@ namespace Umbraco.Core.IO
|
||||
get;
|
||||
set; //Only required for unit tests
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Umbraco.Core.IO
|
||||
{
|
||||
public static class IOHelperExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Tries to create a directory.
|
||||
/// </summary>
|
||||
/// <param name="ioHelper">The IOHelper.</param>
|
||||
/// <param name="dir">the directory path.</param>
|
||||
/// <returns>true if the directory was created, false otherwise.</returns>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,5 @@ namespace Umbraco.Core.Install
|
||||
bool RunFilePermissionTestSuite(out Dictionary<string, IEnumerable<string>> report);
|
||||
bool EnsureDirectories(string[] dirs, out IEnumerable<string> errors, bool writeCausesRestart = false);
|
||||
bool EnsureFiles(string[] files, out IEnumerable<string> errors);
|
||||
bool EnsureCanCreateSubDirectory(string dir, out IEnumerable<string> errors);
|
||||
bool EnsureCanCreateSubDirectories(IEnumerable<string> dirs, out IEnumerable<string> errors);
|
||||
bool TestPublishedSnapshotService(out IEnumerable<string> errors);
|
||||
bool TryCreateDirectory(string dir);
|
||||
bool TryAccessDirectory(string dir, bool canWrite);
|
||||
}
|
||||
}
|
||||
|
||||
+27
-19
@@ -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
|
||||
/// <summary>
|
||||
/// An internal in-memory status tracker for the current installation
|
||||
/// </summary>
|
||||
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<InstallTrackingItem> _steps = new ConcurrentHashSet<InstallTrackingItem>();
|
||||
|
||||
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<InstallTrackingItem>();
|
||||
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<InstallTrackingItem> InitializeFromFile(Guid installId)
|
||||
public IEnumerable<InstallTrackingItem> 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<IEnumerable<InstallTrackingItem>>(
|
||||
var deserialized = _jsonSerializer.Deserialize<IEnumerable<InstallTrackingItem>>(
|
||||
File.ReadAllText(file));
|
||||
foreach (var item in deserialized)
|
||||
{
|
||||
@@ -70,7 +78,7 @@ namespace Umbraco.Web.Install
|
||||
return new List<InstallTrackingItem>(_steps);
|
||||
}
|
||||
|
||||
public static IEnumerable<InstallTrackingItem> Initialize(Guid installId, IEnumerable<InstallSetupStep> steps)
|
||||
public IEnumerable<InstallTrackingItem> Initialize(Guid installId, IEnumerable<InstallSetupStep> 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<IEnumerable<InstallTrackingItem>>(
|
||||
var deserialized = _jsonSerializer.Deserialize<IEnumerable<InstallTrackingItem>>(
|
||||
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<InstallTrackingItem>(_steps));
|
||||
var serialized = _jsonSerializer.Serialize(new List<InstallTrackingItem>(_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<InstallTrackingItem>(_steps));
|
||||
var serialized = _jsonSerializer.Serialize(new List<InstallTrackingItem>(_steps));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(file));
|
||||
File.WriteAllText(file, serialized);
|
||||
}
|
||||
@@ -119,7 +127,7 @@ namespace Umbraco.Web.Install
|
||||
return new List<InstallTrackingItem>(_steps);
|
||||
}
|
||||
|
||||
public static void SetComplete(Guid installId, string name, IDictionary<string, object> additionalData = null)
|
||||
public void SetComplete(Guid installId, string name, IDictionary<string, object> 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<InstallTrackingItem>(_steps));
|
||||
var serialized = _jsonSerializer.Serialize(new List<InstallTrackingItem>(_steps));
|
||||
File.WriteAllText(file, serialized);
|
||||
}
|
||||
|
||||
-1
@@ -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
|
||||
+7
-5
@@ -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<InstallSetupResult> ExecuteAsync(object model) => Task.FromResult<InstallSetupResult>(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";
|
||||
|
||||
+1
-2
@@ -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<string, JToken> Instructions { get; set; }
|
||||
public IDictionary<string, object> Instructions { get; set; }
|
||||
|
||||
[DataMember(Name = "installId")]
|
||||
public Guid InstallId { get; set; }
|
||||
+1
-1
@@ -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)
|
||||
{
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
/// </summary>
|
||||
[IgnoreDataMember]
|
||||
internal string Category { get; set; }
|
||||
public string Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The letter from the IAction
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Umbraco.Core.Models
|
||||
/// </summary>
|
||||
/// <param name="dataType">The data type definition.</param>
|
||||
/// <returns></returns>
|
||||
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
|
||||
/// <summary>
|
||||
/// Returns true if this date type is build-in/default.
|
||||
/// </summary>
|
||||
internal static bool IsBuildInDataType(Guid key)
|
||||
public static bool IsBuildInDataType(Guid key)
|
||||
{
|
||||
return IdsOfBuildInDataTypes.Contains(key);
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Web
|
||||
{
|
||||
internal static class PasswordConfigurationExtensions
|
||||
public static class PasswordConfigurationExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the configuration of the membership provider used to configure change password editors
|
||||
@@ -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")]
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Umbraco.Web.PublishedCache
|
||||
|
||||
string StatusUrl { get; }
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
void Collect();
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ namespace Umbraco.Web.Routing
|
||||
/// <param name="rootNodeId">The current domain root node identifier, or null.</param>
|
||||
/// <returns>The deepest wildcard Domain in the path, or null.</returns>
|
||||
/// <remarks>Looks _under_ rootNodeId but not _at_ rootNodeId.</remarks>
|
||||
internal static Domain FindWildcardDomainInPath(IEnumerable<Domain> domains, string path, int? rootNodeId)
|
||||
public static Domain FindWildcardDomainInPath(IEnumerable<Domain> domains, string path, int? rootNodeId)
|
||||
{
|
||||
var stopNodeId = rootNodeId ?? -1;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Umbraco.Web.Scheduling
|
||||
/// <summary>
|
||||
/// Used to cleanup temporary file locations
|
||||
/// </summary>
|
||||
internal class TempFileCleanup : RecurringTaskBase
|
||||
public class TempFileCleanup : RecurringTaskBase
|
||||
{
|
||||
private readonly DirectoryInfo[] _tempFolders;
|
||||
private readonly TimeSpan _age;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Umbraco.Core.Sync
|
||||
{
|
||||
/// <summary>
|
||||
/// An <see cref="IServerMessenger"/> implementation that works by storing messages in the database.
|
||||
/// </summary>
|
||||
public interface IBatchedDatabaseServerMessenger : IServerMessenger
|
||||
{
|
||||
void FlushBatch();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Umbraco.Web.Models.Trees;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Represents a factory to create <see cref="MenuItemCollection"/>.
|
||||
/// </summary>
|
||||
public interface IMenuItemCollectionFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="MenuItemCollection"/>.
|
||||
/// </summary>
|
||||
/// <returns>An empty <see cref="MenuItemCollection"/>.</returns>
|
||||
MenuItemCollection Create();
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -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<MenuItem> items)
|
||||
public MenuItemCollection(ActionCollection actionCollection, IEnumerable<MenuItem> items)
|
||||
{
|
||||
_menuItems = new MenuItemList(items);
|
||||
_menuItems = new MenuItemList(actionCollection, items);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+7
-4
@@ -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
|
||||
/// </remarks>
|
||||
public class MenuItemList : List<MenuItem>
|
||||
{
|
||||
public MenuItemList()
|
||||
private readonly ActionCollection _actionCollection;
|
||||
|
||||
public MenuItemList(ActionCollection actionCollection)
|
||||
{
|
||||
_actionCollection = actionCollection;
|
||||
}
|
||||
|
||||
public MenuItemList( IEnumerable<MenuItem> items)
|
||||
public MenuItemList(ActionCollection actionCollection, IEnumerable<MenuItem> items)
|
||||
: base(items)
|
||||
{
|
||||
_actionCollection = actionCollection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -44,7 +47,7 @@ namespace Umbraco.Web.Models.Trees
|
||||
private MenuItem CreateMenuItem<T>(ILocalizedTextService textService, bool hasSeparator = false, bool opensDialog = false)
|
||||
where T : IAction
|
||||
{
|
||||
var item = Current.Actions.GetAction<T>();
|
||||
var item = _actionCollection.GetAction<T>();
|
||||
if (item == null) return null;
|
||||
|
||||
var menuItem = new MenuItem(item, textService.Localize($"actions/{item.Alias}"))
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Examine\Umbraco.Examine.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Infrastructure\Umbraco.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<AssemblyName>Umbraco.Examine</AssemblyName>
|
||||
<RootNamespace>Umbraco.Examine</RootNamespace>
|
||||
<LangVersion>8</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Examine.Core" Version="2.0.0-alpha.20200128.15" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Infrastructure\Umbraco.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
-2
@@ -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
|
||||
{
|
||||
-2
@@ -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
|
||||
{
|
||||
+1
-1
@@ -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;
|
||||
-2
@@ -8,8 +8,6 @@ using Umbraco.Core.Xml;
|
||||
|
||||
namespace Umbraco.Web
|
||||
{
|
||||
using Examine = global::Examine;
|
||||
|
||||
/// <summary>
|
||||
/// Query methods used for accessing strongly typed content in templates
|
||||
/// </summary>
|
||||
+1
-1
@@ -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<DatabaseModel>
|
||||
public class DatabaseConfigureStep : InstallSetupStep<DatabaseModel>
|
||||
{
|
||||
private readonly DatabaseBuilder _databaseBuilder;
|
||||
private readonly ILogger _logger;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user