MediaWiki master
MediaWiki\Logging\DatabaseLogEntry Class Reference

A value class to process existing log entries. More...

Inherits MediaWiki\Logging\LogEntryBase.

Inherited by MediaWiki\Logging\RCDatabaseLogEntry.

Collaboration diagram for MediaWiki\Logging\DatabaseLogEntry:

Public Member Functions

 getAssociatedRevId ()
 
 getComment ()
 Get the user provided comment.
Returns
string

 
 getDeleted ()
 Get the access restriction.
Returns
int

 
 getId ()
 Returns the unique database id.
 
 getParameters ()
 Get the extra parameters stored for this message.This will be in the same format as setParameters(), ie. the array keys might include message formatting prefixes.
Returns
array
See also
ManualLogEntry::setParameters() for message formatting prefixes.

 
 getPerformerIdentity ()
 
Since
1.36
Returns
UserIdentity

 
 getSubtype ()
 The log subtype.
Returns
string

 
 getTarget ()
 Get the target page of this action.
Returns
Title

 
 getTargetPage ()
 Get the target page of this action.
 
 getTimestamp ()
 Get the timestamp when the action was executed.
Returns
string TS::MW timestamp, a string with 14 digits

 
 getType ()
 The main log type.
Returns
string

 
 isLegacy ()
 Whether the parameters for this log are stored in new or old format.
 
- Public Member Functions inherited from MediaWiki\Logging\LogEntryBase
 getFullType ()
 The full logtype in format maintype/subtype.
Returns
string

 
 isDeleted ( $field)
 
Parameters
int$fieldOne of LogPage::DELETED_* bitfield constants
Returns
bool

 

Static Public Member Functions

static getSelectQueryData ()
 Returns array of information that is needed for querying log entries.
 
static newFromId ( $id, IReadableDatabase $db)
 Loads a LogEntry with the given id from database.
 
static newFromRow ( $row, string|false $wikiId=WikiAwareEntity::LOCAL)
 Constructs new LogEntry from database result row.
 
static newSelectQueryBuilder (IReadableDatabase $db)
 
- Static Public Member Functions inherited from MediaWiki\Logging\LogEntryBase
static extractParams ( $blob)
 Extract a parameter array from a blob.
 
static makeParamBlob ( $params)
 Create a blob from a parameter array.
 

Protected Member Functions

 __construct ( $row, protected string|false $wikiId=false)
 
 getRawParameters ()
 Returns whatever is stored in the database field (typically a serialized associative array but very old entries might have different formats).
 

Protected Attributes

bool $legacy
 Whether the parameters for this log entry are stored in new or old format.
 
array null $params
 Parameters for log entry.
 
UserIdentity $performer
 
int $revId = null
 A rev id associated to the log entry.
 
stdClass $row
 Database result row.
 

Detailed Description

A value class to process existing log entries.

In other words, this class caches a log entry from the database and provides an immutable object-oriented representation of it.

This class should only be used in context of the LogFormatter class.

Since
1.19

Definition at line 34 of file DatabaseLogEntry.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Logging\DatabaseLogEntry::__construct ( $row,
protected string|false $wikiId = false )
protected
Parameters
stdClass$row
string | false$wikiIdWiki from which this row was loaded

Definition at line 143 of file DatabaseLogEntry.php.

Member Function Documentation

◆ getAssociatedRevId()

MediaWiki\Logging\DatabaseLogEntry::getAssociatedRevId ( )

Reimplemented in MediaWiki\Logging\RCDatabaseLogEntry.

Definition at line 207 of file DatabaseLogEntry.php.

◆ getComment()

MediaWiki\Logging\DatabaseLogEntry::getComment ( )

Get the user provided comment.

Returns
string

Implements MediaWiki\Logging\LogEntry.

Reimplemented in MediaWiki\Logging\RCDatabaseLogEntry.

Definition at line 255 of file DatabaseLogEntry.php.

◆ getDeleted()

MediaWiki\Logging\DatabaseLogEntry::getDeleted ( )

Get the access restriction.

Returns
int

Implements MediaWiki\Logging\LogEntry.

Reimplemented in MediaWiki\Logging\RCDatabaseLogEntry.

Definition at line 261 of file DatabaseLogEntry.php.

◆ getId()

MediaWiki\Logging\DatabaseLogEntry::getId ( )

Returns the unique database id.

Returns
int

Reimplemented in MediaWiki\Logging\RCDatabaseLogEntry.

Definition at line 152 of file DatabaseLogEntry.php.

◆ getParameters()

MediaWiki\Logging\DatabaseLogEntry::getParameters ( )

Get the extra parameters stored for this message.This will be in the same format as setParameters(), ie. the array keys might include message formatting prefixes.

Returns
array
See also
ManualLogEntry::setParameters() for message formatting prefixes.

Implements MediaWiki\Logging\LogEntry.

Definition at line 184 of file DatabaseLogEntry.php.

◆ getPerformerIdentity()

MediaWiki\Logging\DatabaseLogEntry::getPerformerIdentity ( )

Since
1.36
Returns
UserIdentity

Implements MediaWiki\Logging\LogEntry.

Reimplemented in MediaWiki\Logging\RCDatabaseLogEntry.

Definition at line 214 of file DatabaseLogEntry.php.

◆ getRawParameters()

MediaWiki\Logging\DatabaseLogEntry::getRawParameters ( )
protected

Returns whatever is stored in the database field (typically a serialized associative array but very old entries might have different formats).

Returns
string

Reimplemented in MediaWiki\Logging\RCDatabaseLogEntry.

Definition at line 162 of file DatabaseLogEntry.php.

◆ getSelectQueryData()

static MediaWiki\Logging\DatabaseLogEntry::getSelectQueryData ( )
static

Returns array of information that is needed for querying log entries.

Array contains the following keys: tables, fields, conds, options and join_conds

Since 1.34, log_user and log_user_text have not been present in the database, but they continue to be available in query results as aliases.

Deprecated
since 1.41 use ::newSelectQueryBuilder() instead
Returns
array

Reimplemented in MediaWiki\Logging\RCDatabaseLogEntry.

Definition at line 49 of file DatabaseLogEntry.php.

References MediaWiki\MediaWikiServices\getInstance().

◆ getSubtype()

MediaWiki\Logging\DatabaseLogEntry::getSubtype ( )

The log subtype.

Returns
string

Implements MediaWiki\Logging\LogEntry.

Reimplemented in MediaWiki\Logging\RCDatabaseLogEntry.

Definition at line 179 of file DatabaseLogEntry.php.

◆ getTarget()

MediaWiki\Logging\DatabaseLogEntry::getTarget ( )

Get the target page of this action.

Returns
Title

Implements MediaWiki\Logging\LogEntry.

Reimplemented in MediaWiki\Logging\RCDatabaseLogEntry.

Definition at line 237 of file DatabaseLogEntry.php.

◆ getTargetPage()

MediaWiki\Logging\DatabaseLogEntry::getTargetPage ( )

Get the target page of this action.

Since
1.46

Implements MediaWiki\Logging\LogEntry.

Reimplemented in MediaWiki\Logging\RCDatabaseLogEntry.

Definition at line 243 of file DatabaseLogEntry.php.

◆ getTimestamp()

MediaWiki\Logging\DatabaseLogEntry::getTimestamp ( )

Get the timestamp when the action was executed.

Returns
string TS::MW timestamp, a string with 14 digits

Implements MediaWiki\Logging\LogEntry.

Reimplemented in MediaWiki\Logging\RCDatabaseLogEntry.

Definition at line 250 of file DatabaseLogEntry.php.

References wfTimestamp().

◆ getType()

MediaWiki\Logging\DatabaseLogEntry::getType ( )

The main log type.

Returns
string

Implements MediaWiki\Logging\LogEntry.

Reimplemented in MediaWiki\Logging\RCDatabaseLogEntry.

Definition at line 174 of file DatabaseLogEntry.php.

◆ isLegacy()

MediaWiki\Logging\DatabaseLogEntry::isLegacy ( )

Whether the parameters for this log are stored in new or old format.

Reimplemented from MediaWiki\Logging\LogEntryBase.

Definition at line 167 of file DatabaseLogEntry.php.

◆ newFromId()

static MediaWiki\Logging\DatabaseLogEntry::newFromId ( $id,
IReadableDatabase $db )
static

Loads a LogEntry with the given id from database.

Parameters
int$id
IReadableDatabase$db
Returns
self|null

Reimplemented in MediaWiki\Logging\RCDatabaseLogEntry.

Definition at line 112 of file DatabaseLogEntry.php.

References Wikimedia\Rdbms\IReadableDatabase\getDomainID().

◆ newFromRow()

static MediaWiki\Logging\DatabaseLogEntry::newFromRow ( $row,
string|false $wikiId = WikiAwareEntity::LOCAL )
static

Constructs new LogEntry from database result row.

Supports rows from both logging and recentchanges table.

Parameters
stdClass | array$row
string | false$wikiIdWiki from which this row was loaded (since 1.46)
Returns
self

Definition at line 96 of file DatabaseLogEntry.php.

Referenced by MediaWiki\Logging\LogEventsList\logLine(), and MediaWiki\Logging\LogFormatter\newFromRow().

◆ newSelectQueryBuilder()

static MediaWiki\Logging\DatabaseLogEntry::newSelectQueryBuilder ( IReadableDatabase $db)
static

Definition at line 84 of file DatabaseLogEntry.php.

Referenced by MediaWiki\Logging\Pager\LogPager\getQueryInfo().

Member Data Documentation

◆ $legacy

bool MediaWiki\Logging\DatabaseLogEntry::$legacy
protected

Whether the parameters for this log entry are stored in new or old format.

Definition at line 137 of file DatabaseLogEntry.php.

◆ $params

array null MediaWiki\Logging\DatabaseLogEntry::$params
protected

Parameters for log entry.

Definition at line 131 of file DatabaseLogEntry.php.

◆ $performer

UserIdentity MediaWiki\Logging\DatabaseLogEntry::$performer
protected

Definition at line 128 of file DatabaseLogEntry.php.

◆ $revId

int MediaWiki\Logging\DatabaseLogEntry::$revId = null
protected

A rev id associated to the log entry.

Definition at line 134 of file DatabaseLogEntry.php.

◆ $row

stdClass MediaWiki\Logging\DatabaseLogEntry::$row
protected

Database result row.

Definition at line 125 of file DatabaseLogEntry.php.


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