mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-12-01 00:56:26 +00:00
4ab12305f1
We JOIN integer and text, so Postgres would always fail on these. As mentioned in the task description, this is only a temporary solution (although a clean and durable one), while the long-term one is I7460a2d63f60c2933b36f8383a8abdbba8649e12. Bug: T42757 Change-Id: Ifddd0bca1e8eaa7c70511fb0d0588457b4fd0669
89 lines
1.6 KiB
PHP
89 lines
1.6 KiB
PHP
<?php
|
|
|
|
use Wikimedia\Rdbms\IResultWrapper;
|
|
|
|
class AbuseLogPager extends ReverseChronologicalPager {
|
|
/**
|
|
* @var SpecialAbuseLog
|
|
*/
|
|
public $mForm;
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
public $mConds;
|
|
|
|
/**
|
|
* @param SpecialAbuseLog $form
|
|
* @param array $conds
|
|
*/
|
|
public function __construct( SpecialAbuseLog $form, $conds = [] ) {
|
|
$this->mForm = $form;
|
|
$this->mConds = $conds;
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* @param object $row
|
|
* @return string
|
|
*/
|
|
public function formatRow( $row ) {
|
|
return $this->mForm->formatRow( $row );
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function getQueryInfo() {
|
|
$conds = $this->mConds;
|
|
|
|
$info = [
|
|
'tables' => [ 'abuse_filter_log', 'abuse_filter' ],
|
|
'fields' => '*',
|
|
'conds' => $conds,
|
|
'join_conds' =>
|
|
[ 'abuse_filter' =>
|
|
[
|
|
'LEFT JOIN',
|
|
$this->mDb->buildStringCast( 'af_id' ) . '=afl_filter',
|
|
],
|
|
],
|
|
];
|
|
|
|
if ( !$this->mForm->canSeeHidden() ) {
|
|
$info['conds']['afl_deleted'] = 0;
|
|
}
|
|
|
|
return $info;
|
|
}
|
|
|
|
/**
|
|
* @param IResultWrapper $result
|
|
*/
|
|
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 );
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getIndexField() {
|
|
return 'afl_timestamp';
|
|
}
|
|
}
|