30use Wikimedia\AtEase\AtEase;
57 $commentQuery = MediaWikiServices::getInstance()->getCommentStore()->getJoin(
'log_comment' );
59 $tables = array_merge(
62 'logging_actor' =>
'actor',
65 $commentQuery[
'tables']
68 'log_id',
'log_type',
'log_action',
'log_timestamp',
69 'log_namespace',
'log_title',
70 'log_params',
'log_deleted',
74 'log_user' =>
'logging_actor.actor_user',
75 'log_user_text' =>
'logging_actor.actor_name'
76 ] + $commentQuery[
'fields'];
79 'logging_actor' => [
'JOIN',
'actor_id=log_actor' ],
81 'user' => [
'LEFT JOIN',
'user_id=logging_actor.actor_user' ],
82 ] + $commentQuery[
'joins'];
89 'join_conds' => $joins,
106 if ( isset(
$row->rc_logid ) ) {
109 return new self(
$row );
121 $row = self::newSelectQueryBuilder( $db )
122 ->where( [
'log_id' => $id ] )
123 ->caller( __METHOD__ )->fetchRow();
127 return self::newFromRow(
$row );
155 return (
int)( $this->row->log_id ?? 0 );
165 return $this->row->log_params;
171 return $this->legacy;
175 return $this->row->log_type;
179 return $this->row->log_action;
183 if ( !isset( $this->params ) ) {
185 AtEase::suppressWarnings();
187 AtEase::restoreWarnings();
190 $this->legacy =
false;
192 $this->params = LogPage::extractParams( $blob );
193 $this->legacy =
true;
196 if ( isset( $this->params[
'associated_rev_id'] ) ) {
197 $this->revId = $this->params[
'associated_rev_id'];
198 unset( $this->params[
'associated_rev_id'] );
212 if ( !$this->performer ) {
213 $actorStore = MediaWikiServices::getInstance()->getActorStore();
215 $this->performer = $actorStore->newActorFromRowFields(
216 $this->row->user_id ?? 0,
217 $this->row->log_user_text ??
null,
218 $this->row->log_actor ??
null
220 }
catch ( InvalidArgumentException $e ) {
221 LoggerFactory::getInstance(
'logentry' )->warning(
222 'Failed to instantiate log entry performer', [
224 'log_id' => $this->
getId()
227 $this->performer = $actorStore->getUnknownActor();
230 return $this->performer;
234 $namespace = $this->row->log_namespace;
235 $page = $this->row->log_title;
236 return MediaWikiServices::getInstance()->getTitleFactory()->makeTitle( $namespace, $page );
240 return wfTimestamp( TS_MW, $this->row->log_timestamp );
244 return MediaWikiServices::getInstance()->getCommentStore()
245 ->getComment(
'log_comment', $this->row )->text;
249 return $this->row->log_deleted;
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
array $params
The job parameters.
if(!defined('MW_SETUP_CALLBACK'))
A value class to process existing log entries.
getParameters()
Get the extra parameters stored for this message.
isLegacy()
Whether the parameters for this log are stored in new or old format.
array $params
Parameters for log entry.
getSubtype()
The log subtype.
getDeleted()
Get the access restriction.
static newFromRow( $row)
Constructs new LogEntry from database result row.
getComment()
Get the user provided comment.
bool $legacy
Whether the parameters for this log entry are stored in new or old format.
int $revId
A rev id associated to the log entry.
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.
stdClass $row
Database result row.
static newSelectQueryBuilder(IReadableDatabase $db)
getId()
Returns the unique database id.
getTarget()
Get the target page of this action.
getType()
The main log type.
static newFromId( $id, IReadableDatabase $db)
Loads a LogEntry with the given id from database.
getTimestamp()
Get the timestamp when the action was executed.
Extends the LogEntry Interface with some basic functionality.
static extractParams( $blob)
Extract a parameter array from a blob.
A subclass of DatabaseLogEntry for objects constructed from entries in the recentchanges table (rathe...