Fixed issue with inter-namespace page redirection.

This commit is contained in:
Dario Solera 2009-10-16 10:12:28 +00:00
parent 8c5febca3f
commit 7e203d3c3b
5 changed files with 20 additions and 7 deletions

View file

@ -16,5 +16,5 @@ using System.Reflection;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("3.0.1.401")]
[assembly: AssemblyFileVersion("3.0.1.401")]
[assembly: AssemblyVersion("3.0.1.402")]
[assembly: AssemblyFileVersion("3.0.1.402")]

View file

@ -37,6 +37,7 @@ namespace ScrewTurn.Wiki {
/// </summary>
public static void ClearPseudoCache() {
Cache.ClearPseudoCache();
Redirections.Clear();
}
/// <summary>
@ -91,6 +92,7 @@ namespace ScrewTurn.Wiki {
/// <param name="pageInfo">The Page to invalidate the cached content of.</param>
public static void InvalidatePage(PageInfo pageInfo) {
Cache.RemovePage(pageInfo);
Redirections.WipePageOut(pageInfo);
}
/// <summary>
@ -98,6 +100,7 @@ namespace ScrewTurn.Wiki {
/// </summary>
public static void InvalidateAllPages() {
Cache.ClearPageCache();
Redirections.Clear();
}
}

View file

@ -637,12 +637,13 @@ namespace ScrewTurn.Wiki {
sb.Replace("~~~~", "§§(" + username + "," + dateTime.ToString("yyyy'/'MM'/'dd' 'HH':'mm':'ss") + ")§§");
content = sb.ToString();
bool done = page.Provider.ModifyPage(page, title, username, dateTime, comment, content, keywords, description, saveMode);
if(done) {
// Because of transclusion and other page-linking features, it is necessary to clear the whole cache
Content.ClearPseudoCache();
Content.InvalidateAllPages();
bool done = page.Provider.ModifyPage(page, title, username, dateTime, comment, content, keywords, description, saveMode);
if(done) {
Log.LogEntry("Page Content updated for " + page.FullName, EntryType.General, Log.SystemUsername);
StorePageOutgoingLinks(page, content);

View file

@ -86,8 +86,17 @@ namespace ScrewTurn.Wiki {
/// </summary>
/// <param name="target">The target URL.</param>
public static void Redirect(string target) {
Redirect(target, true);
}
/// <summary>
/// Redirects the current response to the specified URL, appending the current namespace if requested.
/// </summary>
/// <param name="target">The target URL.</param>
/// <param name="addNamespace">A value indicating whether to add the namespace.</param>
public static void Redirect(string target, bool addNamespace) {
string nspace = HttpContext.Current.Request["NS"];
if(nspace == null || nspace.Length == 0) HttpContext.Current.Response.Redirect(target);
if(nspace == null || nspace.Length == 0 || !addNamespace) HttpContext.Current.Response.Redirect(target);
else HttpContext.Current.Response.Redirect(target + (target.Contains("?") ? "&" : "?") + "NS=" + Tools.UrlEncode(nspace));
}

View file

@ -351,7 +351,7 @@ namespace ScrewTurn.Wiki {
if(dest != null) {
if(Request["NoRedirect"] != "1") {
UrlTools.Redirect(dest.FullName + Settings.PageExtension + "?From=" + currentPage.FullName);
UrlTools.Redirect(dest.FullName + Settings.PageExtension + "?From=" + currentPage.FullName, false);
}
else {
// Write redirection hint