3 * Contains a class for dealing with recent changes database log entries
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
21 * @author Niklas Laxström
22 * @license GPL-2.0-or-later
27 * A subclass of DatabaseLogEntry for objects constructed from entries in the
28 * recentchanges table (rather than the logging table).
30 class RCDatabaseLogEntry
extends DatabaseLogEntry
{
32 public function getId() {
33 return $this->row
->rc_logid
;
36 protected function getRawParameters() {
37 return $this->row
->rc_params
;
40 public function getAssociatedRevId() {
41 return $this->row
->rc_this_oldid
;
44 public function getType() {
45 return $this->row
->rc_log_type
;
48 public function getSubtype() {
49 return $this->row
->rc_log_action
;
52 public function getPerformer() {
53 if ( !$this->performer
) {
54 $actorId = isset( $this->row
->rc_actor
) ?
(int)$this->row
->rc_actor
: 0;
55 $userId = (int)$this->row
->rc_user
;
56 if ( $actorId !== 0 ) {
57 $this->performer
= User
::newFromActorId( $actorId );
58 } elseif ( $userId !== 0 ) {
59 $this->performer
= User
::newFromId( $userId );
61 $userText = $this->row
->rc_user_text
;
62 // Might be an IP, don't validate the username
63 $this->performer
= User
::newFromName( $userText, false );
67 return $this->performer
;
70 public function getTarget() {
71 $namespace = $this->row
->rc_namespace
;
72 $page = $this->row
->rc_title
;
73 return Title
::makeTitle( $namespace, $page );
76 public function getTimestamp() {
77 return wfTimestamp( TS_MW
, $this->row
->rc_timestamp
);
80 public function getComment() {
81 return CommentStore
::getStore()
82 // Legacy because the row may have used RecentChange::selectFields()
83 ->getCommentLegacy( wfGetDB( DB_REPLICA
), 'rc_comment', $this->row
)->text
;
86 public function getDeleted() {
87 return $this->row
->rc_deleted
;