/** * 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 */ public static function process_event(\core\event\base $event) { if (empty(self::$instance)) { self::$instance = new static(); // Register shutdown handler - this is useful for buffering, processing events, etc. \core_shutdown_manager::register_function(array(self::$instance, 'process_buffer')); } self::$instance->buffer_event($event); if (PHPUNIT_TEST) { // Process buffer after every event when unit testing. self::$instance->process_buffer(); } }
/** * 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 */ public static function process_event(\core\event\base $event) { if (!get_config('tool_monitor', 'enablemonitor')) { return; // The tool is disabled. Nothing to do. } if (empty(self::$instance)) { self::$instance = new static(); // Register shutdown handler - this is useful for buffering, processing events, etc. \core_shutdown_manager::register_function(array(self::$instance, 'process_buffer')); } self::$instance->buffer_event($event); if (PHPUNIT_TEST) { // Process buffer after every event when unit testing. self::$instance->process_buffer(); } }