2017-12-16 00:26:25 +00:00
|
|
|
<?php
|
|
|
|
|
2020-12-03 14:11:19 +00:00
|
|
|
namespace MediaWiki\Extension\AbuseFilter\Pager;
|
|
|
|
|
2020-12-07 13:56:16 +00:00
|
|
|
use HtmlArmor;
|
|
|
|
use IContextSource;
|
|
|
|
use Linker;
|
2020-08-07 21:48:47 +00:00
|
|
|
use MediaWiki\Cache\LinkBatchFactory;
|
2020-12-07 13:56:16 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\AbuseFilterPermissionManager;
|
2020-09-18 14:49:13 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\AbuseFilterServices;
|
2020-12-07 13:56:16 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\CentralDBNotAvailableException;
|
2020-12-02 22:47:40 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\GlobalNameUtils;
|
2021-01-01 17:28:36 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Special\SpecialAbuseLog;
|
2020-12-07 13:56:16 +00:00
|
|
|
use MediaWiki\Linker\LinkRenderer;
|
|
|
|
use MediaWiki\Linker\LinkTarget;
|
|
|
|
use MediaWiki\Permissions\PermissionManager;
|
2020-12-03 14:11:19 +00:00
|
|
|
use ReverseChronologicalPager;
|
2020-12-07 13:56:16 +00:00
|
|
|
use Sanitizer;
|
|
|
|
use SpecialPage;
|
2020-12-03 14:11:19 +00:00
|
|
|
use stdClass;
|
2020-12-07 13:56:16 +00:00
|
|
|
use Title;
|
|
|
|
use WikiMap;
|
2018-04-29 17:52:45 +00:00
|
|
|
use Wikimedia\Rdbms\IResultWrapper;
|
2020-12-07 13:56:16 +00:00
|
|
|
use Xml;
|
2018-04-05 14:11:01 +00:00
|
|
|
|
2017-12-16 00:26:25 +00:00
|
|
|
class AbuseLogPager extends ReverseChronologicalPager {
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
public $mConds;
|
|
|
|
|
2020-08-07 21:48:47 +00:00
|
|
|
/** @var LinkBatchFactory */
|
|
|
|
private $linkBatchFactory;
|
|
|
|
|
2020-12-07 13:56:16 +00:00
|
|
|
/** @var PermissionManager */
|
|
|
|
private $permissionManager;
|
|
|
|
|
|
|
|
/** @var AbuseFilterPermissionManager */
|
|
|
|
private $afPermissionManager;
|
|
|
|
|
|
|
|
/** @var string */
|
|
|
|
private $basePageName;
|
2018-03-11 14:30:33 +00:00
|
|
|
|
2018-10-16 19:58:22 +00:00
|
|
|
/**
|
|
|
|
* @var string[] Map of [ id => show|hide ], for entries that we're currently (un)hiding
|
|
|
|
*/
|
|
|
|
private $hideEntries;
|
|
|
|
|
2017-12-16 00:26:25 +00:00
|
|
|
/**
|
2020-12-07 13:56:16 +00:00
|
|
|
* @param IContextSource $context
|
|
|
|
* @param LinkRenderer $linkRenderer
|
2017-12-16 00:26:25 +00:00
|
|
|
* @param array $conds
|
2020-08-07 21:48:47 +00:00
|
|
|
* @param LinkBatchFactory $linkBatchFactory
|
2020-12-07 13:56:16 +00:00
|
|
|
* @param PermissionManager $permManager
|
|
|
|
* @param AbuseFilterPermissionManager $afPermissionManager
|
|
|
|
* @param string $basePageName
|
2018-10-16 19:58:22 +00:00
|
|
|
* @param string[] $hideEntries
|
2017-12-16 00:26:25 +00:00
|
|
|
*/
|
2018-03-11 14:30:33 +00:00
|
|
|
public function __construct(
|
2020-12-07 13:56:16 +00:00
|
|
|
IContextSource $context,
|
|
|
|
LinkRenderer $linkRenderer,
|
2018-03-11 14:30:33 +00:00
|
|
|
array $conds,
|
|
|
|
LinkBatchFactory $linkBatchFactory,
|
2020-12-07 13:56:16 +00:00
|
|
|
PermissionManager $permManager,
|
|
|
|
AbuseFilterPermissionManager $afPermissionManager,
|
2018-10-16 19:58:22 +00:00
|
|
|
string $basePageName,
|
|
|
|
array $hideEntries = []
|
2018-03-11 14:30:33 +00:00
|
|
|
) {
|
2020-12-07 13:56:16 +00:00
|
|
|
parent::__construct( $context, $linkRenderer );
|
2017-12-16 00:26:25 +00:00
|
|
|
$this->mConds = $conds;
|
2020-08-07 21:48:47 +00:00
|
|
|
$this->linkBatchFactory = $linkBatchFactory;
|
2020-12-07 13:56:16 +00:00
|
|
|
$this->permissionManager = $permManager;
|
|
|
|
$this->afPermissionManager = $afPermissionManager;
|
|
|
|
$this->basePageName = $basePageName;
|
2018-10-16 19:58:22 +00:00
|
|
|
$this->hideEntries = $hideEntries;
|
2017-12-16 00:26:25 +00:00
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
2020-10-29 00:44:48 +00:00
|
|
|
* @param stdClass $row
|
2018-04-04 21:14:25 +00:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function formatRow( $row ) {
|
2020-12-07 13:56:16 +00:00
|
|
|
return $this->doFormatRow( $row );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param stdClass $row
|
|
|
|
* @param bool $isListItem
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function doFormatRow( stdClass $row, bool $isListItem = true ) : string {
|
|
|
|
$aflFilterMigrationStage = $this->getConfig()->get( 'AbuseFilterAflFilterMigrationStage' );
|
|
|
|
$user = $this->getUser();
|
|
|
|
$lang = $this->getLanguage();
|
|
|
|
|
|
|
|
$title = Title::makeTitle( $row->afl_namespace, $row->afl_title );
|
|
|
|
|
|
|
|
$diffLink = false;
|
|
|
|
$isHidden = SpecialAbuseLog::isHidden( $row );
|
|
|
|
|
|
|
|
// @todo T224203 Try to show the details if the revision is deleted but the AbuseLog entry
|
|
|
|
// is not. However, watch out to avoid showing too much stuff.
|
|
|
|
if ( !$this->afPermissionManager->canSeeHiddenLogEntries( $user ) && $isHidden ) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
$linkRenderer = $this->getLinkRenderer();
|
|
|
|
|
|
|
|
if ( !$row->afl_wiki ) {
|
|
|
|
$pageLink = $linkRenderer->makeLink(
|
|
|
|
$title,
|
|
|
|
null,
|
|
|
|
[],
|
|
|
|
[ 'redirect' => 'no' ]
|
|
|
|
);
|
|
|
|
if ( $row->rev_id ) {
|
|
|
|
$diffLink = $linkRenderer->makeKnownLink(
|
|
|
|
$title,
|
|
|
|
new HtmlArmor( $this->msg( 'abusefilter-log-diff' )->parse() ),
|
|
|
|
[],
|
|
|
|
[ 'diff' => 'prev', 'oldid' => $row->rev_id ]
|
|
|
|
);
|
|
|
|
} elseif (
|
|
|
|
isset( $row->ar_timestamp ) && $row->ar_timestamp
|
|
|
|
&& $this->canSeeUndeleteDiffForPage( $title )
|
|
|
|
) {
|
|
|
|
$diffLink = $linkRenderer->makeKnownLink(
|
|
|
|
SpecialPage::getTitleFor( 'Undelete' ),
|
|
|
|
new HtmlArmor( $this->msg( 'abusefilter-log-diff' )->parse() ),
|
|
|
|
[],
|
|
|
|
[
|
|
|
|
'diff' => 'prev',
|
|
|
|
'target' => $title->getPrefixedText(),
|
|
|
|
'timestamp' => $row->ar_timestamp,
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$pageLink = WikiMap::makeForeignLink( $row->afl_wiki, $row->afl_title );
|
|
|
|
|
|
|
|
if ( $row->afl_rev_id ) {
|
|
|
|
$diffUrl = WikiMap::getForeignURL( $row->afl_wiki, $row->afl_title );
|
|
|
|
$diffUrl = wfAppendQuery( $diffUrl,
|
|
|
|
[ 'diff' => 'prev', 'oldid' => $row->afl_rev_id ] );
|
|
|
|
|
|
|
|
$diffLink = Linker::makeExternalLink( $diffUrl,
|
|
|
|
$this->msg( 'abusefilter-log-diff' )->text() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !$row->afl_wiki ) {
|
|
|
|
// Local user
|
|
|
|
$userLink = SpecialAbuseLog::getUserLinks( $row->afl_user, $row->afl_user_text );
|
|
|
|
} else {
|
|
|
|
$userLink = WikiMap::foreignUserLink( $row->afl_wiki, $row->afl_user_text );
|
|
|
|
$userLink .= ' (' . WikiMap::getWikiName( $row->afl_wiki ) . ')';
|
|
|
|
}
|
|
|
|
|
|
|
|
$timestamp = htmlspecialchars( $lang->timeanddate( $row->afl_timestamp, true ) );
|
|
|
|
|
|
|
|
$actions_takenRaw = $row->afl_actions;
|
|
|
|
if ( !strlen( trim( $actions_takenRaw ) ) ) {
|
|
|
|
$actions_taken = $this->msg( 'abusefilter-log-noactions' )->escaped();
|
|
|
|
} else {
|
|
|
|
$actions = explode( ',', $actions_takenRaw );
|
|
|
|
$displayActions = [];
|
|
|
|
|
2020-10-02 15:08:48 +00:00
|
|
|
$specsFormatter = AbuseFilterServices::getSpecsFormatter();
|
|
|
|
$specsFormatter->setMessageLocalizer( $this->getContext() );
|
2020-12-07 13:56:16 +00:00
|
|
|
foreach ( $actions as $action ) {
|
2020-10-02 15:08:48 +00:00
|
|
|
$displayActions[] = $specsFormatter->getActionDisplay( $action );
|
2020-12-07 13:56:16 +00:00
|
|
|
}
|
|
|
|
$actions_taken = $lang->commaList( $displayActions );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $aflFilterMigrationStage & SCHEMA_COMPAT_READ_NEW ) {
|
|
|
|
$filterID = $row->afl_filter_id;
|
|
|
|
$global = $row->afl_global;
|
|
|
|
} else {
|
|
|
|
// SCHEMA_COMPAT_READ_OLD
|
2020-12-02 22:47:40 +00:00
|
|
|
list( $filterID, $global ) = GlobalNameUtils::splitGlobalName( $row->afl_filter );
|
2020-12-07 13:56:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( $global ) {
|
|
|
|
// Pull global filter description
|
|
|
|
$lookup = AbuseFilterServices::getFilterLookup();
|
|
|
|
try {
|
|
|
|
$filterObj = $lookup->getFilter( $filterID, true );
|
|
|
|
$globalDesc = $filterObj->getName();
|
|
|
|
$escaped_comments = Sanitizer::escapeHtmlAllowEntities( $globalDesc );
|
|
|
|
$filter_hidden = $filterObj->isHidden();
|
|
|
|
} catch ( CentralDBNotAvailableException $_ ) {
|
|
|
|
$escaped_comments = $this->msg( 'abusefilter-log-description-not-available' )->escaped();
|
|
|
|
// either hide all filters, including not hidden, or show all, including hidden
|
|
|
|
// we choose the former
|
|
|
|
$filter_hidden = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$escaped_comments = Sanitizer::escapeHtmlAllowEntities(
|
|
|
|
$row->af_public_comments );
|
|
|
|
$filter_hidden = $row->af_hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $this->afPermissionManager->canSeeLogDetailsForFilter( $user, $filter_hidden ) ) {
|
|
|
|
$actionLinks = [];
|
|
|
|
|
|
|
|
if ( $isListItem ) {
|
|
|
|
$detailsLink = $linkRenderer->makeKnownLink(
|
|
|
|
SpecialPage::getTitleFor( $this->basePageName, $row->afl_id ),
|
|
|
|
$this->msg( 'abusefilter-log-detailslink' )->text()
|
|
|
|
);
|
|
|
|
$actionLinks[] = $detailsLink;
|
|
|
|
}
|
|
|
|
|
|
|
|
$examineTitle = SpecialPage::getTitleFor( 'AbuseFilter', 'examine/log/' . $row->afl_id );
|
|
|
|
$examineLink = $linkRenderer->makeKnownLink(
|
|
|
|
$examineTitle,
|
|
|
|
new HtmlArmor( $this->msg( 'abusefilter-changeslist-examine' )->parse() )
|
|
|
|
);
|
|
|
|
$actionLinks[] = $examineLink;
|
|
|
|
|
|
|
|
if ( $diffLink ) {
|
|
|
|
$actionLinks[] = $diffLink;
|
|
|
|
}
|
|
|
|
|
2021-01-11 11:29:10 +00:00
|
|
|
if ( !$isListItem && $this->afPermissionManager->canHideAbuseLog( $user ) ) {
|
|
|
|
// Link for hiding a single entry from the details view
|
|
|
|
$hideLink = $linkRenderer->makeKnownLink(
|
|
|
|
SpecialPage::getTitleFor( $this->basePageName, 'hide' ),
|
|
|
|
$this->msg( 'abusefilter-log-hidelink' )->text(),
|
|
|
|
[],
|
|
|
|
[ "hideids[$row->afl_id]" => 1 ]
|
|
|
|
);
|
|
|
|
|
|
|
|
$actionLinks[] = $hideLink;
|
|
|
|
}
|
|
|
|
|
2020-12-07 13:56:16 +00:00
|
|
|
if ( $global ) {
|
|
|
|
$centralDb = $this->getConfig()->get( 'AbuseFilterCentralDB' );
|
|
|
|
$linkMsg = $this->msg( 'abusefilter-log-detailedentry-global' )
|
|
|
|
->numParams( $filterID );
|
|
|
|
if ( $centralDb !== null ) {
|
|
|
|
$globalURL = WikiMap::getForeignURL(
|
|
|
|
$centralDb,
|
|
|
|
'Special:AbuseFilter/' . $filterID
|
|
|
|
);
|
|
|
|
$filterLink = Linker::makeExternalLink( $globalURL, $linkMsg->text() );
|
|
|
|
} else {
|
|
|
|
$filterLink = $linkMsg->escaped();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$title = SpecialPage::getTitleFor( 'AbuseFilter', (string)$filterID );
|
|
|
|
$linkText = $this->msg( 'abusefilter-log-detailedentry-local' )
|
|
|
|
->numParams( $filterID )->text();
|
|
|
|
$filterLink = $linkRenderer->makeKnownLink( $title, $linkText );
|
|
|
|
}
|
|
|
|
$description = $this->msg( 'abusefilter-log-detailedentry-meta' )->rawParams(
|
|
|
|
$timestamp,
|
|
|
|
$userLink,
|
|
|
|
$filterLink,
|
|
|
|
htmlspecialchars( $row->afl_action ),
|
|
|
|
$pageLink,
|
|
|
|
$actions_taken,
|
|
|
|
$escaped_comments,
|
|
|
|
$lang->pipeList( $actionLinks )
|
|
|
|
)->params( $row->afl_user_text )->parse();
|
|
|
|
} else {
|
|
|
|
if ( $diffLink ) {
|
|
|
|
$msg = 'abusefilter-log-entry-withdiff';
|
|
|
|
} else {
|
|
|
|
$msg = 'abusefilter-log-entry';
|
|
|
|
}
|
|
|
|
$description = $this->msg( $msg )->rawParams(
|
|
|
|
$timestamp,
|
|
|
|
$userLink,
|
|
|
|
htmlspecialchars( $row->afl_action ),
|
|
|
|
$pageLink,
|
|
|
|
$actions_taken,
|
|
|
|
$escaped_comments,
|
|
|
|
// Passing $7 to 'abusefilter-log-entry' will do nothing, as it's not used.
|
|
|
|
$diffLink
|
|
|
|
)->params( $row->afl_user_text )->parse();
|
|
|
|
}
|
|
|
|
|
|
|
|
$attribs = null;
|
2018-10-16 19:58:22 +00:00
|
|
|
if (
|
|
|
|
$this->isHidingEntry( $row ) === true ||
|
|
|
|
// If isHidingEntry is false, we've just unhidden the row
|
|
|
|
( $this->isHidingEntry( $row ) === null && $isHidden === true )
|
|
|
|
) {
|
2020-12-07 13:56:16 +00:00
|
|
|
$attribs = [ 'class' => 'mw-abusefilter-log-hidden-entry' ];
|
2018-10-16 19:58:22 +00:00
|
|
|
}
|
|
|
|
if ( $isHidden === 'implicit' ) {
|
2020-12-07 13:56:16 +00:00
|
|
|
$description .= ' ' .
|
|
|
|
$this->msg( 'abusefilter-log-hidden-implicit' )->parse();
|
|
|
|
}
|
|
|
|
|
2021-01-07 16:24:33 +00:00
|
|
|
if ( $isListItem && !$this->hideEntries && $this->afPermissionManager->canHideAbuseLog( $user ) ) {
|
2021-01-11 11:29:10 +00:00
|
|
|
// Checkbox for hiding multiple entries, single entries are handled above
|
2018-10-16 19:58:22 +00:00
|
|
|
$description = Xml::check( 'hideids[' . $row->afl_id . ']' ) . $description;
|
|
|
|
}
|
|
|
|
|
2020-12-07 13:56:16 +00:00
|
|
|
if ( $isListItem ) {
|
|
|
|
return Xml::tags( 'li', $attribs, $description );
|
|
|
|
} else {
|
|
|
|
return Xml::tags( 'span', $attribs, $description );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Can this user see diffs generated by Special:Undelete for the page?
|
|
|
|
* @see \SpecialUndelete
|
|
|
|
* @param LinkTarget $page
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
private function canSeeUndeleteDiffForPage( LinkTarget $page ) : bool {
|
|
|
|
if ( !$this->canSeeUndeleteDiffs() ) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ( [ 'deletedtext', 'undelete' ] as $action ) {
|
|
|
|
if ( $this->permissionManager->userCan(
|
|
|
|
$action, $this->getUser(), $page, PermissionManager::RIGOR_QUICK
|
|
|
|
) ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Can this user see diffs generated by Special:Undelete?
|
|
|
|
* @see \SpecialUndelete
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
private function canSeeUndeleteDiffs() : bool {
|
|
|
|
if ( !$this->permissionManager->userHasRight( $this->getUser(), 'deletedhistory' ) ) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->permissionManager->userHasAnyRight(
|
|
|
|
$this->getUser(), 'deletedtext', 'undelete' );
|
2017-12-16 00:26:25 +00:00
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getQueryInfo() {
|
2020-09-18 14:49:13 +00:00
|
|
|
$afPermManager = AbuseFilterServices::getPermissionManager();
|
2018-09-11 16:57:49 +00:00
|
|
|
$aflFilterMigrationStage = $this->getConfig()->get( 'AbuseFilterAflFilterMigrationStage' );
|
|
|
|
|
2017-12-16 00:26:25 +00:00
|
|
|
$conds = $this->mConds;
|
|
|
|
|
2018-09-11 16:57:49 +00:00
|
|
|
if ( $aflFilterMigrationStage & SCHEMA_COMPAT_READ_NEW ) {
|
|
|
|
$join = [ 'af_id=afl_filter_id', 'afl_global' => 0 ];
|
|
|
|
} else {
|
|
|
|
// SCHEMA_COMPAT_READ_OLD
|
|
|
|
$join = 'af_id=afl_filter';
|
|
|
|
}
|
|
|
|
|
2017-12-16 00:26:25 +00:00
|
|
|
$info = [
|
2020-09-16 20:17:12 +00:00
|
|
|
'tables' => [ 'abuse_filter_log', 'abuse_filter', 'revision' ],
|
|
|
|
'fields' => [
|
|
|
|
$this->mDb->tableName( 'abuse_filter_log' ) . '.*',
|
|
|
|
$this->mDb->tableName( 'abuse_filter' ) . '.*',
|
|
|
|
'rev_id',
|
|
|
|
],
|
2017-12-16 00:26:25 +00:00
|
|
|
'conds' => $conds,
|
2020-09-16 20:17:12 +00:00
|
|
|
'join_conds' => [
|
|
|
|
'abuse_filter' => [
|
|
|
|
'LEFT JOIN',
|
2018-09-11 16:57:49 +00:00
|
|
|
$join,
|
2020-09-16 20:17:12 +00:00
|
|
|
],
|
|
|
|
'revision' => [
|
|
|
|
'LEFT JOIN',
|
2017-12-16 00:26:25 +00:00
|
|
|
[
|
2020-09-16 20:17:12 +00:00
|
|
|
'afl_wiki IS NULL',
|
|
|
|
'afl_rev_id IS NOT NULL',
|
|
|
|
'rev_id=afl_rev_id',
|
|
|
|
]
|
2017-12-16 00:26:25 +00:00
|
|
|
],
|
2020-09-16 20:17:12 +00:00
|
|
|
],
|
2017-12-16 00:26:25 +00:00
|
|
|
];
|
|
|
|
|
2020-12-07 13:56:16 +00:00
|
|
|
if ( $this->canSeeUndeleteDiffs() ) {
|
2018-03-11 14:30:33 +00:00
|
|
|
$info['tables'][] = 'archive';
|
|
|
|
$info['fields'][] = 'ar_timestamp';
|
|
|
|
$info['join_conds']['archive'] = [
|
|
|
|
'LEFT JOIN',
|
|
|
|
[
|
|
|
|
'afl_wiki IS NULL',
|
|
|
|
'afl_rev_id IS NOT NULL',
|
|
|
|
'rev_id IS NULL',
|
|
|
|
'ar_rev_id=afl_rev_id',
|
|
|
|
]
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2020-09-18 14:49:13 +00:00
|
|
|
if ( !$afPermManager->canSeeHiddenLogEntries( $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;
|
|
|
|
}
|
|
|
|
|
2020-08-07 21:48:47 +00:00
|
|
|
$lb = $this->linkBatchFactory->newLinkBatch();
|
2017-12-16 00:26:25 +00:00
|
|
|
$lb->setCaller( __METHOD__ );
|
|
|
|
foreach ( $result as $row ) {
|
|
|
|
// Only for local wiki results
|
|
|
|
if ( !$row->afl_wiki ) {
|
|
|
|
$lb->add( $row->afl_namespace, $row->afl_title );
|
2020-12-03 14:11:19 +00:00
|
|
|
$lb->add( NS_USER, $row->afl_user );
|
2017-12-16 00:26:25 +00:00
|
|
|
$lb->add( NS_USER_TALK, $row->afl_user_text );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$lb->execute();
|
|
|
|
$result->seek( 0 );
|
|
|
|
}
|
|
|
|
|
2018-10-16 19:58:22 +00:00
|
|
|
/**
|
|
|
|
* Check whether the entry passed in is being currently hidden/unhidden.
|
|
|
|
* This is used to format the entries list shown when updating visibility, and is necessary because
|
|
|
|
* when we decide whether to display the entry as hidden the DB hasn't been updated yet.
|
|
|
|
*
|
|
|
|
* @param stdClass $row
|
|
|
|
* @return bool|null True if just hidden, false if just unhidden, null if untouched
|
|
|
|
*/
|
|
|
|
private function isHidingEntry( stdClass $row ) : ?bool {
|
|
|
|
if ( isset( $this->hideEntries[ $row->afl_id ] ) ) {
|
|
|
|
return $this->hideEntries[ $row->afl_id ] === 'hide';
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getIndexField() {
|
2017-12-16 00:26:25 +00:00
|
|
|
return 'afl_timestamp';
|
|
|
|
}
|
|
|
|
}
|