2017-12-16 00:26:25 +00:00
|
|
|
<?php
|
|
|
|
|
2018-04-29 17:52:45 +00:00
|
|
|
use Wikimedia\Rdbms\IResultWrapper;
|
2018-04-05 14:11:01 +00:00
|
|
|
|
2017-12-16 00:26:25 +00:00
|
|
|
class AbuseLogPager extends ReverseChronologicalPager {
|
|
|
|
/**
|
|
|
|
* @var SpecialAbuseLog
|
|
|
|
*/
|
|
|
|
public $mForm;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
public $mConds;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param SpecialAbuseLog $form
|
|
|
|
* @param array $conds
|
|
|
|
*/
|
2018-10-17 05:15:21 +00:00
|
|
|
public function __construct( SpecialAbuseLog $form, $conds = [] ) {
|
2017-12-16 00:26:25 +00:00
|
|
|
$this->mForm = $form;
|
|
|
|
$this->mConds = $conds;
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* @param object $row
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function formatRow( $row ) {
|
2017-12-16 00:26:25 +00:00
|
|
|
return $this->mForm->formatRow( $row );
|
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getQueryInfo() {
|
2017-12-16 00:26:25 +00:00
|
|
|
$conds = $this->mConds;
|
|
|
|
|
|
|
|
$info = [
|
|
|
|
'tables' => [ 'abuse_filter_log', 'abuse_filter' ],
|
|
|
|
'fields' => '*',
|
|
|
|
'conds' => $conds,
|
|
|
|
'join_conds' =>
|
|
|
|
[ 'abuse_filter' =>
|
|
|
|
[
|
|
|
|
'LEFT JOIN',
|
2019-04-18 11:50:32 +00:00
|
|
|
'af_id=afl_filter',
|
2017-12-16 00:26:25 +00:00
|
|
|
],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
2019-08-27 09:40:01 +00:00
|
|
|
if ( !$this->mForm->canSeeHidden( $this->getUser() ) ) {
|
2019-02-09 10:17:09 +00:00
|
|
|
$info['conds']['afl_deleted'] = 0;
|
2017-12-16 00:26:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $info;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-04-29 17:52:45 +00:00
|
|
|
* @param IResultWrapper $result
|
2017-12-16 00:26:25 +00:00
|
|
|
*/
|
|
|
|
protected function preprocessResults( $result ) {
|
|
|
|
if ( $this->getNumRows() === 0 ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$lb = new LinkBatch();
|
|
|
|
$lb->setCaller( __METHOD__ );
|
|
|
|
foreach ( $result as $row ) {
|
|
|
|
// Only for local wiki results
|
|
|
|
if ( !$row->afl_wiki ) {
|
|
|
|
$lb->add( $row->afl_namespace, $row->afl_title );
|
|
|
|
$lb->add( NS_USER, $row->afl_user );
|
|
|
|
$lb->add( NS_USER_TALK, $row->afl_user_text );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$lb->execute();
|
|
|
|
$result->seek( 0 );
|
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getIndexField() {
|
2017-12-16 00:26:25 +00:00
|
|
|
return 'afl_timestamp';
|
|
|
|
}
|
|
|
|
}
|