MediaWiki  master
RCDatabaseLogEntry.php
Go to the documentation of this file.
1 <?php
31 
32  public function getId() {
33  return $this->row->rc_logid;
34  }
35 
36  protected function getRawParameters() {
37  return $this->row->rc_params;
38  }
39 
40  public function getAssociatedRevId() {
41  return $this->row->rc_this_oldid;
42  }
43 
50  public function getParentRevId() {
51  return $this->row->rc_last_oldid;
52  }
53 
54  public function getType() {
55  return $this->row->rc_log_type;
56  }
57 
58  public function getSubtype() {
59  return $this->row->rc_log_action;
60  }
61 
62  public function getPerformer() {
63  if ( !$this->performer ) {
64  $actorId = isset( $this->row->rc_actor ) ? (int)$this->row->rc_actor : 0;
65  $userId = (int)$this->row->rc_user;
66  if ( $actorId !== 0 ) {
67  $this->performer = User::newFromActorId( $actorId );
68  } elseif ( $userId !== 0 ) {
69  $this->performer = User::newFromId( $userId );
70  } else {
71  $userText = $this->row->rc_user_text;
72  // Might be an IP, don't validate the username
73  $this->performer = User::newFromName( $userText, false );
74  }
75  }
76 
77  return $this->performer;
78  }
79 
80  public function getTarget() {
81  $namespace = $this->row->rc_namespace;
82  $page = $this->row->rc_title;
83  return Title::makeTitle( $namespace, $page );
84  }
85 
86  public function getTimestamp() {
87  return wfTimestamp( TS_MW, $this->row->rc_timestamp );
88  }
89 
90  public function getComment() {
91  return CommentStore::getStore()
92  // Legacy because the row may have used RecentChange::selectFields()
93  ->getCommentLegacy( wfGetDB( DB_REPLICA ), 'rc_comment', $this->row )->text;
94  }
95 
96  public function getDeleted() {
97  return $this->row->rc_deleted;
98  }
99 }
User\newFromId
static newFromId( $id)
Static factory method for creation from a given user ID.
Definition: User.php:559
RCDatabaseLogEntry
A subclass of DatabaseLogEntry for objects constructed from entries in the recentchanges table (rathe...
Definition: RCDatabaseLogEntry.php:30
RCDatabaseLogEntry\getAssociatedRevId
getAssociatedRevId()
Definition: RCDatabaseLogEntry.php:40
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1806
RCDatabaseLogEntry\getRawParameters
getRawParameters()
Returns whatever is stored in the database field.
Definition: RCDatabaseLogEntry.php:36
RCDatabaseLogEntry\getSubtype
getSubtype()
The log subtype.
Definition: RCDatabaseLogEntry.php:58
RCDatabaseLogEntry\getParentRevId
getParentRevId()
Get the rev_id associated to the parent revision.
Definition: RCDatabaseLogEntry.php:50
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:535
RCDatabaseLogEntry\getId
getId()
Returns the unique database id.
Definition: RCDatabaseLogEntry.php:32
RCDatabaseLogEntry\getTimestamp
getTimestamp()
Get the timestamp when the action was executed.
Definition: RCDatabaseLogEntry.php:86
RCDatabaseLogEntry\getTarget
getTarget()
Get the target page of this action.
Definition: RCDatabaseLogEntry.php:80
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2463
RCDatabaseLogEntry\getComment
getComment()
Get the user provided comment.
Definition: RCDatabaseLogEntry.php:90
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:595
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
RCDatabaseLogEntry\getType
getType()
The main log type.
Definition: RCDatabaseLogEntry.php:54
User\newFromActorId
static newFromActorId( $id)
Static factory method for creation from a given actor ID.
Definition: User.php:574
DatabaseLogEntry
A value class to process existing log entries.
Definition: DatabaseLogEntry.php:34
RCDatabaseLogEntry\getPerformer
getPerformer()
Get the user who performed this action.
Definition: RCDatabaseLogEntry.php:62
RCDatabaseLogEntry\getDeleted
getDeleted()
Get the access restriction.
Definition: RCDatabaseLogEntry.php:96
CommentStore\getStore
static getStore()
Definition: CommentStore.php:109
DatabaseLogEntry\$performer
User $performer
Definition: DatabaseLogEntry.php:115