Modify

Opened 15 years ago

Closed 12 years ago

Last modified 12 years ago

#6763 closed defect (wontfix)

[patch] WikiRenamePlugin doesn't invalidate wiki page name cache after moving page

Reported by: Steffen Hoffmann Owned by: Noah Kantrowitz
Priority: normal Component: WikiRenamePlugin
Severity: minor Keywords: CacheManager WikiSystem invalidate
Cc: Trac Release: 0.11

Description

observed behavior:

  1. access page with valid call for WikiTicketCalendarMacro, see: some day has not yet a corresponding wiki page (i.e. "2" of Mar 2010 isn't highlighted as if page no exists)
  2. create wiki page through link provided by WikiTicketCalendarMacro calender (i.e. http:/<trac_url>/wiki/Cal/2010-03-02)
  3. access new page directly via http://<trac_url>/wiki/<new page> (i.e. typing http:/<trac_url>/wiki/Cal/2010-03-02 into browser) - success
  4. access page with valid call for WikiTicketCalendarMacro, see: day in question highlighted now
  5. access wiki page through link provided by WikiTicketCalendarMacro calender - success
  6. rename new page with WikiRenamePlugin respecting actual syntax of WikiTicketCalendarMacro call in question (i.e. wiki/Cal/2010-03-02 -> wiki/Cal/2010-03-03)
  7. access renamed page directly via http://<trac_url>/wiki/<renamed page> (i.e. typing http:/<trac_url>/wiki/Cal/2010-03-03 into browser) - success
  8. access pages old location directly via http://<trac_url>/wiki/<new page> (i.e. typing http:/<trac_url>/wiki/Cal/2010-03-02 into browser) - page missing as expected
  9. access page with unchanged call for WikiTicketCalendarMacro, i.e. see:
    1. link to former wiki page (i.e. "2" of Mar 2010) still highlighted as if page exists
    2. link to renamed wiki page (i.e. "3" of Mar 2010) is not highlighted as if page not exists
  10. access relevant wiki pages through link provided by WikiTicketCalendarMacro calender, see:
    1. link to former wiki page (i.e. "2") - page missing, getting offer to create it
    2. link to renamed wiki page (i.e. "3") which has "?action=edit" appended - page exists, so getting offer to save v2 (!)

conclusion:

WikiTicketCalendarMacro does rely on cached wiki page, but WikiRenamePlugin doesn't give appropriate notice of effective page name changes (to CacheManager (used by WikiSystem), approved/details found by code studies)

Attachments (2)

20100303_wikirename-trigger-cachemgr.diff (438 bytes) - added by Steffen Hoffmann 15 years ago.
unified diff showing how to add required cache invalidation
20100303_wikirename-trigger-cachemgr.2.diff (436 bytes) - added by Steffen Hoffmann 15 years ago.
updated unified diff (lines 1+2 were mangled, still no display, please load original format)

Download all attachments as: .zip

Change History (9)

comment:1 Changed 15 years ago by Steffen Hoffmann

Summary: WikiRenamePlugin doesn't invalidate wiki page name cache after moving page[patch] WikiRenamePlugin doesn't invalidate wiki page name cache after moving page

solution found by studying CacheManager, syntax of cache invalidation found in

http://svn.edgewall.com/repos/trac/trunk/trac/wiki/model.py

proposed patch for WikiRenamePlugin:

--- ./wikirename_trunk-7750/wikirename/util.py	2010-03-03 22:54 +0100
+++ ./wikirename_development/wikirename/util.py	2010-03-03 22:57 +0100
@@ -8,6 +8,7 @@
 
 from trac.core import *
 from trac.env import *
+from trac.wiki.api import WikiSystem
 
 __all__ = ['main', 'rename_page']
 
@@ -87,5 +88,6 @@
 
     if handle_commit:
         db.commit()
-
+        # Invalidate page name cache
+        WikiSystem(env).pages.invalidate(db)

successfully tested here

Changed 15 years ago by Steffen Hoffmann

unified diff showing how to add required cache invalidation

Changed 15 years ago by Steffen Hoffmann

updated unified diff (lines 1+2 were mangled, still no display, please load original format)

comment:2 Changed 15 years ago by Steffen Hoffmann

second link shows diff in Trac style after importing (almost) the same patch twice - weird

comment:3 Changed 12 years ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

The plugin is deprecated since there is now support in the Trac core.

comment:4 Changed 12 years ago by Ryan J Ollos

If you'd like to apply patches I can provide you commit access.

comment:5 Changed 12 years ago by Steffen Hoffmann

Sure, since Trac wiki rename feature still needs to be supported in some plugins that this plugin handles for me until now, I would like to apply patches, that I use day-by-day with success.

comment:6 Changed 12 years ago by Steffen Hoffmann

(This is an very old ticket of mine before registration here.)

The invalidation can be done even better than I've suggested here to work even for Trac-1.0, so I'll apply an updated version then.

comment:7 Changed 12 years ago by Ryan J Ollos

Thank you. I've been trying to close out ticket for projects that are deprecated. I may have gotten a bit overzealous in closing ticket for this one since it is still relevant in Trac 0.11.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Noah Kantrowitz.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.