[dokuwiki] Re: Mixture of syntax and action plugin wanted - how to do this?

  • From: Christopher Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Tue, 7 Feb 2012 14:29:02 +0000

On 6 Feb 2012, at 23:36, Michael Hamann wrote:

> Hi,
> 
> On Mon, Feb 6, 2012 at 10:27 PM, Christopher Smith <chris@xxxxxxxxxxxxx> 
> wrote:
>>> I'm also wondering why the cache for all pages with backlinks is
>>> purged when the page is saved …
>> 
>> I think its only purged for a page delete.
> 
> The metadata is only purged for page delete, but I mean the xhtml
> renderer cache. See
> https://github.com/splitbrain/dokuwiki/blob/master/inc/common.php#L1048
> I found that code while searching for metadata reloading code in the
> save function.

I guess its unknown whether or not the initial title (i.e. the heading used by 
use heading) has been changed.  Invalidating the cache for any page which uses 
that value is a safe way of ensuring they get a current value the next time 
they are rendered.

> 
>> p_read_metadata() can't be forced to override its cache.
> 
> Yes, but in fact that's a global array, so if we don't care about
> using kind of internal values in the save function, we could simply
> unset the cache directly in that global array.

Yes.  But hackish (see below).

> 
>> Its possible that metadata isn't read on a save.  p_get_metadata might be 
>> ok, testing required.  If not, hacking of the metadata cache is required.
> 
> Metadata is read relatively early in every request when pageinfo() is
> executed (which is in doku.php even before the DOKUWIKI_STARTED event
> which is also still before act_dispatch) so I assume it is read before
> the page is saved.

Yes, you're right.

I don't like the idea of accessing the global $cache_metadata outside of those 
functions which really should know about the metadata cache.  You are building 
in dependencies in parts of the code which should only deal through defined 
interfaces. Is it reasonable to add a function, p_flush_metadata_cache($id), to 
handle it?

- Chris



--
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: