91 $this->mDb = $loadBalancer->
getConnectionRef( ILoadBalancer::DB_REPLICA,
'contributions' );
92 parent::__construct( $context, $linkRenderer );
93 $msgs = [
'deletionlog',
'undeleteviewlink',
'diff' ];
94 foreach ( $msgs as $msg ) {
95 $this->messages[$msg] = $this->
msg( $msg )->text();
99 $this->hookRunner =
new HookRunner( $hookContainer );
100 $this->commentStore = $commentStore;
101 $this->revisionFactory = $revisionFactory;
113 $userCond = [
'actor_name' => $this->target ];
116 if ( !$this->
getAuthority()->isAllowed(
'deletedhistory' ) ) {
117 $conds[] =
$dbr->bitAnd(
'ar_deleted', RevisionRecord::DELETED_USER ) .
' = 0';
118 } elseif ( !$this->
getAuthority()->isAllowedAny(
'suppressrevision',
'viewsuppressed' ) ) {
119 $conds[] =
$dbr->bitAnd(
'ar_deleted', RevisionRecord::SUPPRESSED_USER ) .
120 ' != ' . RevisionRecord::SUPPRESSED_USER;
123 $queryInfo = $this->revisionFactory->getArchiveQueryInfo();
124 $queryInfo[
'conds'] = $conds;
125 $queryInfo[
'options'] = [];
128 $queryInfo[
'join_conds'] = $queryInfo[
'joins'];
129 unset( $queryInfo[
'joins'] );
144 $data = [ parent::reallyDoQuery( $offset, $limit, $order ) ];
148 $this->hookRunner->onDeletedContribsPager__reallyDoQuery(
149 $data, $this, $offset, $limit, $order );
154 foreach ( $data as $query ) {
155 foreach ( $query as $i => $row ) {
162 if ( $order === self::QUERY_ASCENDING ) {
169 $result = array_slice( $result, 0, $limit );
172 $result = array_values( $result );
204 if ( !$this->isNavigationBarShown() ) {
208 if ( isset( $this->mNavigationBar ) ) {
209 return $this->mNavigationBar;
213 'prev' => $this->msg(
'pager-newer-n' )->numParams( $this->mLimit )->escaped(),
214 'next' => $this->msg(
'pager-older-n' )->numParams( $this->mLimit )->escaped(),
215 'first' => $this->msg(
'histlast' )->escaped(),
216 'last' => $this->msg(
'histfirst' )->escaped()
219 $pagingLinks = $this->getPagingLinks( $linkTexts );
220 $limitLinks = $this->getLimitLinks();
221 $lang = $this->getLanguage();
222 $limits =
$lang->pipeList( $limitLinks );
224 $firstLast =
$lang->pipeList( [ $pagingLinks[
'first'], $pagingLinks[
'last'] ] );
225 $firstLast = $this->msg(
'parentheses' )->rawParams( $firstLast )->escaped();
226 $prevNext = $this->msg(
'viewprevnext' )
228 $pagingLinks[
'prev'],
229 $pagingLinks[
'next'],
232 $separator = $this->msg(
'word-separator' )->escaped();
233 $this->mNavigationBar = $firstLast . $separator . $prevNext;
235 return $this->mNavigationBar;
258 if ( $this->revisionFactory->isRevisionRow( $row,
'archive' ) ) {
259 $revRecord = $this->revisionFactory->newRevisionFromArchiveRow( $row );
260 $validRevision = (bool)$revRecord->getId();
262 $validRevision =
false;
265 if ( $validRevision ) {
266 $attribs[
'data-mw-revid'] = $revRecord->getId();
267 $ret = $this->formatRevisionRow( $row );
271 $this->hookRunner->onDeletedContributionsLineEnding(
272 $this, $ret, $row, $classes, $attribs );
273 $attribs = array_filter( $attribs,
274 [ Sanitizer::class,
'isReservedDataAttribute' ],
278 if ( $classes === [] && $attribs === [] && $ret ===
'' ) {
279 wfDebug(
"Dropping Special:DeletedContribution row that could not be formatted" );
280 $ret =
"<!-- Could not format Special:DeletedContribution row. -->\n";
282 $attribs[
'class'] = $classes;
283 $ret = Html::rawElement(
'li', $attribs, $ret ) .
"\n";
302 $page = Title::makeTitle( $row->ar_namespace, $row->ar_title );
304 $linkRenderer = $this->getLinkRenderer();
306 $revRecord = $this->revisionFactory->newRevisionFromArchiveRow(
308 RevisionFactory::READ_NORMAL,
315 $dellog = $linkRenderer->makeKnownLink(
317 $this->messages[
'deletionlog'],
321 'page' => $page->getPrefixedText()
325 $reviewlink = $linkRenderer->makeKnownLink(
327 $this->messages[
'undeleteviewlink']
330 $user = $this->getUser();
332 if ( $this->
getAuthority()->isAllowed(
'deletedtext' ) ) {
333 $last = $linkRenderer->makeKnownLink(
335 $this->messages[
'diff'],
338 'target' => $page->getPrefixedText(),
339 'timestamp' => $revRecord->getTimestamp(),
344 $last = htmlspecialchars( $this->messages[
'diff'] );
348 $date = $this->getLanguage()->userTimeAndDate( $revRecord->getTimestamp(), $user );
351 !$revRecord->userCan( RevisionRecord::DELETED_TEXT, $this->getAuthority() )
353 $link = htmlspecialchars( $date );
355 $link = $linkRenderer->makeKnownLink(
358 [
'class' =>
'mw-changeslist-date' ],
360 'target' => $page->getPrefixedText(),
361 'timestamp' => $revRecord->getTimestamp()
366 if ( $revRecord->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
368 $link =
'<span class="' . $class .
'">' . $link .
'</span>';
371 $pagelink = $linkRenderer->makeLink(
374 [
'class' =>
'mw-changeslist-title' ]
377 if ( $revRecord->isMinor() ) {
378 $mflag = ChangesList::flag(
'minor' );
389 $tools = Html::rawElement(
391 [
'class' =>
'mw-deletedcontribs-tools' ],
392 $this->msg(
'parentheses' )->rawParams( $this->getLanguage()->pipeList(
393 [ $last, $dellog, $reviewlink ] ) )->escaped()
396 $separator =
'<span class="mw-changeslist-separator">. .</span>';
397 $ret =
"{$del}{$link} {$tools} {$separator} {$mflag} {$pagelink} {$comment}";
399 # Denote if username is redacted for this edit
400 if ( $revRecord->isDeleted( RevisionRecord::DELETED_USER ) ) {
401 $ret .=
" <strong>" . $this->msg(
'rev-deleted-user-contribs' )->escaped() .
"</strong>";