[dokuwiki] Re: events system patch

Andreas Gohr wrote:
As I understand it, an event usually wraps itself around a certain function in DokuWiki. Before this function is called the BEFORE event is signalled, after this function was called the AFTER event is signalled.

There is not a single function which does ALL the DokuWiki stuff where an DOKUWIKI event could wrap around. Instead simply two "pseudo events" are signalled which wrap them self around nothing, one at the start and one at the end of the doku.php script. This means the BEFORE and the AFTER event are virtually the same.

Chris named those "wrap-around-nothing-events" advise events before, I'm not sure if we still use this naming.

I hope this clears up why there can't be a single DOKUWIKI_(BEFORE|AFTER) event.

I hope I got it explained right - I havent looked too deep into the code for the last few days.

Andi
Yes, that's right. Its also the reason I'd like to organise things so you can register simply for DOKUWIKI_STARTED and the events system will manage things to ensure you receive the BEFORE signal.

Alternatively a "block" could be created between STARTED & DONE and one event used. My instinct is against that. STARTED doesn't really match with DONE. STARTED means Dokuwiki has completed its setup, rather than this is the start of Dokuwiki.

---
(Addressing issues in Martin's earlier note)

Maybe there is a case for a template event -- ACTION_TEMPLATE_INCLUDE which gets passed the template name (or file name) with a default action of including the template. An action plugin for such an event could enable the use of multiple templates within one wiki as some people have requested. However, I've always felt that was the domain of the template rather than a plugin.

As I mentioned in one of the earlier posts on the events system, developers will need to make requests for events to be added. I am reluctant to walkthru dokuwiki and invent or propose events whenever anything happens. That could make the system "heavy" with little added benefit. I understand its not going to be easy for anyone to just think up a worthwhile event, but if you want to do something explain what it is and maybe an event can be added to enable that - sort of like what happened here.

The only additional event I am actively thinking about right now is a complement to TPL_ACT_UNKNOWN within the action processing step. That way adding a do command doesn't require completely taking over the action processing function. e.g. ACTION_ACT_UNKNOWN, which would be fired during Dokuwiki's sanitisation of the ACT value when dokuwiki decides it has an unknown value and before it changes that unknown value to "show".

Cheers

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

Other related posts: