MediaWiki REL1_37
RCDatabaseLogEntry.php
Go to the documentation of this file.
1<?php
30
38
39 public static function newFromId( $id, IDatabase $db ) {
40 // @phan-suppress-previous-line PhanPluginNeverReturnMethod
41 // Make the LSP violation explicit to prevent sneaky failures
42 throw new LogicException( 'Not implemented!' );
43 }
44
45 public static function getSelectQueryData() {
46 // @phan-suppress-previous-line PhanPluginNeverReturnMethod
47 // Make the LSP violation explicit to prevent sneaky failures
48 throw new LogicException( 'Not implemented!' );
49 }
50
51 public function getId() {
52 return $this->row->rc_logid;
53 }
54
55 protected function getRawParameters() {
56 return $this->row->rc_params;
57 }
58
59 public function getAssociatedRevId() {
60 return $this->row->rc_this_oldid;
61 }
62
63 public function getType() {
64 return $this->row->rc_log_type;
65 }
66
67 public function getSubtype() {
68 return $this->row->rc_log_action;
69 }
70
72 if ( !$this->performer ) {
73 $actorStore = MediaWikiServices::getInstance()->getActorStore();
74 try {
75 $this->performer = $actorStore->newActorFromRowFields(
76 $this->row->rc_user ?? 0,
77 $this->row->rc_user_text,
78 $this->row->rc_actor ?? null
79 );
80 } catch ( InvalidArgumentException $e ) {
81 LoggerFactory::getInstance( 'logentry' )->warning(
82 'Failed to instantiate RC log entry performer', [
83 'exception' => $e,
84 'log_id' => $this->getId()
85 ]
86 );
87 $this->performer = $actorStore->getUnknownActor();
88 }
89 }
90 return $this->performer;
91 }
92
93 public function getTarget() {
94 $namespace = $this->row->rc_namespace;
95 $page = $this->row->rc_title;
96 return Title::makeTitle( $namespace, $page );
97 }
98
99 public function getTimestamp() {
100 return wfTimestamp( TS_MW, $this->row->rc_timestamp );
101 }
102
103 public function getComment() {
104 return CommentStore::getStore()
105 // Legacy because the row may have used RecentChange::selectFields()
106 ->getCommentLegacy( wfGetDB( DB_REPLICA ), 'rc_comment', $this->row )->text;
107 }
108
109 public function getDeleted() {
110 return $this->row->rc_deleted;
111 }
112}
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
if(ini_get('mbstring.func_overload')) if(!defined('MW_ENTRY_POINT'))
Pre-config setup: Before loading LocalSettings.php.
Definition Setup.php:88
A value class to process existing log entries.
UserIdentity $performer
PSR-3 logger instance factory.
MediaWikiServices is the service locator for the application scope of MediaWiki.
A subclass of DatabaseLogEntry for objects constructed from entries in the recentchanges table (rathe...
getTimestamp()
Get the timestamp when the action was executed.
getTarget()
Get the target page of this action.
static newFromId( $id, IDatabase $db)
Loads a LogEntry with the given id from database.
static getSelectQueryData()
Returns array of information that is needed for querying log entries.
getSubtype()
The log subtype.
getComment()
Get the user provided comment.
getDeleted()
Get the access restriction.
getRawParameters()
Returns whatever is stored in the database field.
getId()
Returns the unique database id.
getType()
The main log type.
Interface for objects representing user identity.
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:38
const DB_REPLICA
Definition defines.php:25