88 ActorMigration::newMigration()->getWhere(
94 $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
96 if ( !$permissionManager->userHasRight( $user,
'deletedhistory' ) ) {
97 $conds[] = $this->mDb->bitAnd(
'ar_deleted', RevisionRecord::DELETED_USER ) .
' = 0';
98 } elseif ( !$permissionManager->userHasAnyRight( $user,
'suppressrevision',
'viewsuppressed' ) ) {
99 $conds[] = $this->mDb->bitAnd(
'ar_deleted', RevisionRecord::SUPPRESSED_USER ) .
100 ' != ' . RevisionRecord::SUPPRESSED_USER;
103 $commentQuery = CommentStore::getStore()->getJoin(
'ar_comment' );
104 $actorQuery = ActorMigration::newMigration()->getJoin(
'ar_user' );
107 'tables' => [
'archive' ] + $commentQuery[
'tables'] + $actorQuery[
'tables'],
109 'ar_rev_id',
'ar_id',
'ar_namespace',
'ar_title',
'ar_timestamp',
110 'ar_minor_edit',
'ar_deleted'
111 ] + $commentQuery[
'fields'] + $actorQuery[
'fields'],
114 'join_conds' => $commentQuery[
'joins'] + $actorQuery[
'joins'],
128 $data = [ parent::reallyDoQuery( $offset, $limit, $order ) ];
132 $this->getHookRunner()->onDeletedContribsPager__reallyDoQuery(
133 $data, $this, $offset, $limit, $order );
138 foreach ( $data as $query ) {
139 foreach ( $query as $i => $row ) {
146 if ( $order === self::QUERY_ASCENDING ) {
153 $result = array_slice( $result, 0, $limit );
156 $result = array_values( $result );
188 if ( isset( $this->mNavigationBar ) ) {
189 return $this->mNavigationBar;
193 'prev' => $this->msg(
'pager-newer-n' )->numParams( $this->mLimit )->escaped(),
194 'next' => $this->msg(
'pager-older-n' )->numParams( $this->mLimit )->escaped(),
195 'first' => $this->msg(
'histlast' )->escaped(),
196 'last' => $this->msg(
'histfirst' )->escaped()
199 $pagingLinks = $this->getPagingLinks( $linkTexts );
200 $limitLinks = $this->getLimitLinks();
201 $lang = $this->getLanguage();
202 $limits =
$lang->pipeList( $limitLinks );
204 $firstLast =
$lang->pipeList( [ $pagingLinks[
'first'], $pagingLinks[
'last'] ] );
205 $firstLast = $this->msg(
'parentheses' )->rawParams( $firstLast )->escaped();
206 $prevNext = $this->msg(
'viewprevnext' )
208 $pagingLinks[
'prev'],
209 $pagingLinks[
'next'],
212 $separator = $this->msg(
'word-separator' )->escaped();
213 $this->mNavigationBar = $firstLast . $separator . $prevNext;
215 return $this->mNavigationBar;
238 $revFactory = MediaWikiServices::getInstance()->getRevisionFactory();
247 Wikimedia\suppressWarnings();
249 $revRecord = $revFactory->newRevisionFromArchiveRow( $row );
250 $validRevision = (bool)$revRecord->getId();
251 }
catch ( Exception $e ) {
252 $validRevision =
false;
254 Wikimedia\restoreWarnings();
256 if ( $validRevision ) {
257 $attribs[
'data-mw-revid'] = $revRecord->getId();
258 $ret = $this->formatRevisionRow( $row );
262 $this->getHookRunner()->onDeletedContributionsLineEnding(
263 $this, $ret, $row, $classes, $attribs );
264 $attribs = array_filter( $attribs,
265 [ Sanitizer::class,
'isReservedDataAttribute' ],
269 if ( $classes === [] && $attribs === [] && $ret ===
'' ) {
270 wfDebug(
"Dropping Special:DeletedContribution row that could not be formatted" );
271 $ret =
"<!-- Could not format Special:DeletedContribution row. -->\n";
273 $attribs[
'class'] = $classes;
274 $ret = Html::rawElement(
'li', $attribs, $ret ) .
"\n";
293 $page = Title::makeTitle( $row->ar_namespace, $row->ar_title );
295 $linkRenderer = $this->getLinkRenderer();
297 $revRecord = MediaWikiServices::getInstance()
298 ->getRevisionFactory()
299 ->newRevisionFromArchiveRow(
301 RevisionFactory::READ_NORMAL,
308 $dellog = $linkRenderer->makeKnownLink(
310 $this->messages[
'deletionlog'],
314 'page' => $page->getPrefixedText()
318 $reviewlink = $linkRenderer->makeKnownLink(
320 $this->messages[
'undeleteviewlink']
324 $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
326 if ( $permissionManager->userHasRight( $user,
'deletedtext' ) ) {
327 $last = $linkRenderer->makeKnownLink(
329 $this->messages[
'diff'],
332 'target' => $page->getPrefixedText(),
333 'timestamp' => $revRecord->getTimestamp(),
338 $last = htmlspecialchars( $this->messages[
'diff'] );
342 $date = $this->getLanguage()->userTimeAndDate( $revRecord->getTimestamp(), $user );
344 if ( !$permissionManager->userHasRight( $user,
'undelete' ) ||
345 !RevisionRecord::userCanBitfield(
346 $revRecord->getVisibility(),
347 RevisionRecord::DELETED_TEXT,
351 $link = htmlspecialchars( $date );
353 $link = $linkRenderer->makeKnownLink(
356 [
'class' =>
'mw-changeslist-date' ],
358 'target' => $page->getPrefixedText(),
359 'timestamp' => $revRecord->getTimestamp()
364 if ( $revRecord->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
365 $link =
'<span class="history-deleted">' . $link .
'</span>';
368 $pagelink = $linkRenderer->makeLink(
371 [
'class' =>
'mw-changeslist-title' ]
374 if ( $revRecord->isMinor() ) {
375 $mflag = ChangesList::flag(
'minor' );
386 $tools = Html::rawElement(
388 [
'class' =>
'mw-deletedcontribs-tools' ],
389 $this->msg(
'parentheses' )->rawParams( $this->getLanguage()->pipeList(
390 [ $last, $dellog, $reviewlink ] ) )->escaped()
393 $separator =
'<span class="mw-changeslist-separator">. .</span>';
394 $ret =
"{$del}{$link} {$tools} {$separator} {$mflag} {$pagelink} {$comment}";
396 # Denote if username is redacted for this edit
397 if ( $revRecord->isDeleted( RevisionRecord::DELETED_USER ) ) {
398 $ret .=
" <strong>" . $this->msg(
'rev-deleted-user-contribs' )->escaped() .
"</strong>";