29use Wikimedia\AtEase\AtEase;
54 $commentQuery = CommentStore::getStore()->getJoin(
'log_comment' );
56 $tables = array_merge(
59 'logging_actor' =>
'actor',
62 $commentQuery[
'tables']
65 'log_id',
'log_type',
'log_action',
'log_timestamp',
66 'log_namespace',
'log_title',
67 'log_params',
'log_deleted',
71 'log_user' =>
'logging_actor.actor_user',
72 'log_user_text' =>
'logging_actor.actor_name'
73 ] + $commentQuery[
'fields'];
76 'logging_actor' => [
'JOIN',
'actor_id=log_actor' ],
78 'user' => [
'LEFT JOIN',
'user_id=logging_actor.actor_user' ],
79 ] + $commentQuery[
'joins'];
86 'join_conds' => $joins,
99 if ( isset(
$row->rc_logid ) ) {
102 return new self(
$row );
114 $queryInfo = self::getSelectQueryData();
115 $queryInfo[
'conds'] += [
'log_id' => $id ];
117 $queryInfo[
'tables'],
118 $queryInfo[
'fields'],
121 $queryInfo[
'options'],
122 $queryInfo[
'join_conds']
127 return self::newFromRow(
$row );
155 return (
int)( $this->row->log_id ?? 0 );
164 return $this->row->log_params;
170 return $this->legacy;
174 return $this->row->log_type;
178 return $this->row->log_action;
182 if ( !isset( $this->params ) ) {
184 AtEase::suppressWarnings();
186 AtEase::restoreWarnings();
189 $this->legacy =
false;
192 $this->legacy =
true;
195 if ( isset( $this->params[
'associated_rev_id'] ) ) {
196 $this->revId = $this->params[
'associated_rev_id'];
197 unset( $this->params[
'associated_rev_id'] );
201 return $this->params;
211 if ( !$this->performer ) {
212 $actorStore = MediaWikiServices::getInstance()->getActorStore();
214 $this->performer = $actorStore->newActorFromRowFields(
215 $this->row->user_id ?? 0,
216 $this->row->log_user_text ??
null,
217 $this->row->log_actor ??
null
219 }
catch ( InvalidArgumentException $e ) {
220 LoggerFactory::getInstance(
'logentry' )->warning(
221 'Failed to instantiate log entry performer', [
223 'log_id' => $this->
getId()
226 $this->performer = $actorStore->getUnknownActor();
229 return $this->performer;
233 $namespace = $this->row->log_namespace;
234 $page = $this->row->log_title;
235 return Title::makeTitle( $namespace, $page );
239 return wfTimestamp( TS_MW, $this->row->log_timestamp );
243 return CommentStore::getStore()->getComment(
'log_comment', $this->row )->text;
247 return $this->row->log_deleted;
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
if(!defined('MW_SETUP_CALLBACK'))
The persistent session ID (if any) loaded at startup.
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.
static getSelectQueryData()
Returns array of information that is needed for querying log entries.
stdClass $row
Database result row.
getId()
Returns the unique database id.
getTarget()
Get the target page of this action.
getType()
The main log type.
static newFromId( $id, IDatabase $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.
static extractParams( $blob)
Extract a parameter array from a blob.
A subclass of DatabaseLogEntry for objects constructed from entries in the recentchanges table (rathe...