MediaWiki  master
RevDelLogList.php
Go to the documentation of this file.
1 <?php
24 
28 class RevDelLogList extends RevDelList {
29  public function getType() {
30  return 'logging';
31  }
32 
33  public static function getRelationType() {
34  return 'log_id';
35  }
36 
37  public static function getRestriction() {
38  return 'deletelogentry';
39  }
40 
41  public static function getRevdelConstant() {
43  }
44 
45  public static function suggestTarget( $target, array $ids ) {
46  $result = wfGetDB( DB_REPLICA )->select( 'logging',
47  'log_type',
48  [ 'log_id' => $ids ],
49  __METHOD__,
50  [ 'DISTINCT' ]
51  );
52  if ( $result->numRows() == 1 ) {
53  // If there's only one type, the target can be set to include it.
54  return SpecialPage::getTitleFor( 'Log', $result->current()->log_type );
55  }
56 
57  return SpecialPage::getTitleFor( 'Log' );
58  }
59 
64  public function doQuery( $db ) {
65  $ids = array_map( 'intval', $this->ids );
66 
67  $commentQuery = CommentStore::getStore()->getJoin( 'log_comment' );
68  $actorQuery = ActorMigration::newMigration()->getJoin( 'log_user' );
69 
70  return $db->select(
71  [ 'logging' ] + $commentQuery['tables'] + $actorQuery['tables'],
72  [
73  'log_id',
74  'log_type',
75  'log_action',
76  'log_timestamp',
77  'log_namespace',
78  'log_title',
79  'log_page',
80  'log_params',
81  'log_deleted'
82  ] + $commentQuery['fields'] + $actorQuery['fields'],
83  [ 'log_id' => $ids ],
84  __METHOD__,
85  [ 'ORDER BY' => 'log_id DESC' ],
86  $commentQuery['joins'] + $actorQuery['joins']
87  );
88  }
89 
90  public function newItem( $row ) {
91  return new RevDelLogItem( $this, $row );
92  }
93 
94  public function getSuppressBit() {
95  return RevisionRecord::DELETED_RESTRICTED;
96  }
97 
98  public function getLogAction() {
99  return 'event';
100  }
101 
102  public function getLogParams( $params ) {
103  return [
104  '4::ids' => $params['ids'],
105  '5::ofield' => $params['oldBits'],
106  '6::nfield' => $params['newBits'],
107  ];
108  }
109 }
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Item class for a logging table row.
static getRelationType()
static newMigration()
Static constructor.
static getRevdelConstant()
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don&#39;t need a full Title object...
Definition: SpecialPage.php:83
List for logging table items.
static getStore()
static suggestTarget( $target, array $ids)
const DB_REPLICA
Definition: defines.php:25
const DELETED_ACTION
Definition: LogPage.php:34
getLogParams( $params)
static getRestriction()