private void InvalidateContainerCaches(ContentContextBase context)
 {
     var stereotype = context.ContentItem.GetStereotype();
     if (string.Equals(stereotype, "Widget", StringComparison.InvariantCultureIgnoreCase)) 
     {
         InvalidateLayerCaches(CachedLayerRetrievalService.WidgetContainersCacheKey);
     }
 }
        private void EnforceResourceSharingOffOnDefault(ContentContextBase context)
        {
            if (context.ContentItem.Id != 1) return;

            var settingsPart = context.ContentItem.As<CombinatorSettingsPart>();

            if (_shellSettings.Name == ShellSettings.DefaultName && settingsPart.EnableResourceSharing)
            {
                settingsPart.EnableResourceSharing = false;
            }
        }
        public void UpdateStorage(ContentContextBase context, PackageVersionPart part) {
            var version = SemVersion.Parse(part.Version);
            part.Record.VersionMajor = version.Major;
            part.Record.VersionMinor = version.Minor;
            part.Record.VersionPatch = version.Patch;

            // Update package information
            var container = part.CommonPart.Container.As<PackagePart>();
            if (container != null) {
                part.Record.PackageVersionId = container.PackageId.ToLowerInvariant() + "/" + part.Version;

                if (String.IsNullOrEmpty(container.LatestVersion) || SemVersion.Parse(container.LatestVersion) < version) {
                    container.LatestVersionUtc = part.CommonPart.ModifiedUtc.Value;
                    container.LatestVersion = part.Version;
                }
            }
        }
        private void InvalidateCachesAfteMenuItemChanges(ContentContextBase context)
        {
            if (_recipeIsExecuting)
                return;

            var stereotype = context.ContentItem.GetStereotype();

            if (string.Equals(stereotype, "MenuItem", StringComparison.InvariantCultureIgnoreCase))
            {
                var menuItemId = context.ContentItem.Id;

                //get all menu ids
                var allMenuIds = _contentManager.Query("Menu").List().Select(ci => ci.Id);
                var relevantMenuIds = new List<int>();

                //foreach menu id, check to see if the menu contains this menu part
                foreach (var menuId in allMenuIds)
                {
                    if (_menuService.GetMenuParts(menuId).Select(p => p.Id).Contains(menuItemId))
                    {
                        relevantMenuIds.Add(menuId);
                    }
                }

                //if so, get all menu widgets that use this menu and invalidate cache
                foreach (var menuId in relevantMenuIds)
                {
                    var scopedMenuId = menuId;
                    var menuWidgets = _contentManager
                        .Query<MenuWidgetPart>(GetMenuWidgetContentTypes())
                        .List()
                        .Where(p => p.MenuContentItemId == scopedMenuId);

                    _outputCachedPartsService.InvalidateCachedOutput(menuWidgets);
                }
            }
        }
예제 #5
0
        void ModifiedHandler(ContentContextBase context, ResourceFormPart part)
        {

        }
 private void TriggerIfGraph(ContentContextBase context)
 {
     if (context.ContentType != "AssociativyGraph") return;
     _cacheService.Remove(CacheKey);
 }
 private void EmptyCache(ContentContextBase ctx, UrlPermissionPart part)
 {
     _signals.Trigger(Signals.UrlPatternsSignal);
 }
 void RemoveIndexingTask(ContentContextBase context, ContentPart part) {
     _indexingTaskManager.CreateDeleteIndexTask(context.ContentItem);
 }
 void CreateIndexingTask(ContentContextBase context, ContentPart part) {
     _indexingTaskManager.CreateUpdateIndexTask(context.ContentItem);
 }
예제 #10
0
 void ModifiedHandler(ContentContextBase context, LdapDirectoryPart part)
 {
     if (context.ContentItem.ContentType == "LdapDirectory")
         ldapDirectoryCache.Invalidate();
 }