Skip to content

Commit

Permalink
Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into …
Browse files Browse the repository at this point in the history
…dev-v7
  • Loading branch information
Shazwazza committed Aug 28, 2015
2 parents d6d611d + 7020e94 commit 9ce1ea6
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 30 deletions.
10 changes: 4 additions & 6 deletions src/Umbraco.Core/Models/IServerRegistration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ public interface IServerRegistration : IServerAddress, IAggregateRoot, IRemember
/// </summary>
bool IsActive { get; set; }

// note: cannot add this because of backward compatibility
//
///// <summary>
///// Gets or sets a value indicating whether the server is master.
///// </summary>
//bool IsMaster { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the server is master.
/// </summary>
bool IsMaster { get; set; }

/// <summary>
/// Gets the date and time the registration was created.
Expand Down
22 changes: 9 additions & 13 deletions src/Umbraco.Core/Services/IServerRegistrationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,15 @@ public interface IServerRegistrationService
/// <returns>All active servers.</returns>
IEnumerable<IServerRegistration> GetActiveServers();

// note: cannot add this because of backward compatibility
//
///// <summary>
///// Gets the current server identity.
///// </summary>
//string CurrentServerIdentity { get; }
/// <summary>
/// Gets the current server identity.
/// </summary>
string CurrentServerIdentity { get; }

// note: cannot add this because of backward compatibility
//
///// <summary>
///// Gets the role of the current server.
///// </summary>
///// <returns>The role of the current server.</returns>
//ServerRole GetCurrentServerRole();
/// <summary>
/// Gets the role of the current server.
/// </summary>
/// <returns>The role of the current server.</returns>
ServerRole GetCurrentServerRole();
}
}
6 changes: 2 additions & 4 deletions src/Umbraco.Core/Services/ServerRegistrationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public void TouchServer(string serverAddress, string serverIdentity, TimeSpan st
{
var regs = xr.Repository.GetAll().ToArray(); // faster to query only once
var hasMaster = regs.Any(x => ((ServerRegistration)x).IsMaster);
var iserver = regs.FirstOrDefault(x => x.ServerIdentity.InvariantEquals(serverIdentity));
var server = iserver as ServerRegistration; // because IServerRegistration is missing IsMaster
var server = regs.FirstOrDefault(x => x.ServerIdentity.InvariantEquals(serverIdentity));
var hasServer = server != null;

if (server == null)
Expand Down Expand Up @@ -96,8 +95,7 @@ public void DeactiveServer(string serverIdentity)
_lrepo.WithWriteLocked(xr =>
{
var query = Query<IServerRegistration>.Builder.Where(x => x.ServerIdentity.ToUpper() == serverIdentity.ToUpper());
var iserver = xr.Repository.GetByQuery(query).FirstOrDefault();
var server = iserver as ServerRegistration; // because IServerRegistration is missing IsMaster
var server = xr.Repository.GetByQuery(query).FirstOrDefault();
if (server == null) return;

server.IsActive = false;
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Sync/DatabaseServerRegistrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public IEnumerable<IServerAddress> Registrations
/// </summary>
public ServerRole GetCurrentServerRole()
{
var service = _registrationService.Value as ServerRegistrationService;
var service = _registrationService.Value;
return service.GetCurrentServerRole();
}

Expand Down
3 changes: 2 additions & 1 deletion src/Umbraco.Tests/ApplicationUrlHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ public void SetApplicationUrlViaProvider()
&& section.WebRouting == Mock.Of<IWebRoutingSection>(wrSection => wrSection.UmbracoApplicationUrl == (string)null)
&& section.ScheduledTasks == Mock.Of<IScheduledTasksSection>());

ApplicationUrlHelper.ApplicationUrlProvider = request => "http://server1.com/umbraco";

Initialize(settings);

var appCtx = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper(),
new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>()));

ConfigurationManager.AppSettings.Set("umbracoUseSSL", "true"); // does not make a diff here

ApplicationUrlHelper.ApplicationUrlProvider = request => "http://server1.com/umbraco";
ApplicationUrlHelper.EnsureApplicationUrl(appCtx, settings: settings);

Assert.AreEqual("http://server1.com/umbraco", appCtx._umbracoApplicationUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private void RegisterServer(UmbracoRequestEventArgs e)
_lastUpdated = DateTime.Now;
}

var svc = e.UmbracoContext.Application.Services.ServerRegistrationService as ServerRegistrationService;
var svc = e.UmbracoContext.Application.Services.ServerRegistrationService;

// because
// - ApplicationContext.UmbracoApplicationUrl is initialized by UmbracoModule in BeginRequest
Expand Down
16 changes: 12 additions & 4 deletions src/Umbraco.Web/UI/LegacyDialogHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,18 @@ internal static string Create(HttpContextBase httpContext, User umbracoUser, str
typeInstance.Alias = text;

// check for returning url
var returnUrlTask = typeInstance as LegacyDialogTask;

returnUrlTask.AdditionalValues = additionalValues;

ITaskReturnUrl returnUrlTask = typeInstance as LegacyDialogTask;
if (returnUrlTask != null)
{
// if castable to LegacyDialogTask: add in additionalValues
((LegacyDialogTask) returnUrlTask).AdditionalValues = additionalValues;
}
else
{
// otherwise cast to returnUrl interface
returnUrlTask = typeInstance as ITaskReturnUrl;
}

typeInstance.Save();

return returnUrlTask != null
Expand Down

0 comments on commit 9ce1ea6

Please sign in to comment.