MediaWiki  master
RevDelLogList.php
Go to the documentation of this file.
1 <?php
25 
29 class RevDelLogList extends RevDelList {
30 
32  private $actorMigration;
33 
35  private $commentStore;
36 
45  public function __construct(
47  Title $title,
48  array $ids,
52  ) {
53  parent::__construct( $context, $title, $ids, $lbFactory );
54  $this->actorMigration = $actorMigration;
55  $this->commentStore = $commentStore;
56  }
57 
58  public function getType() {
59  return 'logging';
60  }
61 
62  public static function getRelationType() {
63  return 'log_id';
64  }
65 
66  public static function getRestriction() {
67  return 'deletelogentry';
68  }
69 
70  public static function getRevdelConstant() {
72  }
73 
74  public static function suggestTarget( $target, array $ids ) {
75  $result = wfGetDB( DB_REPLICA )->select( 'logging',
76  'log_type',
77  [ 'log_id' => $ids ],
78  __METHOD__,
79  [ 'DISTINCT' ]
80  );
81  if ( $result->numRows() == 1 ) {
82  // If there's only one type, the target can be set to include it.
83  return SpecialPage::getTitleFor( 'Log', $result->current()->log_type );
84  }
85 
86  return SpecialPage::getTitleFor( 'Log' );
87  }
88 
93  public function doQuery( $db ) {
94  $ids = array_map( 'intval', $this->ids );
95 
96  $commentQuery = $this->commentStore->getJoin( 'log_comment' );
97  $actorQuery = $this->actorMigration->getJoin( 'log_user' );
98 
99  return $db->select(
100  [ 'logging' ] + $commentQuery['tables'] + $actorQuery['tables'],
101  [
102  'log_id',
103  'log_type',
104  'log_action',
105  'log_timestamp',
106  'log_namespace',
107  'log_title',
108  'log_page',
109  'log_params',
110  'log_deleted'
111  ] + $commentQuery['fields'] + $actorQuery['fields'],
112  [ 'log_id' => $ids ],
113  __METHOD__,
114  [ 'ORDER BY' => 'log_id DESC' ],
115  $commentQuery['joins'] + $actorQuery['joins']
116  );
117  }
118 
119  public function newItem( $row ) {
120  return new RevDelLogItem( $this, $row );
121  }
122 
123  public function getSuppressBit() {
124  return RevisionRecord::DELETED_RESTRICTED;
125  }
126 
127  public function getLogAction() {
128  return 'event';
129  }
130 
131  public function getLogParams( $params ) {
132  return [
133  '4::ids' => $params['ids'],
134  '5::ofield' => $params['oldBits'],
135  '6::nfield' => $params['newBits'],
136  ];
137  }
138 }
RevDelLogList\getLogParams
getLogParams( $params)
Get log parameter array.
Definition: RevDelLogList.php:131
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:38
Revision\RevisionRecord
Page revision base class.
Definition: RevisionRecord.php:47
RevDelLogList
List for logging table items.
Definition: RevDelLogList.php:29
RevDelLogList\newItem
newItem( $row)
Create an item object from a DB result row.
Definition: RevDelLogList.php:119
CommentStore
Handle database storage of comments such as edit summaries and log reasons.
Definition: CommentStore.php:42
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:107
ActorMigration
This class handles the logic for the actor table migration and should always be used in lieu of direc...
Definition: ActorMigration.php:41
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
RevDelLogList\$actorMigration
ActorMigration $actorMigration
Definition: RevDelLogList.php:32
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:58
RevDelList\$lbFactory
LBFactory $lbFactory
Definition: RevDelList.php:39
RevisionListBase\$title
Title $title
Definition: RevisionListBase.php:31
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:70
LogPage\DELETED_ACTION
const DELETED_ACTION
Definition: LogPage.php:38
RevDelLogList\getLogAction
getLogAction()
Get the log action for this list type.
Definition: RevDelLogList.php:127
RevDelLogList\getSuppressBit
getSuppressBit()
Get the integer value of the flag used for suppression.
Definition: RevDelLogList.php:123
RevDelLogList\__construct
__construct(IContextSource $context, Title $title, array $ids, LBFactory $lbFactory, ActorMigration $actorMigration, CommentStore $commentStore)
Definition: RevDelLogList.php:45
RevDelLogList\getRestriction
static getRestriction()
Get the user right required for this list type Override this function.
Definition: RevDelLogList.php:66
RevisionListBase\$ids
int[] null $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:74
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:57
Title
Represents a title within MediaWiki.
Definition: Title.php:46
RevDelLogList\$commentStore
CommentStore $commentStore
Definition: RevDelLogList.php:35
Wikimedia\Rdbms\LBFactory
An interface for generating database load balancers.
Definition: LBFactory.php:41
RevDelLogList\doQuery
doQuery( $db)
Definition: RevDelLogList.php:93
RevDelLogList\getRelationType
static getRelationType()
Get the DB field name associated with the ID list.
Definition: RevDelLogList.php:62
RevDelLogItem
Item class for a logging table row.
Definition: RevDelLogItem.php:28