Re: Event Handling System

Besfred <[email protected]> Wed, 16 Jul 2003 01:54:39 +0200
Newsgroups gmane.comp.cms.xaraya.knowledge-base
Organization Xaraya News Server
Message-ID <[email protected]>
On Tue, 15 Jul 2003 13:30:39 +0100 Sean Brook wrote:

> I have the following questions regarding the Event Handling System:

Aha :) I understand that these questions should have been answered more
explicitly in the Events RFC #41
(http://docs.xaraya.com/docs/rfcs/rfc0041.html) , and the questions are in
there. I just haven't been slapped around enough to answer them :)

> 1) What events can be triggered and what do they do?

Currently there are the events
- ServerRequest: Triggers the corresponding module event handlers on each
                 page view (example: stats module)
- SessionCreate: Triggers the corresponding module event handlers on each
                 creation of a new session (example: sniffer module)
- ModLoad      : Notifys when a modules function is being loaded
- ModAPILoad   : Notifys when a modules api function is being loaded

the latter 2 are being object to review.

> 2) In what order are the 'top level' events triggered? For example, I know
> that there are 'ServerRequest' and 'OnSessionCreate' events - I would assume
> that ServerRequest events happen before OnSessionCreate events.

In order of the trigger calls. Normally like follows:
- SessionCreate (when no session is there yet)
. ServerRequest

> 3) For a particular event eg. OnSessionCreate, in what order are
> OnSessionCreate events triggered. For example, I have module foo and module
> bar, both with OnSessionCreate events. Is foo triggered before bar, or bar
> before foo?
> - Is there any mechanism to influence this ordering?

In alphabetical order of the active modules that implement the
corresponding event handler. Influencing the ording has not been a
requirement yet, but if it is for you, please create a detailed feature
request on bugs.xaraya.com and we will see whether it is feasible and in
which release we can put the implementation.

> 4) I know that when a OnSessionCreate event is triggered it will happen
> before part/all(?) of the Xaraya API is loaded. For example, I know that
> XarModAPIFunc is not available at that point. What part of the Xaraya API is
> available?

According to the /html/includes/xarCore.php file (which had to be
reordered for the event system earlier on) before the event system only
the following systems are available:
- Exceptions
- Logger
- Database
 
> Cheers for any answers.

now i gotta get this info into the rfc...
thanks for the slap. :)

regards, besfred.