U4-9462 - missed one safeXml.AcceptChanges

This commit is contained in:
Stephan
2017-03-15 14:50:42 +01:00
parent 3121ea6111
commit 496e6c1711
2 changed files with 19 additions and 25 deletions

View File

@@ -50,7 +50,7 @@ namespace Umbraco.Web.Cache
/// </summary>
public override void RefreshAll()
{
content.Instance.RefreshContentFromDatabaseAsync();
content.Instance.RefreshContentFromDatabase();
base.RefreshAll();
}

View File

@@ -181,12 +181,12 @@ namespace umbraco
var e = new RefreshContentEventArgs();
FireBeforeRefreshContent(e);
if (!e.Cancel)
if (e.Cancel) return;
using (var safeXml = GetSafeXmlWriter())
{
using (var safeXml = GetSafeXmlWriter())
{
safeXml.Xml = LoadContentFromDatabase();
}
safeXml.Xml = LoadContentFromDatabase();
safeXml.AcceptChanges();
}
}
@@ -295,21 +295,20 @@ namespace umbraco
var e = new DocumentCacheEventArgs();
FireBeforeUpdateDocumentCache(d, e);
if (!e.Cancel)
if (e.Cancel) return;
// lock the xml cache so no other thread can write to it at the same time
// note that some threads could read from it while we hold the lock, though
using (var safeXml = GetSafeXmlWriter())
{
// lock the xml cache so no other thread can write to it at the same time
// note that some threads could read from it while we hold the lock, though
using (var safeXml = GetSafeXmlWriter())
{
safeXml.Xml = PublishNodeDo(d, safeXml.Xml, true);
safeXml.AcceptChanges();
}
var cachedFieldKeyStart = string.Format("{0}{1}_", CacheKeys.ContentItemCacheKey, d.Id);
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(cachedFieldKeyStart);
FireAfterUpdateDocumentCache(d, e);
safeXml.Xml = PublishNodeDo(d, safeXml.Xml, true);
safeXml.AcceptChanges();
}
var cachedFieldKeyStart = string.Format("{0}{1}_", CacheKeys.ContentItemCacheKey, d.Id);
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(cachedFieldKeyStart);
FireAfterUpdateDocumentCache(d, e);
}
internal virtual void UpdateSortOrder(int contentId)
@@ -370,14 +369,9 @@ namespace umbraco
[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
// making changes at the same time, they need to be queued
int parentid = Documents[0].Id;
using (var safeXml = GetSafeXmlWriter())
{
foreach (Document d in Documents)
foreach (var d in Documents)
{
safeXml.Xml = PublishNodeDo(d, safeXml.Xml, true);
}