private void DataEngine_DeletedItem(object sender, ExecutedEventArgs <DeleteItemCommand> e) { Cache.RemoveTree(e.Command.Item); SkipItemCache.UnSkipItem(e.Command.Item); }
private void DataEngine_DeletedItemRemote(object sender, ItemDeletedRemoteEventArgs e) { Cache.RemoveTree(e.Item); SkipItemCache.UnSkipItem(e.Item); }
private bool IsFallbackSupported(Field field) { if (FieldFallback.Data.FallbackDisabler.CurrentValue == FallbackStates.Disabled) { //Logger.Debug("@ Fallback Disabled by Disabler [{0}:{1}]", field.Item.Name, field.Name); return(false); } Assert.ArgumentNotNull(field, "field"); if (IsIgnoredField(field)) { //Logger.Debug("@ Field {0} is ignored", field.Name); return(false); } // Check the cache to see if this field is supported if (_supportCache.GetFallbackSupport(field).HasValue) { //Logger.Debug("@ IsFallbackSupported (cache hit - {0}) ", SupportCache.GetFallbackSupport(field).Value); return(_supportCache.GetFallbackSupport(field).Value); } Item item = field.Item; Assert.ArgumentNotNull(item, "item"); // see if we know this item should be skipped if (SkipItemCache.IsItemSkipped(item)) { //Logger.Debug("@ IsFallbackSupported (SkipItemCache cache hit) "); return(false); } bool isSupported = true; // Sitecore 7 Parallel Indexing may not supply us with a SiteContext... // Manually set it in this instnce // https://github.com/HedgehogDevelopment/sitecore-field-fallback/issues/3 if (Sitecore.Context.Site == null && Sitecore.Configuration.Settings.GetBoolSetting("ContentSearch.ParallelIndexing.Enabled", false)) { Logger.Warn("Sitecore.Context.Site was null and ContentSearch.ParallelIndexing.Enabled was true. Manually setting to 'shell' site. For more info see here: https://github.com/HedgehogDevelopment/sitecore-field-fallback/issues/3", this); Sitecore.Sites.SiteContext site = Sitecore.Sites.SiteContextFactory.GetSiteContext("shell"); Sitecore.Context.Site = site; } Logger.Debug(">> IsFallbackSupported - s:{0} db:{1} i:{2} f:{3}", Sitecore.Context.GetSiteName(), item.Database.Name, item.ID, field.Name); Logger.PushIndent(); if (!_siteManager.IsFallbackEnabledForDisplayMode(Sitecore.Context.Site)) { Logger.Debug("Fallback is not enabled for current page mode"); isSupported = false; } else if (!_siteManager.IsFallbackEnabled(Sitecore.Context.Site.SiteInfo)) { Logger.Debug("Fallback is not enabled for site {0}", Sitecore.Context.Site.Name); isSupported = false; } else if (!IsItemInSupportedDatabase(item)) { Logger.Debug("Item database '{0}' not valid.", item.Database.Name); isSupported = false; // lets cache this item as skipped to prevent future checks on it SkipItemCache.SetSkippedItem(item); } else if (!IsItemInSupportedPath(item)) // it must be under /sitecore/content or /sitecore/media library { Logger.Debug("Item {0} is in an invalid path", item.Name); isSupported = false; // lets cache this item as skipped to prevent future checks on it SkipItemCache.SetSkippedItem(item); } _supportCache.SetFallbackSupport(field, isSupported); Logger.PopIndent(); Logger.Debug("<< IsFallbackSupported: {0}", isSupported); return(isSupported); }