MediaWiki  master
DatabaseLogEntry Class Reference

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

Inheritance diagram for DatabaseLogEntry:
Collaboration diagram for DatabaseLogEntry:

Public Member Functions

 getAssociatedRevId ()
 
 getComment ()
 Get the user provided comment. More...
 
 getDeleted ()
 Get the access restriction. More...
 
 getId ()
 Returns the unique database id. More...
 
 getParameters ()
 Get the extra parameters stored for this message. More...
 
 getPerformer ()
 Get the user who performed this action. More...
 
 getSubtype ()
 The log subtype. More...
 
 getTarget ()
 Get the target page of this action. More...
 
 getTimestamp ()
 Get the timestamp when the action was executed. More...
 
 getType ()
 The main log type. More...
 
 isLegacy ()
 Whether the parameters for this log are stored in new or old format. More...
 
- Public Member Functions inherited from LogEntryBase
 getFullType ()
 The full logtype in format maintype/subtype. More...
 
 isDeleted ( $field)
 

Static Public Member Functions

static getSelectQueryData ()
 Returns array of information that is needed for querying log entries. More...
 
static newFromId ( $id, IDatabase $db)
 Loads a LogEntry with the given id from database. More...
 
static newFromRow ( $row)
 Constructs new LogEntry from database result row. More...
 
- Static Public Member Functions inherited from LogEntryBase
static extractParams ( $blob)
 Extract a parameter array from a blob. More...
 
static makeParamBlob ( $params)
 Create a blob from a parameter array. More...
 

Protected Member Functions

 __construct ( $row)
 
 getRawParameters ()
 Returns whatever is stored in the database field. More...
 

Protected Attributes

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

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 36 of file DatabaseLogEntry.php.

Constructor & Destructor Documentation

◆ __construct()

DatabaseLogEntry::__construct (   $row)
protected

Definition at line 128 of file DatabaseLogEntry.php.

References $row.

Member Function Documentation

◆ getAssociatedRevId()

DatabaseLogEntry::getAssociatedRevId ( )

Reimplemented in RCDatabaseLogEntry.

Definition at line 187 of file DatabaseLogEntry.php.

References $revId, and getParameters().

◆ getComment()

DatabaseLogEntry::getComment ( )

Get the user provided comment.

Returns
string

Implements LogEntry.

Reimplemented in RCDatabaseLogEntry.

Definition at line 226 of file DatabaseLogEntry.php.

References CommentStore\getStore().

◆ getDeleted()

DatabaseLogEntry::getDeleted ( )

Get the access restriction.

Returns
int

Implements LogEntry.

Reimplemented in RCDatabaseLogEntry.

Definition at line 230 of file DatabaseLogEntry.php.

◆ getId()

DatabaseLogEntry::getId ( )

Returns the unique database id.

Returns
int

Reimplemented in RCDatabaseLogEntry.

Definition at line 137 of file DatabaseLogEntry.php.

◆ getParameters()

DatabaseLogEntry::getParameters ( )

Get the extra parameters stored for this message.

Returns
array

Implements LogEntry.

Definition at line 164 of file DatabaseLogEntry.php.

References $blob, $params, LogEntryBase\extractParams(), LogPage\extractParams(), and getRawParameters().

Referenced by getAssociatedRevId(), and isLegacy().

◆ getPerformer()

DatabaseLogEntry::getPerformer ( )

Get the user who performed this action.

Returns
User

Implements LogEntry.

Reimplemented in RCDatabaseLogEntry.

Definition at line 193 of file DatabaseLogEntry.php.

References $performer, User\newFromActorId(), User\newFromId(), User\newFromName(), and User\newFromRow().

◆ getRawParameters()

DatabaseLogEntry::getRawParameters ( )
protected

Returns whatever is stored in the database field.

Returns
string

Reimplemented in RCDatabaseLogEntry.

Definition at line 146 of file DatabaseLogEntry.php.

Referenced by getParameters().

◆ getSelectQueryData()

static 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

Returns
array

Definition at line 45 of file DatabaseLogEntry.php.

References CommentStore\getStore(), and ActorMigration\newMigration().

Referenced by ChangeTagsLogList\doQuery(), LogPager\getQueryInfo(), and newFromId().

◆ getSubtype()

DatabaseLogEntry::getSubtype ( )

The log subtype.

Returns
string

Implements LogEntry.

Reimplemented in RCDatabaseLogEntry.

Definition at line 160 of file DatabaseLogEntry.php.

◆ getTarget()

DatabaseLogEntry::getTarget ( )

Get the target page of this action.

Returns
Title

Implements LogEntry.

Reimplemented in RCDatabaseLogEntry.

Definition at line 216 of file DatabaseLogEntry.php.

References Title\makeTitle().

◆ getTimestamp()

DatabaseLogEntry::getTimestamp ( )

Get the timestamp when the action was executed.

Returns
string

Implements LogEntry.

Reimplemented in RCDatabaseLogEntry.

Definition at line 222 of file DatabaseLogEntry.php.

References wfTimestamp().

◆ getType()

DatabaseLogEntry::getType ( )

The main log type.

Returns
string

Implements LogEntry.

Reimplemented in RCDatabaseLogEntry.

Definition at line 156 of file DatabaseLogEntry.php.

◆ isLegacy()

DatabaseLogEntry::isLegacy ( )

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

Returns
bool

Reimplemented from LogEntryBase.

Definition at line 150 of file DatabaseLogEntry.php.

References $legacy, and getParameters().

◆ newFromId()

static DatabaseLogEntry::newFromId (   $id,
IDatabase  $db 
)
static

Loads a LogEntry with the given id from database.

Parameters
int$id
IDatabase$db
Returns
DatabaseLogEntry|null

Definition at line 96 of file DatabaseLogEntry.php.

References $row, getSelectQueryData(), newFromRow(), and Wikimedia\Rdbms\IDatabase\selectRow().

◆ newFromRow()

static DatabaseLogEntry::newFromRow (   $row)
static

Constructs new LogEntry from database result row.

Supports rows from both logging and recentchanges table.

Parameters
stdClass | array$row
Returns
DatabaseLogEntry

Definition at line 80 of file DatabaseLogEntry.php.

References $row.

Referenced by ApiQueryLogEvents\extractRowInfo(), RevDelLogItem\getApiData(), DeleteAutoPatrolLogs\getRowsOld(), LogEventsList\logLine(), newFromId(), and LogFormatter\newFromRow().

Member Data Documentation

◆ $legacy

bool DatabaseLogEntry::$legacy
protected

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

Definition at line 126 of file DatabaseLogEntry.php.

Referenced by isLegacy().

◆ $params

array DatabaseLogEntry::$params
protected

Parameters for log entry.

Definition at line 120 of file DatabaseLogEntry.php.

Referenced by getParameters().

◆ $performer

User DatabaseLogEntry::$performer
protected

Definition at line 117 of file DatabaseLogEntry.php.

Referenced by RCDatabaseLogEntry\getPerformer(), and getPerformer().

◆ $revId

int DatabaseLogEntry::$revId = null
protected

A rev id associated to the log entry.

Definition at line 123 of file DatabaseLogEntry.php.

Referenced by getAssociatedRevId().

◆ $row

stdClass DatabaseLogEntry::$row
protected

Database result row.

Definition at line 114 of file DatabaseLogEntry.php.

Referenced by __construct(), newFromId(), and newFromRow().


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