* Pager for Special:Contributions
* @ingroup Pager
*/
+use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\FakeResultWrapper;
+use Wikimedia\Rdbms\IDatabase;
+
class ContribsPager extends ReverseChronologicalPager {
public $mDefaultDirection = IndexPager::DIR_DESCENDING;
$user = $this->getUser();
$conds = array_merge( $userCond, $this->getNamespaceCond() );
- // Paranoia: avoid brute force searches (bug 17342)
+ // Paranoia: avoid brute force searches (T19342)
if ( !$user->isAllowed( 'deletedhistory' ) ) {
$conds[] = $this->mDb->bitAnd( 'rev_deleted', Revision::DELETED_USER ) . ' = 0';
} elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
$this->tagFilter
);
- Hooks::run( 'ContribsPager::getQueryInfo', [ &$this, &$queryInfo ] );
+ // Avoid PHP 7.1 warning from passing $this by reference
+ $pager = $this;
+ Hooks::run( 'ContribsPager::getQueryInfo', [ &$pager, &$queryInfo ] );
return $queryInfo;
}
$join_conds['user_groups'] = [
'LEFT JOIN', [
'ug_user = rev_user',
- 'ug_group' => $groupsWithBotPermission
+ 'ug_group' => $groupsWithBotPermission,
+ 'ug_expiry IS NULL OR ug_expiry >= ' .
+ $this->mDb->addQuotes( $this->mDb->timestamp() )
]
];
}
$ret = '';
$classes = [];
+ $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
+
/*
* There may be more than just revision rows. To make sure that we'll only be processing
* revisions here, let's _try_ to build a revision out of our row (without displaying
$classes = [];
$page = Title::newFromRow( $row );
- $link = Linker::link(
+ $link = $linkRenderer->makeLink(
$page,
- htmlspecialchars( $page->getPrefixedText() ),
+ $page->getPrefixedText(),
[ 'class' => 'mw-contributions-title' ],
$page->isRedirect() ? [ 'redirect' => 'no' ] : []
);
}
# Is there a visible previous revision?
if ( $rev->userCan( Revision::DELETED_TEXT, $user ) && $rev->getParentId() !== 0 ) {
- $difftext = Linker::linkKnown(
+ $difftext = $linkRenderer->makeKnownLink(
$page,
- $this->messages['diff'],
- [],
+ new HtmlArmor( $this->messages['diff'] ),
+ [ 'class' => 'mw-changeslist-diff' ],
[
'diff' => 'prev',
'oldid' => $row->rev_id
} else {
$difftext = $this->messages['diff'];
}
- $histlink = Linker::linkKnown(
+ $histlink = $linkRenderer->makeKnownLink(
$page,
- $this->messages['hist'],
- [],
+ new HtmlArmor( $this->messages['hist'] ),
+ [ 'class' => 'mw-changeslist-history' ],
[ 'action' => 'history' ]
);
if ( $row->rev_parent_id === null ) {
// For some reason rev_parent_id isn't populated for this row.
- // Its rumoured this is true on wikipedia for some revisions (bug 34922).
+ // Its rumoured this is true on wikipedia for some revisions (T36922).
// Next best thing is to have the total number of bytes.
$chardiff = ' <span class="mw-changeslist-separator">. .</span> ';
$chardiff .= Linker::formatRevisionSize( $row->rev_len );
$comment = $lang->getDirMark() . Linker::revComment( $rev, false, true );
$date = $lang->userTimeAndDate( $row->rev_timestamp, $user );
if ( $rev->userCan( Revision::DELETED_TEXT, $user ) ) {
- $d = Linker::linkKnown(
+ $d = $linkRenderer->makeKnownLink(
$page,
- htmlspecialchars( $date ),
+ $date,
[ 'class' => 'mw-changeslist-date' ],
[ 'oldid' => intval( $row->rev_id ) ]
);