Exemplo n.º 1
0
        public void ClearAllCache([FromBody] AgilityPublishRequest publishRequest)
        {
            WebTrace.WriteInfoLine("Triggering Cache Clear: " + publishRequest.WebsiteName + " - " + publishRequest.SecurityKey);

            ValidateRequest(publishRequest.WebsiteName, publishRequest.SecurityKey);

            //trigger a sync that will sync ALL items
            Sync.SyncThread.QueueSyncThread(publishRequest, true);
        }
Exemplo n.º 2
0
        protected virtual AgilitySiteMapNode GenerateAgilitySitemap()
        {
            // Since the SiteMap class is static, make sure that it is
            // not modified while the site map is built.

            AgilitySiteMapNode rootNode = null;

            WebTrace.WriteInfoLine(
                $"Building Sitemap: {AgilityContext.CurrentMode}, {AgilityContext.LanguageCode}, {AgilityContext.WebsiteName}, {AgilityContext.CurrentChannel.ReferenceName}");

            // Start with a clean slate
            _tmpAddedNodes.Clear();

            if (menuXml != null)
            {
                //THE ROOT NODE
                rootNode = new AgilitySiteMapNode(string.Empty, string.Empty, string.Empty)
                {
                    ParentNode = null
                };
            }
            else
            {
                return(null);
            }

            if (menuXml.DocumentElement == null)
            {
                return(null);
            }

            //get the xml element that represents this channel

            var channelElem = (menuXml.DocumentElement.SelectSingleNode(
                                   $"//ChannelNode[@channelID='{AgilityContext.CurrentChannel.ID}']")
                               ?? menuXml.DocumentElement.SelectSingleNode("ChannelNode"))
                              ?? menuXml.DocumentElement;


            var childNodes = channelElem.SelectNodes("SiteNode");

            if (childNodes == null)
            {
                return(rootNode);
            }

            foreach (XmlElement elem in childNodes)
            {
                var childNode = ConvertXmlElementToSiteMapNode(elem, null);
                if (childNode == null)
                {
                    continue;
                }

                //if the child node wasn't excluded via timed release
                var agilitySiteMapNodes = AddNode(childNode, rootNode);

                foreach (var agilitySiteMapNode in agilitySiteMapNodes)
                {
                    //add it's children
                    AddChildNodes(agilitySiteMapNode, elem);
                }
            }

            return(rootNode);
        }