Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7

This commit is contained in:
Shannon
2015-08-28 15:26:22 +02:00
7 changed files with 31 additions and 30 deletions

View File

@@ -18,12 +18,10 @@ namespace Umbraco.Core.Models
/// </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.

View File

@@ -33,19 +33,15 @@ namespace Umbraco.Core.Services
/// <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();
}
}

View File

@@ -53,8 +53,7 @@ namespace Umbraco.Core.Services
{
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)
@@ -96,8 +95,7 @@ namespace Umbraco.Core.Services
_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;

View File

@@ -43,7 +43,7 @@ namespace Umbraco.Core.Sync
/// </summary>
public ServerRole GetCurrentServerRole()
{
var service = _registrationService.Value as ServerRegistrationService;
var service = _registrationService.Value;
return service.GetCurrentServerRole();
}

View File

@@ -57,6 +57,8 @@ namespace Umbraco.Tests
&& 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(),
@@ -64,7 +66,6 @@ namespace Umbraco.Tests
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);

View File

@@ -75,7 +75,7 @@ namespace Umbraco.Web.Strategies
_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

View File

@@ -193,10 +193,18 @@ namespace Umbraco.Web.UI
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