U4-9018 - provide a way to disable server master election

This commit is contained in:
Stephan
2016-10-25 12:22:06 +02:00
parent 74a5bf5503
commit 07bb57fac8
2 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
using System.Collections.Generic;
namespace Umbraco.Core.Sync
{
public class SingleServerRegistrar : IServerRegistrar2
{
private readonly string _umbracoApplicationUrl;
public IEnumerable<IServerAddress> Registrations { get; private set; }
public SingleServerRegistrar()
{
_umbracoApplicationUrl = ApplicationContext.Current.UmbracoApplicationUrl;
Registrations = new[] { new ServerAddressImpl(_umbracoApplicationUrl) };
}
public ServerRole GetCurrentServerRole()
{
return ServerRole.Single;
}
public string GetCurrentServerUmbracoApplicationUrl()
{
return _umbracoApplicationUrl;
}
private class ServerAddressImpl : IServerAddress
{
public ServerAddressImpl(string serverAddress)
{
ServerAddress = serverAddress;
}
public string ServerAddress { get; private set; }
}
}
}

View File

@@ -1330,6 +1330,7 @@
<Compile Include="Sync\ApplicationUrlHelper.cs" />
<Compile Include="Sync\RefreshMethodType.cs" />
<Compile Include="Sync\ServerMessengerBase.cs" />
<Compile Include="Sync\SingleServerRegistrar.cs" />
<Compile Include="ThreadExtensions.cs" />
<Compile Include="TopologicalSorter.cs" />
<Compile Include="Strings\DefaultUrlSegmentProvider.cs" />