Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/eventslib.php File Reference

Go to the source code of this file.

Namespaces

namespace  core

Functions

 events_load_def ($component)
 events_get_cached ($component)
 events_update_definition ($component='moodle')
 events_uninstall ($component)
 events_cleanup ($component, $cachedhandlers)
 events_queue_handler ($handler, $event, $errormessage)
 events_dispatch ($handler, $eventdata, &$errormessage)
 events_process_queued_handler ($qhandler)
 events_dequeue ($qhandler)
 events_get_handlers ($eventname)
 events_cron ($eventname='')
 events_trigger ($eventname, $eventdata)
 events_is_registered ($eventname, $component)
 events_pending_count ($eventname)

Function Documentation

events_cleanup ( component,
cachedhandlers 
)

Deletes cached events that are no longer needed by the component.

INTERNAL - to be used from eventslib only

Parameters:
string$componentexamples: 'moodle', 'mod_forum', 'block_quiz_results'
array$cachedhandlersarray of the cached events definitions that will be
Returns:
int number of unused handlers that have been removed

Definition at line 215 of file eventslib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

events_cron ( eventname = '')

Events cron will try to empty the events queue by processing all the queued events handlers

PUBLIC

Parameters:
string$eventnameempty means all
Returns:
number of dispatched events

Definition at line 423 of file eventslib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

events_dequeue ( qhandler)

Removes this queued handler from the events_queued_handler table

Removes events_queue record from events_queue if no more references to this event object exists

INTERNAL - to be used from eventslib only

Parameters:
object$qhandlerevents_queued_handler object from db

Definition at line 375 of file eventslib.php.

Here is the caller graph for this function:

events_dispatch ( handler,
eventdata,
&$  errormessage 
)

trigger a single event with a specified handler

INTERNAL - to be used from eventslib only

Parameters:
handler$handerobject from db
eventdata$eventdatadataobject
string$errormessageerror message indicating problem
Returns:
bool true means event processed, false means retry event later; may throw exception, NULL means internal error

Definition at line 278 of file eventslib.php.

Here is the caller graph for this function:

events_get_cached ( component)

Gets the capabilities that have been cached in the database for this component.

INTERNAL - to be used from eventslib only

Parameters:
string$componentexamples: 'moodle', 'mod_forum', 'block_quiz_results'
Returns:
array of events

Definition at line 102 of file eventslib.php.

Here is the caller graph for this function:

events_get_handlers ( eventname)

Returns handlers for given event. Uses caching for better perf.

INTERNAL - to be used from eventslib only

array $handlers

Parameters:
string$eventanmename of even or 'reset'
Returns:
mixed array of handlers or false otherwise

Definition at line 396 of file eventslib.php.

Here is the caller graph for this function:

events_is_registered ( eventname,
component 
)

checks if an event is registered for this component

Parameters:
string$eventnamename of the event
string$componentcomponent name, can be mod/data or moodle
Returns:
bool

Definition at line 593 of file eventslib.php.

Here is the caller graph for this function:

events_load_def ( component)

Loads the events definitions for the component (from file). If no events are defined for the component, we simply return an empty array.

INTERNAL - to be used from eventslib only

Parameters:
string$componentexamples: 'moodle', 'mod_forum', 'block_quiz_results'
Returns:
array of capabilities or empty array if not exists

Definition at line 40 of file eventslib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

events_pending_count ( eventname)

checks if an event is queued for processing - either cron handlers attached or failed instant handlers

PUBLIC

Parameters:
string$eventnamename of the event
Returns:
int number of queued events

Definition at line 606 of file eventslib.php.

Here is the caller graph for this function:

given a queued handler, call the respective event handler to process the event

INTERNAL - to be used from eventslib only

Parameters:
object$qhandlerevents_queued_handler object from db
Returns:
boolean true means event processed, false means retry later, NULL means fatal failure

Definition at line 317 of file eventslib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

events_queue_handler ( handler,
event,
errormessage 
)

puts a handler on queue

INTERNAL - to be used from eventslib only

Parameters:
object$handlerevent handler object from db
object$eventevent data object
string$errormessageThe error message indicating the problem
Returns:
id number of new queue handler

Definition at line 245 of file eventslib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

events_trigger ( eventname,
eventdata 
)

Function to call all event handlers when triggering an event

PUBLIC

Parameters:
string$eventnamename of the event
object$eventdataevent data object
Returns:
int number of failed events

Definition at line 486 of file eventslib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

events_uninstall ( component)

Remove all event handlers and queued events

Parameters:
string$componentexamples: 'moodle', 'mod_forum', 'block_quiz_results'

Definition at line 199 of file eventslib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

events_update_definition ( component = 'moodle')

We can not removed all event handlers in table, then add them again because event handlers could be referenced by queued items

Note that the absence of the db/events.php event definition file will cause any queued events for the component to be removed from the database.

Parameters:
string$componentexamples: 'moodle', 'mod_forum', 'block_quiz_results'
Returns:
boolean always returns true

Definition at line 132 of file eventslib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations