MediaWiki  master
RevDelLogList.php
Go to the documentation of this file.
1 <?php
26 
30 class RevDelLogList extends RevDelList {
31 
33  private $commentStore;
34 
43  public function __construct(
45  PageIdentity $page,
46  array $ids,
49  ) {
50  parent::__construct( $context, $page, $ids, $lbFactory );
51  $this->commentStore = $commentStore;
52  }
53 
54  public function getType() {
55  return 'logging';
56  }
57 
58  public static function getRelationType() {
59  return 'log_id';
60  }
61 
62  public static function getRestriction() {
63  return 'deletelogentry';
64  }
65 
66  public static function getRevdelConstant() {
68  }
69 
70  public static function suggestTarget( $target, array $ids ) {
71  $result = wfGetDB( DB_REPLICA )->select( 'logging',
72  'log_type',
73  [ 'log_id' => $ids ],
74  __METHOD__,
75  [ 'DISTINCT' ]
76  );
77  if ( $result->numRows() == 1 ) {
78  // If there's only one type, the target can be set to include it.
79  return SpecialPage::getTitleFor( 'Log', $result->current()->log_type );
80  }
81 
82  return SpecialPage::getTitleFor( 'Log' );
83  }
84 
89  public function doQuery( $db ) {
90  $ids = array_map( 'intval', $this->ids );
91 
92  $commentQuery = $this->commentStore->getJoin( 'log_comment' );
93 
94  return $db->select(
95  [ 'logging', 'actor' ] + $commentQuery['tables'],
96  [
97  'log_id',
98  'log_type',
99  'log_action',
100  'log_timestamp',
101  'log_actor',
102  'log_namespace',
103  'log_title',
104  'log_page',
105  'log_params',
106  'log_deleted',
107  'log_user' => 'actor_user',
108  'log_user_text' => 'actor_name'
109  ] + $commentQuery['fields'],
110  [ 'log_id' => $ids ],
111  __METHOD__,
112  [ 'ORDER BY' => 'log_id DESC' ],
113  [
114  'actor' => [ 'JOIN', 'actor_id=log_actor' ]
115  ] + $commentQuery['joins']
116  );
117  }
118 
119  public function newItem( $row ) {
120  return new RevDelLogItem( $this, $row, $this->commentStore );
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
Page\PageIdentity
Interface for objects (potentially) representing an editable wiki page.
Definition: PageIdentity.php:64
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:39
MediaWiki\Revision\RevisionRecord
Page revision base class.
Definition: RevisionRecord.php:47
RevDelLogList
List for logging table items.
Definition: RevDelLogList.php:30
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
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:2225
RevDelLogList\getType
getType()
Get the internal type name of this list.
Definition: RevDelLogList.php:54
RevDelList\$lbFactory
LBFactory $lbFactory
Definition: RevDelList.php:40
RevDelList
Definition: RevDelList.php:37
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:66
LogPage\DELETED_ACTION
const DELETED_ACTION
Definition: LogPage.php:39
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\getRestriction
static getRestriction()
Get the user right required for this list type Override this function.
Definition: RevDelLogList.php:62
RevisionListBase\$ids
int[] null $ids
Definition: RevisionListBase.php:37
RevDelLogList\suggestTarget
static suggestTarget( $target, array $ids)
Suggest a target for the revision deletion Optionally override this function.
Definition: RevDelLogList.php:70
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:58
RevDelLogList\$commentStore
CommentStore $commentStore
Definition: RevDelLogList.php:33
RevDelLogList\__construct
__construct(IContextSource $context, PageIdentity $page, array $ids, LBFactory $lbFactory, CommentStore $commentStore)
Definition: RevDelLogList.php:43
Wikimedia\Rdbms\LBFactory
An interface for generating database load balancers.
Definition: LBFactory.php:42
RevDelLogList\doQuery
doQuery( $db)
Definition: RevDelLogList.php:89
RevDelLogList\getRelationType
static getRelationType()
Get the DB field name associated with the ID list.
Definition: RevDelLogList.php:58
RevDelLogItem
Item class for a logging table row.
Definition: RevDelLogItem.php:27