[dokuwiki] Re: plugin render() called multiple times for metadata?

  • From: Christopher Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Thu, 28 May 2009 14:11:02 +0100


On 28 May 2009, at 11:32, Chris None wrote:


If you're not using "purge=1", it shouldn't be, presumably your xdebug profiling will show the circumstance. If it is, package up the useful bits of your xdebug profile and file a bug report.



Hmm... I've never explicitly changed the "purge" option. I am not sure what the default is.

$conf['useheading'] is set to 0.

I should have been more specific with my previous question:

1) In some circumstances, it appears that a syntax plugin's render() function can be called twice with the format set to 'metadata' when saving a page. This is undesirable for me...

please file a bug report @ http://bugs.dokuwiki.org

I now think I know why the two calls are made after saving and before displaying the changed page(*) - metadata is kept in step with xhtml, so fresh xhtml means fresh metadata. This will be triggered after page editing as well as on other occasions. - a new changelog entry (part of page editing process) requests metadata be re-rendered.
  Ben (Coburn), Andi, do you know if/why re-rendering is required here.

(*) I don't reckon these are on the same "run". changelog is part of the save process and done on the "POST". xhtml rendering is done as part of show (normal page viewing) and done on a "GET". save forwards to show.



2) I have a syntax plugin, and I want to write some data into a database. From looking at several similar plugins, most notably the data plugin, it seems that they write their data to the database inside the render() function when the format 'metadata' is specified.

render() is a reasonable place, especially if you think of your plugin as needing to render the data to a database. If your data only changes whenever the wiki page changes, you can use handle().



3) So, are they are disadvantages to simply writing the data to the database after render() is called for 'xhtml' pages? I can't think of any problems off the top of my head, but I am relatively new to dokuwiki, so...


How long is a piece of string?
We don't know the cost of writing data to the database or "why" you are writing data to the database, not why per se, but why now rather than why some other time.

- Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: