Fixed #417: attachments are correctly moved/deleted when renaming/deleting a page.
This commit is contained in:
parent
861db9beef
commit
123c1755ff
2 changed files with 24 additions and 5 deletions
|
@ -16,5 +16,5 @@ using System.Reflection;
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("3.0.1.427")]
|
[assembly: AssemblyVersion("3.0.1.428")]
|
||||||
[assembly: AssemblyFileVersion("3.0.1.427")]
|
[assembly: AssemblyFileVersion("3.0.1.428")]
|
||||||
|
|
|
@ -538,6 +538,12 @@ namespace ScrewTurn.Wiki {
|
||||||
if(done) {
|
if(done) {
|
||||||
AuthWriter.ClearEntriesForPage(page.FullName);
|
AuthWriter.ClearEntriesForPage(page.FullName);
|
||||||
|
|
||||||
|
foreach(IFilesStorageProviderV30 prov in Collectors.FilesProviderCollector.AllProviders) {
|
||||||
|
foreach(string attn in prov.ListPageAttachments(page)) {
|
||||||
|
prov.DeletePageAttachment(page, attn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Remove the deleted page from the Breadcrumbs Trail and Redirections list
|
// Remove the deleted page from the Breadcrumbs Trail and Redirections list
|
||||||
SessionFacade.Breadcrumbs.RemovePage(page);
|
SessionFacade.Breadcrumbs.RemovePage(page);
|
||||||
Redirections.WipePageOut(page);
|
Redirections.WipePageOut(page);
|
||||||
|
@ -573,13 +579,20 @@ namespace ScrewTurn.Wiki {
|
||||||
|
|
||||||
string oldName = page.FullName;
|
string oldName = page.FullName;
|
||||||
|
|
||||||
string title = Content.GetPageContent(page, false).Title;
|
PageContent originalContent = Content.GetPageContent(page, false);
|
||||||
|
|
||||||
|
Settings.Provider.StoreOutgoingLinks(page.FullName, new string[0]);
|
||||||
PageInfo pg = page.Provider.RenamePage(page, name);
|
PageInfo pg = page.Provider.RenamePage(page, name);
|
||||||
if(pg != null) {
|
if(pg != null) {
|
||||||
AuthWriter.ClearEntriesForPage(newFullName);
|
AuthWriter.ClearEntriesForPage(newFullName);
|
||||||
AuthWriter.ProcessPageRenaming(oldName, newFullName);
|
AuthWriter.ProcessPageRenaming(oldName, newFullName);
|
||||||
|
|
||||||
|
foreach(IFilesStorageProviderV30 prov in Collectors.FilesProviderCollector.AllProviders) {
|
||||||
|
prov.NotifyPageRenaming(new PageInfo(oldName, page.Provider, page.CreationDateTime), pg);
|
||||||
|
}
|
||||||
|
|
||||||
|
StorePageOutgoingLinks(pg, originalContent.Content);
|
||||||
|
|
||||||
SessionFacade.Breadcrumbs.RemovePage(page);
|
SessionFacade.Breadcrumbs.RemovePage(page);
|
||||||
Redirections.Clear();
|
Redirections.Clear();
|
||||||
Content.InvalidateAllPages();
|
Content.InvalidateAllPages();
|
||||||
|
@ -587,8 +600,8 @@ namespace ScrewTurn.Wiki {
|
||||||
|
|
||||||
// Page redirect is implemented directly in AdminPages.aspx.cs
|
// Page redirect is implemented directly in AdminPages.aspx.cs
|
||||||
|
|
||||||
Log.LogEntry("Page " + page.FullName + " renamed to " + name, EntryType.General, Log.SystemUsername);
|
Log.LogEntry("Page " + oldName + " renamed to " + name, EntryType.General, Log.SystemUsername);
|
||||||
RecentChanges.AddChange(page.FullName, title, null, DateTime.Now, SessionFacade.GetCurrentUsername(), Change.PageRenamed, "");
|
RecentChanges.AddChange(page.FullName, originalContent.Title, null, DateTime.Now, SessionFacade.GetCurrentUsername(), Change.PageRenamed, "");
|
||||||
Host.Instance.OnPageActivity(page, oldName, SessionFacade.GetCurrentUsername(), PageActivity.PageRenamed);
|
Host.Instance.OnPageActivity(page, oldName, SessionFacade.GetCurrentUsername(), PageActivity.PageRenamed);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -606,11 +619,17 @@ namespace ScrewTurn.Wiki {
|
||||||
/// <param name="copyCategories">A value indicating whether to copy the page categories to the target namespace.</param>
|
/// <param name="copyCategories">A value indicating whether to copy the page categories to the target namespace.</param>
|
||||||
/// <returns><c>true</c> if the page is migrated, <c>false</c> otherwise.</returns>
|
/// <returns><c>true</c> if the page is migrated, <c>false</c> otherwise.</returns>
|
||||||
public static bool MigratePage(PageInfo page, NamespaceInfo targetNamespace, bool copyCategories) {
|
public static bool MigratePage(PageInfo page, NamespaceInfo targetNamespace, bool copyCategories) {
|
||||||
|
string oldName = page.FullName;
|
||||||
|
|
||||||
PageInfo result = page.Provider.MovePage(page, targetNamespace, copyCategories);
|
PageInfo result = page.Provider.MovePage(page, targetNamespace, copyCategories);
|
||||||
if(result != null) {
|
if(result != null) {
|
||||||
Settings.Provider.StoreOutgoingLinks(page.FullName, new string[0]);
|
Settings.Provider.StoreOutgoingLinks(page.FullName, new string[0]);
|
||||||
PageContent content = Content.GetPageContent(result, false);
|
PageContent content = Content.GetPageContent(result, false);
|
||||||
StorePageOutgoingLinks(result, content.Content);
|
StorePageOutgoingLinks(result, content.Content);
|
||||||
|
|
||||||
|
foreach(IFilesStorageProviderV30 prov in Collectors.FilesProviderCollector.AllProviders) {
|
||||||
|
prov.NotifyPageRenaming(new PageInfo(oldName, page.Provider, page.CreationDateTime), result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result != null;
|
return result != null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue