2017-12-16 00:26:25 +00:00
|
|
|
<?php
|
|
|
|
|
2020-12-03 14:11:19 +00:00
|
|
|
namespace MediaWiki\Extension\AbuseFilter\Pager;
|
|
|
|
|
|
|
|
use FakeResultWrapper;
|
|
|
|
use Linker;
|
|
|
|
use LogicException;
|
2021-04-17 16:57:38 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\AbuseFilterPermissionManager;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\SpecsFormatter;
|
2020-11-29 10:53:29 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\View\AbuseFilterViewList;
|
2018-04-29 17:52:45 +00:00
|
|
|
use MediaWiki\Linker\LinkRenderer;
|
2020-12-03 14:11:19 +00:00
|
|
|
use MWException;
|
|
|
|
use SpecialPage;
|
|
|
|
use stdClass;
|
|
|
|
use TablePager;
|
2020-01-08 13:33:10 +00:00
|
|
|
use Wikimedia\AtEase\AtEase;
|
2018-04-29 17:52:45 +00:00
|
|
|
|
2017-12-16 00:26:25 +00:00
|
|
|
/**
|
|
|
|
* Class to build paginated filter list
|
|
|
|
*/
|
|
|
|
class AbuseFilterPager extends TablePager {
|
|
|
|
|
2021-04-17 16:57:38 +00:00
|
|
|
/** @var AbuseFilterPermissionManager */
|
|
|
|
protected $afPermManager;
|
|
|
|
|
|
|
|
/** @var SpecsFormatter */
|
|
|
|
protected $specsFormatter;
|
|
|
|
|
2018-11-08 14:34:32 +00:00
|
|
|
/**
|
|
|
|
* @var AbuseFilterViewList The associated page
|
|
|
|
*/
|
2021-04-17 16:57:38 +00:00
|
|
|
protected $mPage;
|
2018-11-08 14:34:32 +00:00
|
|
|
/**
|
|
|
|
* @var array Query WHERE conditions
|
|
|
|
*/
|
2021-04-17 16:57:38 +00:00
|
|
|
protected $conds;
|
2018-11-08 14:34:32 +00:00
|
|
|
/**
|
2020-10-01 11:31:04 +00:00
|
|
|
* @var string|null The pattern being searched
|
2018-11-08 14:34:32 +00:00
|
|
|
*/
|
2021-04-17 16:57:38 +00:00
|
|
|
private $searchPattern;
|
2019-10-30 12:36:19 +00:00
|
|
|
/**
|
2020-10-01 11:31:04 +00:00
|
|
|
* @var string|null The pattern search mode (LIKE, RLIKE or IRLIKE)
|
2019-10-30 12:36:19 +00:00
|
|
|
*/
|
2021-04-17 16:57:38 +00:00
|
|
|
private $searchMode;
|
2018-04-29 17:52:45 +00:00
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* @param AbuseFilterViewList $page
|
|
|
|
* @param LinkRenderer $linkRenderer
|
2021-04-17 16:57:38 +00:00
|
|
|
* @param AbuseFilterPermissionManager $afPermManager
|
|
|
|
* @param SpecsFormatter $specsFormatter
|
|
|
|
* @param array $conds
|
2020-10-01 11:31:04 +00:00
|
|
|
* @param ?string $searchPattern Null if no pattern was specified
|
|
|
|
* @param ?string $searchMode
|
2018-04-04 21:14:25 +00:00
|
|
|
*/
|
2019-10-30 12:36:19 +00:00
|
|
|
public function __construct(
|
|
|
|
AbuseFilterViewList $page,
|
|
|
|
LinkRenderer $linkRenderer,
|
2021-04-17 16:57:38 +00:00
|
|
|
AbuseFilterPermissionManager $afPermManager,
|
|
|
|
SpecsFormatter $specsFormatter,
|
|
|
|
array $conds,
|
2020-10-01 11:31:04 +00:00
|
|
|
?string $searchPattern,
|
|
|
|
?string $searchMode
|
2019-10-30 12:36:19 +00:00
|
|
|
) {
|
2021-04-17 16:57:38 +00:00
|
|
|
// needed by parent's constructor call
|
|
|
|
$this->afPermManager = $afPermManager;
|
|
|
|
$this->specsFormatter = $specsFormatter;
|
2020-10-01 11:31:04 +00:00
|
|
|
parent::__construct( $page->getContext(), $linkRenderer );
|
2017-12-16 00:26:25 +00:00
|
|
|
$this->mPage = $page;
|
2021-04-17 16:57:38 +00:00
|
|
|
$this->conds = $conds;
|
|
|
|
$this->searchPattern = $searchPattern;
|
|
|
|
$this->searchMode = $searchMode;
|
2017-12-16 00:26:25 +00:00
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getQueryInfo() {
|
2017-12-16 00:26:25 +00:00
|
|
|
return [
|
|
|
|
'tables' => [ 'abuse_filter' ],
|
|
|
|
'fields' => [
|
2018-05-03 18:32:03 +00:00
|
|
|
// All columns but af_comments
|
2017-12-16 00:26:25 +00:00
|
|
|
'af_id',
|
|
|
|
'af_enabled',
|
|
|
|
'af_deleted',
|
2018-02-17 14:09:36 +00:00
|
|
|
'af_pattern',
|
2017-12-16 00:26:25 +00:00
|
|
|
'af_global',
|
|
|
|
'af_public_comments',
|
|
|
|
'af_hidden',
|
|
|
|
'af_hit_count',
|
|
|
|
'af_timestamp',
|
|
|
|
'af_user_text',
|
|
|
|
'af_user',
|
|
|
|
'af_actions',
|
|
|
|
'af_group',
|
2018-05-03 18:32:03 +00:00
|
|
|
'af_throttled'
|
2017-12-16 00:26:25 +00:00
|
|
|
],
|
2021-04-17 16:57:38 +00:00
|
|
|
'conds' => $this->conds,
|
2017-12-16 00:26:25 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2019-10-30 12:36:19 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
* This is the same as the parent implementation if no search pattern was specified.
|
|
|
|
* Otherwise, it does a query with no limit and then slices the results à la ContribsPager.
|
|
|
|
*/
|
|
|
|
public function reallyDoQuery( $offset, $limit, $order ) {
|
2021-04-17 16:57:38 +00:00
|
|
|
if ( $this->searchMode === null ) {
|
2019-10-30 12:36:19 +00:00
|
|
|
return parent::reallyDoQuery( $offset, $limit, $order );
|
|
|
|
}
|
|
|
|
|
|
|
|
list( $tables, $fields, $conds, $fname, $options, $join_conds ) =
|
|
|
|
$this->buildQueryInfo( $offset, $limit, $order );
|
|
|
|
|
|
|
|
unset( $options['LIMIT'] );
|
|
|
|
$res = $this->mDb->select( $tables, $fields, $conds, $fname, $options, $join_conds );
|
|
|
|
|
|
|
|
$filtered = [];
|
|
|
|
foreach ( $res as $row ) {
|
|
|
|
if ( $this->matchesPattern( $row->af_pattern ) ) {
|
2020-12-03 14:11:19 +00:00
|
|
|
$filtered[$row->af_id] = $row;
|
2019-10-30 12:36:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// sort results and enforce limit like ContribsPager
|
|
|
|
if ( $order === self::QUERY_ASCENDING ) {
|
|
|
|
ksort( $filtered );
|
|
|
|
} else {
|
|
|
|
krsort( $filtered );
|
|
|
|
}
|
|
|
|
$filtered = array_slice( $filtered, 0, $limit );
|
|
|
|
$filtered = array_values( $filtered );
|
|
|
|
return new FakeResultWrapper( $filtered );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether $subject matches the given $pattern.
|
|
|
|
*
|
|
|
|
* @param string $subject
|
|
|
|
* @return bool
|
|
|
|
* @throws LogicException
|
|
|
|
*/
|
|
|
|
private function matchesPattern( $subject ) {
|
2021-04-17 16:57:38 +00:00
|
|
|
$pattern = $this->searchPattern;
|
|
|
|
switch ( $this->searchMode ) {
|
2019-10-30 12:36:19 +00:00
|
|
|
case 'RLIKE':
|
|
|
|
return (bool)preg_match( "/$pattern/u", $subject );
|
|
|
|
case 'IRLIKE':
|
|
|
|
return (bool)preg_match( "/$pattern/ui", $subject );
|
|
|
|
case 'LIKE':
|
|
|
|
return mb_stripos( $subject, $pattern ) !== false;
|
|
|
|
default:
|
2021-04-17 16:57:38 +00:00
|
|
|
throw new LogicException( "Unknown search type {$this->searchMode}" );
|
2019-10-30 12:36:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
2020-10-01 11:31:04 +00:00
|
|
|
* Note: this method is called by parent::__construct
|
2018-04-04 21:14:25 +00:00
|
|
|
* @return array
|
2020-12-03 14:11:19 +00:00
|
|
|
* @see Pager::getFieldNames()
|
2018-04-04 21:14:25 +00:00
|
|
|
*/
|
|
|
|
public function getFieldNames() {
|
2017-12-16 00:26:25 +00:00
|
|
|
$headers = [
|
|
|
|
'af_id' => 'abusefilter-list-id',
|
|
|
|
'af_public_comments' => 'abusefilter-list-public',
|
|
|
|
'af_actions' => 'abusefilter-list-consequences',
|
|
|
|
'af_enabled' => 'abusefilter-list-status',
|
|
|
|
'af_timestamp' => 'abusefilter-list-lastmodified',
|
|
|
|
'af_hidden' => 'abusefilter-list-visibility',
|
|
|
|
];
|
|
|
|
|
2020-09-22 19:11:11 +00:00
|
|
|
$user = $this->getUser();
|
2021-04-17 16:57:38 +00:00
|
|
|
if ( $this->afPermManager->canSeeLogDetails( $user ) ) {
|
2017-12-16 00:26:25 +00:00
|
|
|
$headers['af_hit_count'] = 'abusefilter-list-hitcount';
|
|
|
|
}
|
|
|
|
|
2021-04-17 16:57:38 +00:00
|
|
|
if ( $this->afPermManager->canViewPrivateFilters( $user ) && $this->searchMode !== null ) {
|
2020-10-01 11:31:04 +00:00
|
|
|
// This is also excluded in the default view
|
2018-02-17 14:09:36 +00:00
|
|
|
$headers['af_pattern'] = 'abusefilter-list-pattern';
|
|
|
|
}
|
|
|
|
|
2018-03-10 21:47:33 +00:00
|
|
|
if ( count( $this->getConfig()->get( 'AbuseFilterValidGroups' ) ) > 1 ) {
|
2017-12-16 00:26:25 +00:00
|
|
|
$headers['af_group'] = 'abusefilter-list-group';
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ( $headers as &$msg ) {
|
|
|
|
$msg = $this->msg( $msg )->text();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $headers;
|
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* @param string $name
|
|
|
|
* @param string $value
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function formatValue( $name, $value ) {
|
2017-12-16 00:26:25 +00:00
|
|
|
$lang = $this->getLanguage();
|
2019-08-27 09:40:01 +00:00
|
|
|
$user = $this->getUser();
|
2020-09-22 19:11:11 +00:00
|
|
|
$linkRenderer = $this->getLinkRenderer();
|
2017-12-16 00:26:25 +00:00
|
|
|
$row = $this->mCurrentRow;
|
|
|
|
|
|
|
|
switch ( $name ) {
|
|
|
|
case 'af_id':
|
2020-09-22 19:11:11 +00:00
|
|
|
return $linkRenderer->makeLink(
|
2019-12-07 17:20:10 +00:00
|
|
|
SpecialPage::getTitleFor( 'AbuseFilter', $value ),
|
2017-12-16 00:26:25 +00:00
|
|
|
$lang->formatNum( intval( $value ) )
|
|
|
|
);
|
2018-02-17 14:09:36 +00:00
|
|
|
case 'af_pattern':
|
2019-10-30 12:36:19 +00:00
|
|
|
return $this->getHighlightedPattern( $row );
|
2017-12-16 00:26:25 +00:00
|
|
|
case 'af_public_comments':
|
2020-09-22 19:11:11 +00:00
|
|
|
return $linkRenderer->makeLink(
|
2019-12-07 17:20:10 +00:00
|
|
|
SpecialPage::getTitleFor( 'AbuseFilter', $row->af_id ),
|
2017-12-16 00:26:25 +00:00
|
|
|
$value
|
|
|
|
);
|
|
|
|
case 'af_actions':
|
|
|
|
$actions = explode( ',', $value );
|
|
|
|
$displayActions = [];
|
|
|
|
foreach ( $actions as $action ) {
|
2021-04-17 16:57:38 +00:00
|
|
|
$displayActions[] = $this->specsFormatter->getActionDisplay( $action );
|
2017-12-16 00:26:25 +00:00
|
|
|
}
|
2018-07-04 15:04:05 +00:00
|
|
|
return $lang->commaList( $displayActions );
|
2017-12-16 00:26:25 +00:00
|
|
|
case 'af_enabled':
|
|
|
|
$statuses = [];
|
|
|
|
if ( $row->af_deleted ) {
|
|
|
|
$statuses[] = $this->msg( 'abusefilter-deleted' )->parse();
|
|
|
|
} elseif ( $row->af_enabled ) {
|
|
|
|
$statuses[] = $this->msg( 'abusefilter-enabled' )->parse();
|
2018-05-03 18:32:03 +00:00
|
|
|
if ( $row->af_throttled ) {
|
|
|
|
$statuses[] = $this->msg( 'abusefilter-throttled' )->parse();
|
|
|
|
}
|
2017-12-16 00:26:25 +00:00
|
|
|
} else {
|
|
|
|
$statuses[] = $this->msg( 'abusefilter-disabled' )->parse();
|
|
|
|
}
|
|
|
|
|
2018-03-10 21:47:33 +00:00
|
|
|
if ( $row->af_global && $this->getConfig()->get( 'AbuseFilterIsCentral' ) ) {
|
2017-12-16 00:26:25 +00:00
|
|
|
$statuses[] = $this->msg( 'abusefilter-status-global' )->parse();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $lang->commaList( $statuses );
|
|
|
|
case 'af_hidden':
|
|
|
|
$msg = $value ? 'abusefilter-hidden' : 'abusefilter-unhidden';
|
|
|
|
return $this->msg( $msg )->parse();
|
|
|
|
case 'af_hit_count':
|
2021-04-17 16:57:38 +00:00
|
|
|
if ( $this->afPermManager->canSeeLogDetailsForFilter( $user, $row->af_hidden ) ) {
|
2017-12-16 00:26:25 +00:00
|
|
|
$count_display = $this->msg( 'abusefilter-hitcount' )
|
2018-07-04 15:04:05 +00:00
|
|
|
->numParams( $value )->text();
|
2020-09-22 19:11:11 +00:00
|
|
|
$link = $linkRenderer->makeKnownLink(
|
2017-12-16 00:26:25 +00:00
|
|
|
SpecialPage::getTitleFor( 'AbuseLog' ),
|
|
|
|
$count_display,
|
|
|
|
[],
|
|
|
|
[ 'wpSearchFilter' => $row->af_id ]
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
$link = "";
|
|
|
|
}
|
|
|
|
return $link;
|
|
|
|
case 'af_timestamp':
|
|
|
|
$userLink =
|
|
|
|
Linker::userLink(
|
|
|
|
$row->af_user,
|
|
|
|
$row->af_user_text
|
|
|
|
) .
|
|
|
|
Linker::userToolLinks(
|
|
|
|
$row->af_user,
|
|
|
|
$row->af_user_text
|
|
|
|
);
|
2016-01-21 09:57:56 +00:00
|
|
|
|
2017-12-16 00:26:25 +00:00
|
|
|
return $this->msg( 'abusefilter-edit-lastmod-text' )
|
2016-01-21 09:57:56 +00:00
|
|
|
->rawParams(
|
|
|
|
$this->mPage->getLinkToLatestDiff(
|
|
|
|
$row->af_id,
|
2021-03-08 23:54:03 +00:00
|
|
|
$lang->userTimeAndDate( $value, $user )
|
2016-01-21 09:57:56 +00:00
|
|
|
),
|
|
|
|
$userLink,
|
|
|
|
$this->mPage->getLinkToLatestDiff(
|
|
|
|
$row->af_id,
|
2021-03-08 23:54:03 +00:00
|
|
|
$lang->userDate( $value, $user )
|
2016-01-21 09:57:56 +00:00
|
|
|
),
|
|
|
|
$this->mPage->getLinkToLatestDiff(
|
|
|
|
$row->af_id,
|
2021-03-08 23:54:03 +00:00
|
|
|
$lang->userTime( $value, $user )
|
2016-01-21 09:57:56 +00:00
|
|
|
)
|
2018-07-04 15:04:05 +00:00
|
|
|
)->params(
|
2016-01-21 09:57:56 +00:00
|
|
|
wfEscapeWikiText( $row->af_user_text )
|
2019-10-30 12:36:19 +00:00
|
|
|
)->parse();
|
2017-12-16 00:26:25 +00:00
|
|
|
case 'af_group':
|
2021-04-17 16:57:38 +00:00
|
|
|
return $this->specsFormatter->nameGroup( $value );
|
2017-12-16 00:26:25 +00:00
|
|
|
default:
|
|
|
|
throw new MWException( "Unknown row type $name!" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
2019-10-30 12:36:19 +00:00
|
|
|
* Get the filter pattern with <b> elements surrounding the searched pattern
|
|
|
|
*
|
|
|
|
* @param stdClass $row
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
private function getHighlightedPattern( stdClass $row ) {
|
2021-04-17 16:57:38 +00:00
|
|
|
if ( $this->searchMode === null ) {
|
2020-10-01 11:31:04 +00:00
|
|
|
throw new LogicException( 'Cannot search without a mode.' );
|
|
|
|
}
|
2019-10-30 12:36:19 +00:00
|
|
|
$maxLen = 50;
|
2021-04-17 16:57:38 +00:00
|
|
|
if ( $this->searchMode === 'LIKE' ) {
|
|
|
|
$position = mb_stripos( $row->af_pattern, $this->searchPattern );
|
|
|
|
$length = mb_strlen( $this->searchPattern );
|
2019-10-30 12:36:19 +00:00
|
|
|
} else {
|
2021-04-17 16:57:38 +00:00
|
|
|
$regex = '/' . $this->searchPattern . '/u';
|
|
|
|
if ( $this->searchMode === 'IRLIKE' ) {
|
2019-10-30 12:36:19 +00:00
|
|
|
$regex .= 'i';
|
|
|
|
}
|
|
|
|
|
|
|
|
$matches = [];
|
2020-01-08 13:33:10 +00:00
|
|
|
AtEase::suppressWarnings();
|
2019-10-30 12:36:19 +00:00
|
|
|
$check = preg_match(
|
|
|
|
$regex,
|
|
|
|
$row->af_pattern,
|
|
|
|
$matches
|
|
|
|
);
|
2020-01-08 13:33:10 +00:00
|
|
|
AtEase::restoreWarnings();
|
2019-10-30 12:36:19 +00:00
|
|
|
// This may happen in case of catastrophic backtracking, or regexps matching
|
|
|
|
// the empty string.
|
|
|
|
if ( $check === false || strlen( $matches[0] ) === 0 ) {
|
|
|
|
return htmlspecialchars( mb_substr( $row->af_pattern, 0, 50 ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
$length = mb_strlen( $matches[0] );
|
|
|
|
$position = mb_strpos( $row->af_pattern, $matches[0] );
|
|
|
|
}
|
|
|
|
|
|
|
|
$remaining = $maxLen - $length;
|
|
|
|
if ( $remaining <= 0 ) {
|
|
|
|
$pattern = '<b>' .
|
|
|
|
htmlspecialchars( mb_substr( $row->af_pattern, $position, $maxLen ) ) .
|
|
|
|
'</b>';
|
|
|
|
} else {
|
|
|
|
// Center the snippet on the matched string
|
|
|
|
$minoffset = max( $position - round( $remaining / 2 ), 0 );
|
|
|
|
$pattern = mb_substr( $row->af_pattern, $minoffset, $maxLen );
|
|
|
|
$pattern =
|
|
|
|
htmlspecialchars( mb_substr( $pattern, 0, $position - $minoffset ) ) .
|
|
|
|
'<b>' .
|
|
|
|
htmlspecialchars( mb_substr( $pattern, $position - $minoffset, $length ) ) .
|
|
|
|
'</b>' .
|
|
|
|
htmlspecialchars( mb_substr(
|
|
|
|
$pattern,
|
|
|
|
$position - $minoffset + $length,
|
|
|
|
$remaining - ( $position - $minoffset + $length )
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return $pattern;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-01-17 11:54:43 +00:00
|
|
|
* @codeCoverageIgnore Merely declarative
|
|
|
|
* @inheritDoc
|
2018-04-04 21:14:25 +00:00
|
|
|
*/
|
|
|
|
public function getDefaultSort() {
|
2017-12-16 00:26:25 +00:00
|
|
|
return 'af_id';
|
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
2021-01-17 11:54:43 +00:00
|
|
|
* @codeCoverageIgnore Merely declarative
|
|
|
|
* @inheritDoc
|
2018-04-04 21:14:25 +00:00
|
|
|
*/
|
|
|
|
public function getTableClass() {
|
2019-03-22 14:52:21 +00:00
|
|
|
return parent::getTableClass() . ' mw-abusefilter-list-scrollable';
|
2018-02-17 14:09:36 +00:00
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* @param stdClass $row
|
|
|
|
* @return string
|
2020-12-03 14:11:19 +00:00
|
|
|
* @see TablePager::getRowClass()
|
2018-04-04 21:14:25 +00:00
|
|
|
*/
|
|
|
|
public function getRowClass( $row ) {
|
2017-12-16 00:26:25 +00:00
|
|
|
if ( $row->af_enabled ) {
|
2018-05-03 18:32:03 +00:00
|
|
|
return $row->af_throttled ? 'mw-abusefilter-list-throttled' : 'mw-abusefilter-list-enabled';
|
2017-12-16 00:26:25 +00:00
|
|
|
} elseif ( $row->af_deleted ) {
|
|
|
|
return 'mw-abusefilter-list-deleted';
|
|
|
|
} else {
|
|
|
|
return 'mw-abusefilter-list-disabled';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* @param string $name
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function isFieldSortable( $name ) {
|
2017-12-16 00:26:25 +00:00
|
|
|
$sortable_fields = [
|
|
|
|
'af_id',
|
|
|
|
'af_enabled',
|
|
|
|
'af_timestamp',
|
|
|
|
'af_hidden',
|
|
|
|
'af_group',
|
|
|
|
];
|
2021-04-17 16:57:38 +00:00
|
|
|
if ( $this->afPermManager->canSeeLogDetails( $this->getUser() ) ) {
|
2017-12-16 00:26:25 +00:00
|
|
|
$sortable_fields[] = 'af_hit_count';
|
2019-03-03 18:07:38 +00:00
|
|
|
$sortable_fields[] = 'af_public_comments';
|
2017-12-16 00:26:25 +00:00
|
|
|
}
|
|
|
|
return in_array( $name, $sortable_fields );
|
|
|
|
}
|
2018-07-15 23:55:31 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-17 11:54:43 +00:00
|
|
|
* @codeCoverageIgnore Merely declarative
|
|
|
|
* @inheritDoc
|
2018-07-15 23:55:31 +00:00
|
|
|
*/
|
|
|
|
public function getExtraSortFields() {
|
|
|
|
return [ 'af_enabled' => 'af_deleted' ];
|
|
|
|
}
|
2017-12-16 00:26:25 +00:00
|
|
|
}
|