Ensures tree is synced on bulk publish, fixes Dimming on the content node. Starts adding ability to
make distributed calls that are strongly typed and can do more than one at a time.
This commit is contained in:
@@ -43,21 +43,24 @@ namespace Umbraco.Core.Sync
|
||||
{
|
||||
if (servers == null) throw new ArgumentNullException("servers");
|
||||
if (refresher == null) throw new ArgumentNullException("refresher");
|
||||
throw new NotImplementedException();
|
||||
|
||||
instances.ForEach(x => InvokeDispatchMethod(servers, refresher, MessageType.RefreshById, getNumericId(x)));
|
||||
}
|
||||
|
||||
public void PerformRefresh<T>(IEnumerable<IServerRegistration> servers, ICacheRefresher refresher, Func<T, Guid> getGuidId, params T[] instances)
|
||||
{
|
||||
if (servers == null) throw new ArgumentNullException("servers");
|
||||
if (refresher == null) throw new ArgumentNullException("refresher");
|
||||
throw new NotImplementedException();
|
||||
|
||||
instances.ForEach(x => InvokeDispatchMethod(servers, refresher, MessageType.RefreshById, getGuidId(x)));
|
||||
}
|
||||
|
||||
public void PerformRemove<T>(IEnumerable<IServerRegistration> servers, ICacheRefresher refresher, Func<T, int> getNumericId, params T[] instances)
|
||||
{
|
||||
if (servers == null) throw new ArgumentNullException("servers");
|
||||
if (refresher == null) throw new ArgumentNullException("refresher");
|
||||
throw new NotImplementedException();
|
||||
|
||||
instances.ForEach(x => InvokeDispatchMethod(servers, refresher, MessageType.RemoveById, getNumericId(x)));
|
||||
}
|
||||
|
||||
public void PerformRemove(IEnumerable<IServerRegistration> servers, ICacheRefresher refresher, params int[] numericIds)
|
||||
@@ -129,6 +132,7 @@ namespace Umbraco.Core.Sync
|
||||
{
|
||||
if (servers == null) throw new ArgumentNullException("servers");
|
||||
if (refresher == null) throw new ArgumentNullException("refresher");
|
||||
if (!(id is int) && (!(id is Guid))) throw new ArgumentException("The id must be either an int or a Guid");
|
||||
|
||||
//Now, check if we are using Distrubuted calls. If there are no servers in the list then we
|
||||
// can definitely not distribute.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
@@ -118,17 +119,17 @@ namespace Umbraco.Tests.Sync
|
||||
|
||||
public void PerformRefresh<T>(IEnumerable<IServerRegistration> servers, ICacheRefresher refresher, Func<T, int> getNumericId, params T[] instances)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
IntIdsRefreshed.AddRange(instances.Select(getNumericId));
|
||||
}
|
||||
|
||||
public void PerformRefresh<T>(IEnumerable<IServerRegistration> servers, ICacheRefresher refresher, Func<T, Guid> getGuidId, params T[] instances)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
GuidIdsRefreshed.AddRange(instances.Select(getGuidId));
|
||||
}
|
||||
|
||||
public void PerformRemove<T>(IEnumerable<IServerRegistration> servers, ICacheRefresher refresher, Func<T, int> getNumericId, params T[] instances)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
IntIdsRemoved.AddRange(instances.Select(getNumericId));
|
||||
}
|
||||
|
||||
public void PerformRemove(IEnumerable<IServerRegistration> servers, ICacheRefresher refresher, params int[] numericIds)
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Umbraco.Web.UI.Umbraco.Dialogs
|
||||
|
||||
protected string PageName { get; private set; }
|
||||
protected int DocumentId { get; private set; }
|
||||
protected string DocumentPath { get; private set; }
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
@@ -30,6 +31,7 @@ namespace Umbraco.Web.UI.Umbraco.Dialogs
|
||||
|
||||
DocumentId = doc.Id;
|
||||
PageName = doc.Name;
|
||||
DocumentPath = doc.Path;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
$(document).ready(function () {
|
||||
Umbraco.Dialogs.PublishDialog.getInstance().init({
|
||||
restServiceLocation: "<%= Url.GetBulkPublishServicePath() %>",
|
||||
documentId: <%= DocumentId %>
|
||||
documentId: <%= DocumentId %>,
|
||||
documentPath: '<%= DocumentPath %>'
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
@@ -57,6 +57,9 @@
|
||||
self._koViewModel.resultMessage(msgs[0]);
|
||||
}
|
||||
|
||||
//sync the tree
|
||||
UmbClientMgr.mainTree().setActiveTreeType('content');
|
||||
UmbClientMgr.mainTree().syncTree(self._opts.documentPath, true);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -59,6 +59,26 @@ namespace Umbraco.Web.Cache
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a request to all registered load-balanced servers to refresh node with the specified Id
|
||||
/// using the specified ICacheRefresher with the guid factoryGuid.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="factoryGuid"></param>
|
||||
/// <param name="getNumericId">The callback method to retreive the ID from an instance</param>
|
||||
/// <param name="instances">The instances containing Ids</param>
|
||||
/// <remarks>
|
||||
/// This method is much better for performance because it does not need to re-lookup an object instance
|
||||
/// </remarks>
|
||||
public void Refresh<T>(Guid factoryGuid, Func<T, int> getNumericId, params T[] instances)
|
||||
{
|
||||
ServerMessengerResolver.Current.Messenger.PerformRefresh<T>(
|
||||
ServerRegistrarResolver.Current.Registrar.Registrations,
|
||||
GetRefresherById(factoryGuid),
|
||||
getNumericId,
|
||||
instances);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a request to all registered load-balanced servers to refresh node with the specified Id
|
||||
/// using the specified ICacheRefresher with the guid factoryGuid.
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Web.Cache
|
||||
{
|
||||
@@ -56,6 +59,16 @@ namespace Umbraco.Web.Cache
|
||||
dc.Refresh(new Guid(DistributedCache.PageCacheRefresherId), pageId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes page cache for all instances passed in
|
||||
/// </summary>
|
||||
/// <param name="dc"></param>
|
||||
/// <param name="content"></param>
|
||||
public static void RefreshPageCache(this DistributedCache dc, IEnumerable<IContent> content)
|
||||
{
|
||||
dc.Refresh(new Guid(DistributedCache.PageCacheRefresherId), x => x.Id, content.ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the cache amongst servers for a page
|
||||
/// </summary>
|
||||
|
||||
@@ -66,10 +66,7 @@ namespace Umbraco.Web.Strategies.Publishing
|
||||
/// </summary>
|
||||
private void UpdateMultipleContentCache(IEnumerable<IContent> content)
|
||||
{
|
||||
foreach (var c in content)
|
||||
{
|
||||
DistributedCache.Instance.RefreshPageCache(c.Id);
|
||||
}
|
||||
DistributedCache.Instance.RefreshPageCache(content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -489,7 +489,6 @@ namespace umbraco
|
||||
UpdateDocumentCache(d);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates the document cache.
|
||||
/// </summary>
|
||||
|
||||
@@ -113,7 +113,7 @@ function openContent(id) {
|
||||
node.OpenIcon = dd.ContentTypeIcon;
|
||||
}
|
||||
|
||||
if (!dd.Published)
|
||||
if (!dd.HasPublishedVersion())
|
||||
node.Style.DimNode();
|
||||
|
||||
if (dd.HasPendingChanges())
|
||||
|
||||
Reference in New Issue
Block a user