Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
tool_log

Namespaces

namespace  tool_log\helper
  
 
namespace  tool_log\local\privacy
  
 
namespace  tool_log\log
  
 
namespace  tool_log\plugininfo
  
 
namespace  tool_log\privacy
  
 

Classes

class  backup_tool_log_logstore_subplugin
 Parent class of all the logstore subplugin implementations. More...
 
class  restore_tool_log_logstore_subplugin
 Parent class of all the logstore subplugin implementations. More...
 
class  tool_log\local\privacy\helper
 Privacy helper class. More...
 
interface  tool_log\local\privacy\logstore_provider
 Logstore provider interface. More...
 
interface  tool_log\local\privacy\logstore_userlist_provider
 Logstore userlist provider interface. More...
 
class  tool_log\log\manager
 
class  tool_log\log\observer
 
interface  tool_log\log\store
 
interface  tool_log\log\writer
 
class  tool_log\plugininfo\logstore
 Plugin info class for logging store plugins. More...
 
class  tool_log\privacy\provider
 Data provider class. More...
 
class  tool_log_setting_managestores
 

Functions

static tool_log\helper::decode_other (?string $other)
 Function decodes the other field into an array using either PHP serialisation or JSON.
 
 tool_log\helper::dispose ()
 Push any remaining events to the database.
 
 tool_log\helper::flush ()
 Flush event buffer.
 
 tool_log\helper::get_config ($name, $default=null)
 Get a config value for the store.
 
 tool_log\helper::get_description ()
 Default get description method.
 
 tool_log\helper::get_name ()
 Default get name api.
 
 tool_log\helper::helper_setup (\tool_log\log\manager $manager)
 Setup store specific variables.
 
 tool_log\helper::insert_event_entries ($evententries)
 Bulk write a given array of events to the backend.
 
 tool_log\helper::is_event_ignored (\core\event\base $event)
 Should the event be ignored (== not logged)?
 
static tool_log\helper::tweak_sort_by_id ($sort)
 Adds ID column to $sort to make sure events from one request within 1 second are returned in the same order.
 
 tool_log\helper::write (\core\event\base $event)
 Write event in the store with buffering.
 
 xmldb_tool_log_install ()
 Install the plugin.
 
 xmldb_tool_log_upgrade ($oldversion)
 Upgrade the plugin.
 

Variables

array tool_log\helper::$buffersize
 $buffer buffer size of events.
 
string tool_log\helper::$component
 $component Frankenstyle store name.
 
int tool_log\helper::$count = 0
 $count Counter.
 
bool tool_log\helper::$jsonformat = false
 If true, writes JSON instead of PHP serialized data for 'other' field.
 
 $observers
 
 $plugin = 2024041600
 
string tool_log\helper::$store
 short plugin name initialised in store trait.
 
trait tool_log\helper::buffered_writer
 Helper trait buffered_writer.
 
$plugin component = 'tool_log'
 
trait tool_log\helper::reader
 
trait tool_log\helper::store
 Helper trait store.
 
$plugin version = 2024042200
 

Detailed Description

Function Documentation

◆ decode_other()

static tool_log\helper\decode_other ( ?string $other)
static

Function decodes the other field into an array using either PHP serialisation or JSON.

Note that this does not rely on the config setting, it supports both formats, so you can use it for data before/after making a change to the config setting.

The return value is usually an array but it can also be null or a boolean or something.

Parameters
string$otherOther value
Return values
mixedDecoded value

◆ dispose()

tool_log\helper\dispose ( )

Push any remaining events to the database.

Insert_events() must be defined. override in stores if the store doesn't support buffering.

◆ get_config()

tool_log::helper::get_config ( $name,
$default = null )
abstractprotected

Get a config value for the store.

Api to get plugin config.

Parameters
string$nameConfig name
mixed$defaultdefault value
Return values
mixedconfig value if set, else the default value.
Parameters
string$namename of the config.
null | mixed$defaultdefault value to return.
Return values
mixed|nullreturn config value.

◆ get_description()

tool_log\helper\get_description ( )

Default get description method.

Return values
stringdescription of the store.

◆ get_name()

tool_log\helper\get_name ( )

Default get name api.

Return values
stringname of the store.

◆ helper_setup()

tool_log\helper\helper_setup ( \tool_log\log\manager $manager)
protected

Setup store specific variables.

Parameters
tool_log\log\manager$managermanager instance.

◆ insert_event_entries()

tool_log\helper\insert_event_entries ( $evententries)
abstractprotected

Bulk write a given array of events to the backend.

Stores must implement this.

Parameters
array$evententriesraw event data

◆ is_event_ignored()

tool_log\helper\is_event_ignored ( \core\event\base $event)
abstractprotected

Should the event be ignored (== not logged)?

Parameters
core\event\base$event
Return values
bool

◆ tweak_sort_by_id()

static tool_log\helper\tweak_sort_by_id ( $sort)
staticprotected

Adds ID column to $sort to make sure events from one request within 1 second are returned in the same order.

Parameters
string$sort
Return values
stringsort string

◆ write()

tool_log\helper\write ( \core\event\base $event)

Write event in the store with buffering.

Method insert_event_entries() must be defined.

Parameters
core\event\base$event
Return values
void

◆ xmldb_tool_log_upgrade()

xmldb_tool_log_upgrade ( $oldversion)

Upgrade the plugin.

Parameters
int$oldversion
Return values
boolalways true

Variable Documentation

◆ $observers

$observers
Initial value:
= array(
array(
'eventname' => '*',
'callback' => '\tool_log\log\observer::store',
'internal' => false,
'priority' => 1000,
),
)

◆ $store

string tool_log::helper::$store
protected

short plugin name initialised in store trait.

$store name of the store.

◆ buffered_writer

trait tool_log::helper\buffered_writer
Initial value:
{
protected array $buffer = array()

Helper trait buffered_writer.

Adds buffer support for the store.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

◆ reader

trait tool_log::helper\reader
Initial value:
{
protected string $component
string $component
$component Frankenstyle store name.
Definition store.php:41

◆ store

trait tool_log::helper\store
Initial value:
{
protected tool_log\log\manager $manager
Definition manager.php:29

Helper trait store.

Adds some helper methods for stores.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later