MediaWiki REL1_31
RevDelLogList.php
Go to the documentation of this file.
1<?php
23
28 public function getType() {
29 return 'logging';
30 }
31
32 public static function getRelationType() {
33 return 'log_id';
34 }
35
36 public static function getRestriction() {
37 return 'deletelogentry';
38 }
39
40 public static function getRevdelConstant() {
42 }
43
44 public static function suggestTarget( $target, array $ids ) {
45 $result = wfGetDB( DB_REPLICA )->select( 'logging',
46 'log_type',
47 [ 'log_id' => $ids ],
48 __METHOD__,
49 [ 'DISTINCT' ]
50 );
51 if ( $result->numRows() == 1 ) {
52 // If there's only one type, the target can be set to include it.
53 return SpecialPage::getTitleFor( 'Log', $result->current()->log_type );
54 }
55
56 return SpecialPage::getTitleFor( 'Log' );
57 }
58
63 public function doQuery( $db ) {
64 $ids = array_map( 'intval', $this->ids );
65
66 $commentQuery = CommentStore::getStore()->getJoin( 'log_comment' );
67 $actorQuery = ActorMigration::newMigration()->getJoin( 'log_user' );
68
69 return $db->select(
70 [ 'logging' ] + $commentQuery['tables'] + $actorQuery['tables'],
71 [
72 'log_id',
73 'log_type',
74 'log_action',
75 'log_timestamp',
76 'log_namespace',
77 'log_title',
78 'log_page',
79 'log_params',
80 'log_deleted'
81 ] + $commentQuery['fields'] + $actorQuery['fields'],
82 [ 'log_id' => $ids ],
83 __METHOD__,
84 [ 'ORDER BY' => 'log_id DESC' ],
85 $commentQuery['joins'] + $actorQuery['joins']
86 );
87 }
88
89 public function newItem( $row ) {
90 return new RevDelLogItem( $this, $row );
91 }
92
93 public function getSuppressBit() {
94 return Revision::DELETED_RESTRICTED;
95 }
96
97 public function getLogAction() {
98 return 'event';
99 }
100
101 public function getLogParams( $params ) {
102 return [
103 '4::ids' => $params['ids'],
104 '5::ofield' => $params['oldBits'],
105 '6::nfield' => $params['newBits'],
106 ];
107 }
108}
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
const DELETED_ACTION
Definition LogPage.php:32
Abstract base class for a list of deletable items.
Item class for a logging table row.
List for logging table items.
getLogParams( $params)
Get log parameter array.
getLogAction()
Get the log action for this list type.
static getRestriction()
Get the user right required for this list type Override this function.
getSuppressBit()
Get the integer value of the flag used for suppression.
static getRelationType()
Get the DB field name associated with the ID list.
getType()
Get the internal type name of this list.
static suggestTarget( $target, array $ids)
Suggest a target for the revision deletion Optionally override this function.
static getRevdelConstant()
Get the revision deletion constant for this list type Override this function.
newItem( $row)
Create an item object from a DB result row.
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:38
const DB_REPLICA
Definition defines.php:25
$params