Documentation

Logging
in package

This class concerns itself with logging and tracking statistics.

Honestly, this is just a collection of a few static methods. They're only grouped into a class to take better advantage of namespacing and autoloading.

Table of Contents

Methods

displayDebug()  : void
Shows the debug information tracked when Config::$db_show_debug = true.
getMembersOnlineStats()  : array<string|int, mixed>
Retrieve a list and several other statistics of the users currently online.
logAction()  : int
This function logs an action to the database. It is a thin wrapper around Logging::logActions().
logActions()  : int
Log changes to the forum, such as moderation events or administrative changes.
trackStats()  : bool
Track Statistics.
trackStatsUsersOnline()  : void
Check if the number of users online is a record and store it.
updateStats()  : void
Update some basic statistics.

Methods

displayDebug()

Shows the debug information tracked when Config::$db_show_debug = true.

public static displayDebug() : void

getMembersOnlineStats()

Retrieve a list and several other statistics of the users currently online.

public static getMembersOnlineStats(array<string|int, mixed> $membersOnlineOptions) : array<string|int, mixed>

Used by the board index and SSI. Also returns the membergroups of the users that are currently online. (optionally) hides members that chose to hide their online presence.

Parameters
$membersOnlineOptions : array<string|int, mixed>

An array of options for the list

Return values
array<string|int, mixed>

An array of information about the online users

logAction()

This function logs an action to the database. It is a thin wrapper around Logging::logActions().

public static logAction(string $action[, array<string|int, mixed> $extra = [] ][, string $log_type = 'moderate' ]) : int
Parameters
$action : string

A code for the report; a list of such strings can be found in Modlog.{language}.php (modlog_ac_ strings)

$extra : array<string|int, mixed> = []

An associated array of parameters for the item being logged. Typically this will include 'topic' for the topic's id.

$log_type : string = 'moderate'

A string reflecting the type of log.

Tags
example

Logging::logAction('remove', array('starter' => $id_member_started));

Return values
int

The ID of the row containing the logged data

logActions()

Log changes to the forum, such as moderation events or administrative changes.

public static logActions(array<string|int, mixed> $logs) : int

SMF uses three log types:

  • user for actions executed that aren't related to moderation (e.g. signature or other changes from the profile);
  • moderate for moderation actions (e.g. topic changes);
  • admin for administrative actions.
Parameters
$logs : array<string|int, mixed>

An array of log data

Return values
int

The last logged ID.

trackStats()

Track Statistics.

public static trackStats([array<string|int, mixed> $stats = [] ]) : bool

Caches statistics changes, and flushes them if you pass nothing. If '+' is used as a value, it will be incremented. It does not actually commit the changes until the end of the page view. It depends on the trackStats setting.

Parameters
$stats : array<string|int, mixed> = []

An array of data

Return values
bool

Whether or not the info was updated successfully

trackStatsUsersOnline()

Check if the number of users online is a record and store it.

public static trackStatsUsersOnline(int $total_users_online) : void
Parameters
$total_users_online : int

The total number of members online

updateStats()

Update some basic statistics.

public static updateStats(string $type[, mixed $parameter1 = null ][, mixed $parameter2 = null ]) : void

'member' statistic updates the latest member, the total member count, and the number of unapproved members. 'member' also only counts approved members when approval is on, but is much more efficient with it off.

'message' changes the total number of messages, and the highest message id by id_msg - which can be parameters 1 and 2, respectively.

'topic' updates the total number of topics, or if parameter1 is true simply increments them.

'subject' updates the log_search_subjects in the event of a topic being moved, removed or split. parameter1 is the topicid, parameter2 is the new subject

'postgroups' case updates those members who match condition's post-based membergroups in the database (restricted by parameter1).

Parameters
$type : string

Stat type - can be 'member', 'message', 'topic', 'subject' or 'postgroups'

$parameter1 : mixed = null

A parameter for updating the stats

$parameter2 : mixed = null

A 2nd parameter for updating the stats


        
On this page

Search results