2007-08-27
dgstangel
When useheading is enabled (http://wiki.splitbrain.org/wiki:useheading), the title of a page is set to the first heading appearing in that page.
This feature works well, except that when a page's heading is changed, and thus its title, the cached pages that refer to it are not updated when the page is saved.
The only way I can reliably get the referring pages to be updated to use the new title is by making some sort of edit to the referring page (such as adding a space or newline).
It is very difficult to edit in real-time and maintain consistency (and sanity!) when the page titles do not update reliably across the wiki. I suggest that the cache should be flushed for those pages that are referring to a page whose title has changed, so that they display the correct title. Otherwise the dynamic heading titles do not work very well.
Example:
1. Create "Page A", that contains a reference to "Page B".
2. Edit Page B, and create a heading: ===== Title of Page B ======. Now the title of Page B will be "Title of Page B" if the useheading option is set. Note that the title of Page B has changed, as seen in Page A.
4. Again edit Page B and change the heading: ===== New Title of Page B =====. Save the change.
5. Return to Page A. The title of Page B will not be updated to the new title. The only way to update the title of Page B as displayed in Page A is to edit Page A and make some modification.
Proposed Solution:
I don't know DokuWiki internals very well, but I would suggest the following solution:
When a page is saved (in function saveWikiText in inc/common.php) and the title has changed as a result of a heading change, the function should iterate through each page in the backlinks and touch each one so that it is flushed from the cache. That way, each page that refers to the modified title will reflect the change.
I'm not 100% sure if that will work, but seems like it ought to.