Manages information about Page Redirections.
예제 #1
0
 protected void btnClearCache_Click(object sender, EventArgs e)
 {
     Redirections.Clear();
     Content.ClearPseudoCache();
     Content.InvalidateAllPages();
     PrintSystemStatus();
 }
예제 #2
0
        /// <summary>
        /// Invalidates all the cache Contents.
        /// </summary>
        public static void InvalidateAllPages()
        {
            Cache.ClearPageCache();
            Redirections.Clear();

            foreach (var pageProvider in Collectors.PagesProviderCollector.AllProviders)
            {
                pageProvider.PruneContentCache();
            }
        }
예제 #3
0
        /// <summary>
        /// Verifies the need for a page redirection, and performs it when appropriate.
        /// </summary>
        private void VerifyAndPerformPageRedirection()
        {
            if (currentPage == null)
            {
                return;
            }

            // Force formatting so that the destination can be detected
            Content.GetFormattedPageContent(currentPage, true);

            PageInfo dest = Redirections.GetDestination(currentPage, out var fragment);

            if (dest == null)
            {
                return;
            }

            if (dest != null)
            {
                if (Request["NoRedirect"] != "1")
                {
                    var fullUrl = dest.FullName + Settings.PageExtension + "?From=" + currentPage.FullName;
                    if (!string.IsNullOrEmpty(fragment))
                    {
                        fullUrl += "#" + fragment;
                    }

                    UrlTools.Redirect(fullUrl, false);
                }
                else
                {
                    // Write redirection hint
                    var sb = new StringBuilder();
                    sb.Append(@"<div id=""RedirectionDiv"">");
                    sb.Append(Properties.Messages.ThisPageRedirectsTo);
                    sb.Append(": ");
                    sb.Append(@"<a href=""");

                    var fullUrl = UrlTools.BuildUrl("++", Tools.UrlEncode(dest.FullName), Settings.PageExtension, "?From=", Tools.UrlEncode(currentPage.FullName));
                    if (!string.IsNullOrEmpty(fragment))
                    {
                        fullUrl += "#" + fragment;
                    }
                    sb.Append(fullUrl);
                    sb.Append(@""">");
                    PageContent k = Content.GetPageContent(dest, true);
                    sb.Append(FormattingPipeline.PrepareTitle(k.Title, false, FormattingContext.PageContent, currentPage));
                    sb.Append("</a></div>");
                    var literal = new Literal();
                    literal.Text = sb.ToString();
                    plhContent.Controls.Add(literal);
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Verifies the need for a page redirection, and performs it when appropriate.
        /// </summary>
        private void VerifyAndPerformPageRedirection()
        {
            if (currentPage == null)
            {
                return;
            }

            // Force formatting so that the destination can be detected
            FormattedContent.GetFormattedPageContent(currentWiki, currentPage);

            PageContent dest = Redirections.GetDestination(currentPage.FullName);

            if (dest == null)
            {
                return;
            }

            if (dest != null)
            {
                if (Request["NoRedirect"] != "1")
                {
                    UrlTools.Redirect(dest.FullName + GlobalSettings.PageExtension + "?From=" + currentPage.FullName, false);
                }
                else
                {
                    // Write redirection hint
                    StringBuilder sb = new StringBuilder();
                    sb.Append(@"<div id=""RedirectionDiv"">");
                    sb.Append(Properties.Messages.ThisPageRedirectsTo);
                    sb.Append(": ");
                    sb.Append(@"<a href=""");
                    UrlTools.BuildUrl(currentWiki, sb, "++", Tools.UrlEncode(dest.FullName), GlobalSettings.PageExtension, "?From=", Tools.UrlEncode(currentPage.FullName));
                    sb.Append(@""">");
                    sb.Append(FormattingPipeline.PrepareTitle(currentWiki, dest.Title, false, FormattingContext.PageContent, currentPage.FullName));
                    sb.Append("</a></div>");
                    Literal literal = new Literal();
                    literal.Text = sb.ToString();
                    plhContent.Controls.Add(literal);
                }
            }
        }
예제 #5
0
 /// <summary>
 /// Clears the pseudo cache.
 /// </summary>
 public static void ClearPseudoCache()
 {
     Cache.ClearPseudoCache();
     Redirections.Clear();
 }
예제 #6
0
 /// <summary>
 /// Invalidates all the cache Contents.
 /// </summary>
 public static void InvalidateAllPages()
 {
     Cache.ClearPageCache();
     Redirections.Clear();
 }
예제 #7
0
 /// <summary>
 /// Invalidates the cached Content of a Page.
 /// </summary>
 /// <param name="pageInfo">The Page to invalidate the cached content of.</param>
 public static void InvalidatePage(PageInfo pageInfo)
 {
     Cache.RemovePage(pageInfo);
     Redirections.WipePageOut(pageInfo);
 }
예제 #8
0
 /// <summary>
 /// Invalidates the cached Content of a Page.
 /// </summary>
 /// <param name="pageInfo">The Page to invalidate the cached content of.</param>
 public static void InvalidatePage(PageInfo pageInfo)
 {
     Cache.RemovePage(pageInfo);
     Redirections.WipePageOut(pageInfo);
     pageInfo.Provider.RemoveContentCache(pageInfo);
 }