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 }
RevDelLogList\getLogParams
getLogParams( $params)
Get log parameter array.
Definition: RevDelLogList.php:102
Revision\RevisionRecord
Page revision base class.
Definition: RevisionRecord.php:46
RevDelLogList
List for logging table items.
Definition: RevDelLogList.php:28
RevDelLogList\newItem
newItem( $row)
Create an item object from a DB result row.
Definition: RevDelLogList.php:90
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Definition: SpecialPage.php:92
ActorMigration\newMigration
static newMigration()
Static constructor.
Definition: ActorMigration.php:140
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2467
RevDelLogList\getType
getType()
Get the internal type name of this list.
Definition: RevDelLogList.php:29
RevDelList
Definition: RevDelList.php:36
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
RevDelLogList\getRevdelConstant
static getRevdelConstant()
Get the revision deletion constant for this list type Override this function.
Definition: RevDelLogList.php:41
LogPage\DELETED_ACTION
const DELETED_ACTION
Definition: LogPage.php:38
RevDelLogList\getLogAction
getLogAction()
Get the log action for this list type.
Definition: RevDelLogList.php:98
RevDelLogList\getSuppressBit
getSuppressBit()
Get the integer value of the flag used for suppression.
Definition: RevDelLogList.php:94
RevDelLogList\getRestriction
static getRestriction()
Get the user right required for this list type Override this function.
Definition: RevDelLogList.php:37
RevisionListBase\$ids
array $ids
Definition: RevisionListBase.php:34
RevDelLogList\suggestTarget
static suggestTarget( $target, array $ids)
Suggest a target for the revision deletion Optionally override this function.
Definition: RevDelLogList.php:45
RevDelLogList\doQuery
doQuery( $db)
Definition: RevDelLogList.php:64
CommentStore\getStore
static getStore()
Definition: CommentStore.php:120
RevDelLogList\getRelationType
static getRelationType()
Get the DB field name associated with the ID list.
Definition: RevDelLogList.php:33
RevDelLogItem
Item class for a logging table row.
Definition: RevDelLogItem.php:27