Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Public Attributes | Static Protected Member Functions | Static Protected Attributes | List of all members
logstore_legacy\log\store Class Reference
Inheritance diagram for logstore_legacy\log\store:
tool_log\log\store core\log\sql_reader core\log\reader

Public Member Functions

 __construct (\tool_log\log\manager $manager)
 
 dispose ()
 
 get_description ()
 Longer description of the log data source. More...
 
 get_events_select ($selectwhere, array $params, $sort, $limitfrom, $limitnum)
 
 get_events_select_count ($selectwhere, array $params)
 
 get_events_select_iterator ($selectwhere, array $params, $sort, $limitfrom, $limitnum)
 Fetch records using given criteria returning a Traversable object. More...
 
 get_log_event ($data)
 Returns an event from the log data. More...
 
 get_name ()
 Localised name of the reader. More...
 
 is_logging ()
 Are the new events appearing in the reader? More...
 
 legacy_add_to_log ($courseid, $module, $action, $url, $info, $cm, $user, $ip=null, $time=null)
 Legacy add_to_log() code. More...
 

Public Attributes

string const CRUD_REGEX = "/(crud).*?(<>|=|!=).*?'(.*?)'/s"
 Regex to replace the crud params.
 

Static Protected Member Functions

static replace_crud ($match)
 Generate a replace string for crud related sql conditions. More...
 
static replace_sql_legacy ($selectwhere, array $params, $sort='')
 This method contains mapping required for Moodle core to make legacy store compatible with other sql_reader based queries. More...
 

Static Protected Attributes

static array $standardtolegacyfields
 list of db fields which needs to be replaced for legacy log query More...
 

Constructor & Destructor Documentation

◆ __construct()

logstore_legacy\log\store::__construct ( \tool_log\log\manager  $manager)
Deprecated:
since Moodle 3.6 MDL-52953 - Please use supported log stores such as "standard" or "external" instead.
Todo:
MDL-52805 This is to be removed in Moodle 4.0
Parameters
tool_log::log::manager$manager

Member Function Documentation

◆ dispose()

logstore_legacy\log\store::dispose ( )
Deprecated:
since Moodle 3.6 MDL-52953 - Please use supported log stores such as "standard" or "external" instead.
Todo:
MDL-52805 This will be removed in Moodle 4.0

Implements tool_log\log\store.

◆ get_description()

core\log\reader::get_description ( )
inherited

Longer description of the log data source.

Return values
string

◆ get_events_select()

logstore_legacy\log\store::get_events_select (   $selectwhere,
array  $params,
  $sort,
  $limitfrom,
  $limitnum 
)
Deprecated:
since Moodle 3.6 MDL-52953 - Please use supported log stores such as "standard" or "external" instead.
Todo:
MDL-52805 This will be removed in Moodle 4.0
Parameters
string$selectwhere
array$params
string$sort
int$limitfrom
int$limitnum
Return values
array

Implements core\log\sql_reader.

◆ get_events_select_count()

logstore_legacy\log\store::get_events_select_count (   $selectwhere,
array  $params 
)
Deprecated:
since Moodle 3.6 MDL-52953 - Please use supported log stores such as "standard" or "external" instead.
Todo:
MDL-52805 This will be removed in Moodle 4.0
Parameters
string$selectwhere
array$params
Return values
int

Implements core\log\sql_reader.

◆ get_events_select_iterator()

logstore_legacy\log\store::get_events_select_iterator (   $selectwhere,
array  $params,
  $sort,
  $limitfrom,
  $limitnum 
)

Fetch records using given criteria returning a Traversable object.

Deprecated:
since Moodle 3.6 MDL-52953 - Please use supported log stores such as "standard" or "external" instead.
Todo:
MDL-52805 This will be removed in Moodle 4.0

Note that the traversable object contains a moodle_recordset, so remember that is important that you call close() once you finish using it.

Parameters
string$selectwhere
array$params
string$sort
int$limitfrom
int$limitnum
Return values
Traversable|core::event::base[]

Implements core\log\sql_reader.

◆ get_log_event()

logstore_legacy\log\store::get_log_event (   $data)

Returns an event from the log data.

Deprecated:
since Moodle 3.6 MDL-52953 - Please use supported log stores such as "standard" or "external" instead.
Todo:
MDL-52805 This will be removed in Moodle 4.0
Parameters
stdClass$dataLog data
Return values
core::event::base

Implements core\log\sql_reader.

◆ get_name()

core\log\reader::get_name ( )
inherited

Localised name of the reader.

To be used in selection for in reports.

Return values
string

◆ is_logging()

logstore_legacy\log\store::is_logging ( )

Are the new events appearing in the reader?

Deprecated:
since Moodle 3.6 MDL-52953 - Please use supported log stores such as "standard" or "external" instead.
Todo:
MDL-52805 This will be removed in Moodle 4.0
Return values
booltrue means new log events are being added, false means no new data will be added

Implements core\log\reader.

◆ legacy_add_to_log()

logstore_legacy\log\store::legacy_add_to_log (   $courseid,
  $module,
  $action,
  $url,
  $info,
  $cm,
  $user,
  $ip = null,
  $time = null 
)

Legacy add_to_log() code.

Deprecated:
since Moodle 3.1 MDL-45104 - Please use supported log stores such as "standard" or "external" instead.
Todo:
MDL-52805 This will be removed in Moodle 3.3
Parameters
int$courseidThe course id
string$moduleThe module name e.g. forum, journal, resource, course, user etc
string$action'view', 'update', 'add' or 'delete', possibly followed by another word to clarify.
string$urlThe file and parameters used to see the results of the action
string$infoAdditional description information
int$cmThe course_module->id if there is one
int | stdClass$userIf log regards $user other than $USER
string$ipOverride the IP, should only be used for restore.
int$timeOverride the log time, should only be used for restore.

◆ replace_crud()

static logstore_legacy\log\store::replace_crud (   $match)
staticprotected

Generate a replace string for crud related sql conditions.

This function is called as callback to preg_replace_callback() on the actual sql.

Parameters
array$matchmatched string for the passed pattern
Return values
stringThe sql string to use instead of original

◆ replace_sql_legacy()

static logstore_legacy\log\store::replace_sql_legacy (   $selectwhere,
array  $params,
  $sort = '' 
)
staticprotected

This method contains mapping required for Moodle core to make legacy store compatible with other sql_reader based queries.

Parameters
string$selectwhereSelect statment
array$paramsparams for the sql
string$sortsort fields
Return values
arrayreturns an array containing the sql predicate, an array of params and sorting parameter.

Member Data Documentation

◆ $standardtolegacyfields

array logstore_legacy\log\store::$standardtolegacyfields
staticprotected
Initial value:
= array(
'timecreated' => 'time',
'courseid' => 'course',
'contextinstanceid' => 'cmid',
'origin' => 'ip',
'anonymous' => 0,
)

list of db fields which needs to be replaced for legacy log query


The documentation for this class was generated from the following file: