28use InvalidArgumentException;
33use Wikimedia\AtEase\AtEase;
62 $tables = array_merge(
65 'logging_actor' =>
'actor',
68 $commentQuery[
'tables']
71 'log_id',
'log_type',
'log_action',
'log_timestamp',
72 'log_namespace',
'log_title',
73 'log_params',
'log_deleted',
77 'log_user' =>
'logging_actor.actor_user',
78 'log_user_text' =>
'logging_actor.actor_name'
79 ] + $commentQuery[
'fields'];
82 'logging_actor' => [
'JOIN',
'actor_id=log_actor' ],
84 'user' => [
'LEFT JOIN',
'user_id=logging_actor.actor_user' ],
85 ] + $commentQuery[
'joins'];
92 'join_conds' => $joins,
109 if ( isset(
$row->rc_logid ) ) {
113 return new self(
$row );
125 ->where( [
'log_id' => $id ] )
126 ->caller( __METHOD__ )->fetchRow();
158 return (
int)( $this->row->log_id ?? 0 );
168 return $this->row->log_params;
178 return $this->row->log_type;
182 return $this->row->log_action;
186 if ( $this->params ===
null ) {
188 AtEase::suppressWarnings();
190 AtEase::restoreWarnings();
193 $this->legacy =
false;
196 $this->legacy =
true;
199 if ( isset( $this->params[
'associated_rev_id'] ) ) {
200 $this->revId = $this->params[
'associated_rev_id'];
201 unset( $this->params[
'associated_rev_id'] );
215 if ( !$this->performer ) {
218 $this->performer = $actorStore->newActorFromRowFields(
219 $this->row->user_id ?? 0,
220 $this->row->log_user_text ??
null,
221 $this->row->log_actor ??
null
223 }
catch ( InvalidArgumentException $e ) {
224 LoggerFactory::getInstance(
'logentry' )->warning(
225 'Failed to instantiate log entry performer', [
227 'log_id' => $this->
getId()
230 $this->performer = $actorStore->getUnknownActor();
237 $namespace = $this->row->log_namespace;
238 $page = $this->row->log_title;
243 return wfTimestamp( TS_MW, $this->row->log_timestamp );
248 ->getComment(
'log_comment', $this->row )->text;
252 return $this->row->log_deleted;
257class_alias( DatabaseLogEntry::class,
'DatabaseLogEntry' );
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
if(!defined('MW_SETUP_CALLBACK'))
A value class to process existing log entries.
static newFromId( $id, IReadableDatabase $db)
Loads a LogEntry with the given id from database.
static newFromRow( $row)
Constructs new LogEntry from database result row.
getDeleted()
Get the access restriction.
getTimestamp()
Get the timestamp when the action was executed.
getId()
Returns the unique database id.
getComment()
Get the user provided comment.
getParameters()
Get the extra parameters stored for this message.
getType()
The main log type.
getTarget()
Get the target page of this action.
getRawParameters()
Returns whatever is stored in the database field (typically a serialized associative array but very o...
static getSelectQueryData()
Returns array of information that is needed for querying log entries.
int $revId
A rev id associated to the log entry.
isLegacy()
Whether the parameters for this log are stored in new or old format.
array null $params
Parameters for log entry.
stdClass $row
Database result row.
bool $legacy
Whether the parameters for this log entry are stored in new or old format.
static newSelectQueryBuilder(IReadableDatabase $db)
getSubtype()
The log subtype.
Extends the LogEntry Interface with some basic functionality.
static extractParams( $blob)
Extract a parameter array from a blob.
static extractParams( $blob)
Extract a parameter array from a blob.
A subclass of DatabaseLogEntry for objects constructed from entries in the recentchanges table (rathe...