MediaWiki  master
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 
71  public function getPerformerIdentity(): UserIdentity {
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 }
RCDatabaseLogEntry\getSelectQueryData
static getSelectQueryData()
Returns array of information that is needed for querying log entries.
Definition: RCDatabaseLogEntry.php:45
RCDatabaseLogEntry\getPerformerIdentity
getPerformerIdentity()
Definition: RCDatabaseLogEntry.php:71
RCDatabaseLogEntry
A subclass of DatabaseLogEntry for objects constructed from entries in the recentchanges table (rathe...
Definition: RCDatabaseLogEntry.php:37
RCDatabaseLogEntry\getAssociatedRevId
getAssociatedRevId()
Definition: RCDatabaseLogEntry.php:59
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:193
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1668
RCDatabaseLogEntry\getRawParameters
getRawParameters()
Returns whatever is stored in the database field.
Definition: RCDatabaseLogEntry.php:55
RCDatabaseLogEntry\getSubtype
getSubtype()
The log subtype.
Definition: RCDatabaseLogEntry.php:67
MediaWiki\User\UserIdentity
Interface for objects representing user identity.
Definition: UserIdentity.php:39
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
RCDatabaseLogEntry\getId
getId()
Returns the unique database id.
Definition: RCDatabaseLogEntry.php:51
RCDatabaseLogEntry\getTimestamp
getTimestamp()
Get the timestamp when the action was executed.
Definition: RCDatabaseLogEntry.php:99
RCDatabaseLogEntry\getTarget
getTarget()
Get the target page of this action.
Definition: RCDatabaseLogEntry.php:93
MediaWiki\Logger\LoggerFactory
PSR-3 logger instance factory.
Definition: LoggerFactory.php:45
DatabaseLogEntry\$performer
UserIdentity $performer
Definition: DatabaseLogEntry.php:134
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2203
RCDatabaseLogEntry\getComment
getComment()
Get the user provided comment.
Definition: RCDatabaseLogEntry.php:103
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:651
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
RCDatabaseLogEntry\getType
getType()
The main log type.
Definition: RCDatabaseLogEntry.php:63
RCDatabaseLogEntry\newFromId
static newFromId( $id, IDatabase $db)
Loads a LogEntry with the given id from database.
Definition: RCDatabaseLogEntry.php:39
DatabaseLogEntry
A value class to process existing log entries.
Definition: DatabaseLogEntry.php:39
RCDatabaseLogEntry\getDeleted
getDeleted()
Get the access restriction.
Definition: RCDatabaseLogEntry.php:109
CommentStore\getStore
static getStore()
Definition: CommentStore.php:120