Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Observer class containing methods monitoring various events.

Copyright: 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 260 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

eventobservers:: (7 methods):
  course_deleted()
  process_event()
  buffer_event()
  process_buffer()
  flush()
  user_deleted()
  course_module_deleted()


Class: eventobservers  - X-Ref

Observer class containing methods monitoring various events.

course_deleted(\core\event\course_deleted $event)   X-Ref
Course delete event observer.
This observer monitors course delete event, and when a course is deleted it deletes any rules and subscriptions associated
with it, so no orphan data is left behind.

param: \core\event\course_deleted $event The course deleted event.

process_event(\core\event\base $event)   X-Ref
The observer monitoring all the events.

This observers puts small event objects in buffer for later writing to the database. At the end of the request the buffer
is cleaned up and all data dumped into the tool_monitor_events table.

param: \core\event\base $event event object

buffer_event(\core\event\base $event)   X-Ref
Api to buffer events to store, to reduce db queries.

param: \core\event\base $event

process_buffer()   X-Ref
This method process all events stored in the buffer.

This is a multi purpose api. It does the following:-
1. Write event data to tool_monitor_events
2. Find out users that need to be notified about rule completion and schedule a task to send them messages.

flush()   X-Ref
Protected method that flushes the buffer of events and writes them to the database.

return: array a copy of the events buffer.

user_deleted(\core\event\user_deleted $event)   X-Ref
Observer that monitors user deleted event and delete user subscriptions.

param: \core\event\user_deleted $event the event object.

course_module_deleted(\core\event\course_module_deleted $event)   X-Ref
Observer that monitors course module deleted event and delete user subscriptions.

param: \core\event\course_module_deleted $event the event object.