[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/ -> eventslib.php (summary)

Library of functions for events manipulation. The public API is all at the end of this file.

Copyright: 1999 onwards Martin Dougiamas {@link http://moodle.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 617 lines (23 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 14 functions

  events_load_def()
  events_get_cached()
  events_update_definition()
  events_uninstall()
  events_cleanup()
  events_queue_handler()
  events_dispatch()
  events_process_queued_handler()
  events_dequeue()
  events_get_handlers()
  events_cron()
  events_trigger_legacy()
  events_is_registered()
  events_pending_count()

Functions
Functions that are not part of a class:

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

param: string $component examples: 'moodle', 'mod_forum', 'block_quiz_results'
return: array Array of capabilities or empty array if not exists

events_get_cached($component)   X-Ref
Gets the capabilities that have been cached in the database for this
component.

param: string $component examples: 'moodle', 'mod_forum', 'block_quiz_results'
return: array of events

events_update_definition($component='moodle')   X-Ref
Updates all of the event definitions within the database.

Unfortunately this isn't as simple as removing them all and then readding
the updated event definitions. Chances are queued items are referencing the
existing definitions.

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.

param: string $component examples: 'moodle', 'mod_forum', 'block_quiz_results'
return: boolean always returns true

events_uninstall($component)   X-Ref
Remove all event handlers and queued events

param: string $component examples: 'moodle', 'mod_forum', 'block_quiz_results'

events_cleanup($component, $cachedhandlers)   X-Ref
Deletes cached events that are no longer needed by the component.

param: string $component examples: 'moodle', 'mod_forum', 'block_quiz_results'
param: array $cachedhandlers array of the cached events definitions that will be
return: int number of unused handlers that have been removed

events_queue_handler($handler, $event, $errormessage)   X-Ref
Puts a handler on queue

param: stdClass $handler event handler object from db
param: stdClass $event event data object
param: string $errormessage The error message indicating the problem
return: int id number of new queue handler

events_dispatch($handler, $eventdata, &$errormessage)   X-Ref
trigger a single event with a specified handler

param: stdClass $handler This shoudl be a row from the events_handlers table.
param: stdClass $eventdata An object containing information about the event
param: string $errormessage error message indicating problem
return: bool|null True means event processed, false means retry event later; may throw exception, NULL means internal error

events_process_queued_handler($qhandler)   X-Ref
given a queued handler, call the respective event handler to process the event

param: stdClass $qhandler events_queued_handler row from db
return: boolean true means event processed, false means retry later, NULL means fatal failure

events_dequeue($qhandler)   X-Ref
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

param: stdClass $qhandler A row from the events_queued_handler table

events_get_handlers($eventname)   X-Ref
Returns handlers for given event. Uses caching for better perf.

param: string $eventname name of event or 'reset'
return: array|false array of handlers or false otherwise

events_cron($eventname='')   X-Ref
Events cron will try to empty the events queue by processing all the queued events handlers

param: string $eventname empty means all
return: int number of dispatched events

events_trigger_legacy($eventname, $eventdata)   X-Ref
Do not call directly, this is intended to be used from new event base only.

param: string $eventname name of the event
param: mixed $eventdata event data object
return: int number of failed events

events_is_registered($eventname, $component)   X-Ref
checks if an event is registered for this component

param: string $eventname name of the event
param: string $component component name, can be mod/data or moodle
return: bool

events_pending_count($eventname)   X-Ref
checks if an event is queued for processing - either cron handlers attached or failed instant handlers

param: string $eventname name of the event
return: int number of queued events



Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1