MediaWiki  master
RCDatabaseLogEntry.php
Go to the documentation of this file.
1 <?php
27 
35 
36  public static function newFromId( $id, IDatabase $db ) {
37  // Make the LSP violation explicit to prevent sneaky failures
38  throw new LogicException( 'Not implemented!' );
39  }
40 
41  public static function getSelectQueryData() {
42  // Make the LSP violation explicit to prevent sneaky failures
43  throw new LogicException( 'Not implemented!' );
44  }
45 
46  public function getId() {
47  return $this->row->rc_logid;
48  }
49 
50  protected function getRawParameters() {
51  return $this->row->rc_params;
52  }
53 
54  public function getAssociatedRevId() {
55  return $this->row->rc_this_oldid;
56  }
57 
58  public function getType() {
59  return $this->row->rc_log_type;
60  }
61 
62  public function getSubtype() {
63  return $this->row->rc_log_action;
64  }
65 
66  public function getPerformer() {
67  if ( !$this->performer ) {
68  $actorId = isset( $this->row->rc_actor ) ? (int)$this->row->rc_actor : 0;
69  $userId = (int)$this->row->rc_user;
70  if ( $actorId !== 0 ) {
71  $this->performer = User::newFromActorId( $actorId );
72  } elseif ( $userId !== 0 ) {
73  $this->performer = User::newFromId( $userId );
74  } else {
75  $userText = $this->row->rc_user_text;
76  // Might be an IP, don't validate the username
77  $this->performer = User::newFromName( $userText, false );
78  }
79  }
80 
81  return $this->performer;
82  }
83 
84  public function getTarget() {
85  $namespace = $this->row->rc_namespace;
86  $page = $this->row->rc_title;
87  return Title::makeTitle( $namespace, $page );
88  }
89 
90  public function getTimestamp() {
91  return wfTimestamp( TS_MW, $this->row->rc_timestamp );
92  }
93 
94  public function getComment() {
95  return CommentStore::getStore()
96  // Legacy because the row may have used RecentChange::selectFields()
97  ->getCommentLegacy( wfGetDB( DB_REPLICA ), 'rc_comment', $this->row )->text;
98  }
99 
100  public function getDeleted() {
101  return $this->row->rc_deleted;
102  }
103 }
RCDatabaseLogEntry\getSelectQueryData
static getSelectQueryData()
Returns array of information that is needed for querying log entries.
Definition: RCDatabaseLogEntry.php:41
User\newFromId
static newFromId( $id)
Static factory method for creation from a given user ID.
Definition: User.php:562
RCDatabaseLogEntry
A subclass of DatabaseLogEntry for objects constructed from entries in the recentchanges table (rathe...
Definition: RCDatabaseLogEntry.php:34
RCDatabaseLogEntry\getAssociatedRevId
getAssociatedRevId()
Definition: RCDatabaseLogEntry.php:54
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1808
RCDatabaseLogEntry\getRawParameters
getRawParameters()
Returns whatever is stored in the database field.
Definition: RCDatabaseLogEntry.php:50
RCDatabaseLogEntry\getSubtype
getSubtype()
The log subtype.
Definition: RCDatabaseLogEntry.php:62
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:538
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:46
RCDatabaseLogEntry\getTimestamp
getTimestamp()
Get the timestamp when the action was executed.
Definition: RCDatabaseLogEntry.php:90
RCDatabaseLogEntry\getTarget
getTarget()
Get the target page of this action.
Definition: RCDatabaseLogEntry.php:84
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2467
RCDatabaseLogEntry\getComment
getComment()
Get the user provided comment.
Definition: RCDatabaseLogEntry.php:94
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:592
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
RCDatabaseLogEntry\getType
getType()
The main log type.
Definition: RCDatabaseLogEntry.php:58
RCDatabaseLogEntry\newFromId
static newFromId( $id, IDatabase $db)
Loads a LogEntry with the given id from database.
Definition: RCDatabaseLogEntry.php:36
User\newFromActorId
static newFromActorId( $id)
Static factory method for creation from a given actor ID.
Definition: User.php:577
DatabaseLogEntry
A value class to process existing log entries.
Definition: DatabaseLogEntry.php:36
RCDatabaseLogEntry\getPerformer
getPerformer()
Get the user who performed this action.
Definition: RCDatabaseLogEntry.php:66
RCDatabaseLogEntry\getDeleted
getDeleted()
Get the access restriction.
Definition: RCDatabaseLogEntry.php:100
CommentStore\getStore
static getStore()
Definition: CommentStore.php:120
DatabaseLogEntry\$performer
User $performer
Definition: DatabaseLogEntry.php:117