mediawiki-extensions-AbuseF.../includes/pagers/AbuseFilterExaminePager.php
Brad Jorsch 3014871cb5 Update for the actor table change
Core change I8d825eb0 begins the process of changing core database
tables from using xx_user and xx_user_text fields to using xx_actor.
This updates the extension to continue to function during and after the
transition.

Bug: T167246
Change-Id: I4065716022aa60c0fa1a258659db22be2b7f43de
2018-03-09 16:34:24 -05:00

70 lines
1.7 KiB
PHP

<?php
class AbuseFilterExaminePager extends ReverseChronologicalPager {
/**
* @param AbuseFilterViewExamine $page
* @param AbuseFilterChangesList $changesList
*/
function __construct( $page, $changesList ) {
parent::__construct();
$this->mChangesList = $changesList;
$this->mPage = $page;
}
/**
* @fixme this is similar to AbuseFilterViewTestBatch::doTest
* @return array
*/
function getQueryInfo() {
$dbr = wfGetDB( DB_REPLICA );
$conds = [];
if ( (string)$this->mPage->mSearchUser !== '' ) {
$conds[] = ActorMigration::newMigration()->getWhere(
$dbr, 'rc_user', User::newFromName( $this->mPage->mSearchUser, false )
)['conds'];
}
$startTS = strtotime( $this->mPage->mSearchPeriodStart );
if ( $startTS ) {
$conds[] = 'rc_timestamp>=' . $dbr->addQuotes( $dbr->timestamp( $startTS ) );
}
$endTS = strtotime( $this->mPage->mSearchPeriodEnd );
if ( $endTS ) {
$conds[] = 'rc_timestamp<=' . $dbr->addQuotes( $dbr->timestamp( $endTS ) );
}
$conds[] = $this->mPage->buildTestConditions( $dbr );
$rcQuery = RecentChange::getQueryInfo();
$info = [
'tables' => $rcQuery['tables'],
'fields' => $rcQuery['fields'],
'conds' => array_filter( $conds ),
'options' => [ 'ORDER BY' => 'rc_timestamp DESC' ],
'join_conds' => $rcQuery['joins'],
];
return $info;
}
function formatRow( $row ) {
# Incompatible stuff.
$rc = RecentChange::newFromRow( $row );
$rc->counter = $this->mPage->mCounter++;
return $this->mChangesList->recentChangesLine( $rc, false );
}
function getIndexField() {
return 'rc_id';
}
function getTitle() {
return $this->mPage->getTitle( 'examine' );
}
function getEmptyBody() {
return $this->msg( 'abusefilter-examine-noresults' )->parseAsBlock();
}
}