Fixes: U4-1550 Publish notifications on a load balanced environment
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using umbraco.BusinessLogic.Actions;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Publishing;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Web.Strategies
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// This is used to trigger the legacy ActionHandlers based on events
|
||||
/// </summary>
|
||||
public sealed class LegacyActionHandlerEventHandler : ApplicationEventHandler
|
||||
{
|
||||
//NOTE: this is to fix this currently: http://issues.umbraco.org/issue/U4-1550
|
||||
|
||||
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
|
||||
{
|
||||
ContentService.Published += ContentService_Published;
|
||||
ContentService.UnPublished += ContentService_UnPublished;
|
||||
}
|
||||
|
||||
static void ContentService_UnPublished(IPublishingStrategy sender, PublishEventArgs<IContent> e)
|
||||
{
|
||||
e.PublishedEntities.ForEach(x =>
|
||||
global::umbraco.BusinessLogic.Actions.Action.RunActionHandlers(
|
||||
new Document(x), ActionUnPublish.Instance));
|
||||
}
|
||||
|
||||
static void ContentService_Published(IPublishingStrategy sender, PublishEventArgs<IContent> e)
|
||||
{
|
||||
e.PublishedEntities.ForEach(x =>
|
||||
global::umbraco.BusinessLogic.Actions.Action.RunActionHandlers(
|
||||
new Document(x), ActionPublish.Instance));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -401,6 +401,7 @@
|
||||
<Compile Include="Security\ValidateRequestAttempt.cs" />
|
||||
<Compile Include="Security\WebSecurity.cs" />
|
||||
<Compile Include="Standalone\WriteableConfigSystem.cs" />
|
||||
<Compile Include="Strategies\LegacyActionHandlerEventHandler.cs" />
|
||||
<Compile Include="Strategies\Migrations\ClearMediaXmlCacheForDeletedItemsAfterUpgrade.cs" />
|
||||
<Compile Include="Strategies\Migrations\RebuildMediaXmlCacheAfterUpgrade.cs" />
|
||||
<Compile Include="Strategies\PublicAccessEventHandler.cs" />
|
||||
|
||||
@@ -521,9 +521,7 @@ namespace umbraco
|
||||
|
||||
var cachedFieldKeyStart = string.Format("{0}{1}_", CacheKeys.ContentItemCacheKey, d.Id);
|
||||
ApplicationContext.Current.ApplicationCache.ClearCacheByKeySearch(cachedFieldKeyStart);
|
||||
|
||||
Action.RunActionHandlers(d, ActionPublish.Instance);
|
||||
|
||||
|
||||
FireAfterUpdateDocumentCache(d, e);
|
||||
}
|
||||
}
|
||||
@@ -532,6 +530,7 @@ namespace umbraco
|
||||
/// Updates the document cache for multiple documents
|
||||
/// </summary>
|
||||
/// <param name="Documents">The documents.</param>
|
||||
[Obsolete("This is not used and will be removed from the codebase in future versions")]
|
||||
public virtual void UpdateDocumentCache(List<Document> Documents)
|
||||
{
|
||||
// We need to lock content cache here, because we cannot allow other threads
|
||||
@@ -550,11 +549,6 @@ namespace umbraco
|
||||
XmlContentInternal = xmlContentCopy;
|
||||
ClearContextCache();
|
||||
}
|
||||
|
||||
foreach (Document d in Documents)
|
||||
{
|
||||
Action.RunActionHandlers(d, ActionPublish.Instance);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -635,12 +629,6 @@ namespace umbraco
|
||||
}
|
||||
}
|
||||
|
||||
if (x != null)
|
||||
{
|
||||
// Run Handler
|
||||
Action.RunActionHandlers(doc, ActionUnPublish.Instance);
|
||||
}
|
||||
|
||||
//SD: changed to fire event BEFORE running the sitemap!! argh.
|
||||
FireAfterClearDocumentCache(doc, e);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user