68 $msgs = [
'deletionlog',
'undeleteviewlink',
'diff' ];
69 foreach ( $msgs as $msg ) {
70 $this->messages[$msg] = $this->
msg( $msg )->text();
78 $query = parent::getDefaultQuery();
93 $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
95 if ( !$permissionManager->userHasRight( $user,
'deletedhistory' ) ) {
96 $conds[] = $this->mDb->bitAnd(
'ar_deleted', RevisionRecord::DELETED_USER ) .
' = 0';
97 } elseif ( !$permissionManager->userHasAnyRight( $user,
'suppressrevision',
'viewsuppressed' ) ) {
98 $conds[] = $this->mDb->bitAnd(
'ar_deleted', RevisionRecord::SUPPRESSED_USER ) .
99 ' != ' . RevisionRecord::SUPPRESSED_USER;
106 'tables' => [
'archive' ] + $commentQuery[
'tables'] + $actorQuery[
'tables'],
108 'ar_rev_id',
'ar_namespace',
'ar_title',
'ar_timestamp',
109 'ar_minor_edit',
'ar_deleted'
110 ] + $commentQuery[
'fields'] + $actorQuery[
'fields'],
113 'join_conds' => $commentQuery[
'joins'] + $actorQuery[
'joins'],
127 $data = [ parent::reallyDoQuery( $offset, $limit, $order ) ];
132 'DeletedContribsPager::reallyDoQuery',
133 [ &$data, $this, $offset, $limit, $order ]
139 foreach ( $data as $query ) {
140 foreach ( $query as $i => $row ) {
147 if ( $order === self::QUERY_ASCENDING ) {
154 $result = array_slice( $result, 0, $limit );
157 $result = array_values( $result );
163 return 'ar_timestamp';
170 return $this->target;
177 return $this->namespace;
189 if ( isset( $this->mNavigationBar ) ) {
190 return $this->mNavigationBar;
194 'prev' => $this->msg(
'pager-newer-n' )->numParams( $this->mLimit )->escaped(),
195 'next' => $this->msg(
'pager-older-n' )->numParams( $this->mLimit )->escaped(),
196 'first' => $this->msg(
'histlast' )->escaped(),
197 'last' => $this->msg(
'histfirst' )->escaped()
200 $pagingLinks = $this->getPagingLinks( $linkTexts );
201 $limitLinks = $this->getLimitLinks();
202 $lang = $this->getLanguage();
203 $limits =
$lang->pipeList( $limitLinks );
205 $firstLast =
$lang->pipeList( [ $pagingLinks[
'first'], $pagingLinks[
'last'] ] );
206 $firstLast = $this->msg(
'parentheses' )->rawParams( $firstLast )->escaped();
207 $prevNext = $this->msg(
'viewprevnext' )
209 $pagingLinks[
'prev'],
210 $pagingLinks[
'next'],
213 $separator = $this->msg(
'word-separator' )->escaped();
214 $this->mNavigationBar = $firstLast . $separator . $prevNext;
216 return $this->mNavigationBar;
220 if ( $this->
namespace !==
'' ) {
221 return [
'ar_namespace' => (int)$this->
namespace ];
246 Wikimedia\suppressWarnings();
249 $validRevision = (bool)$rev->getId();
250 }
catch ( Exception $e ) {
251 $validRevision =
false;
253 Wikimedia\restoreWarnings();
255 if ( $validRevision ) {
256 $attribs[
'data-mw-revid'] = $rev->getId();
257 $ret = $this->formatRevisionRow( $row );
261 Hooks::run(
'DeletedContributionsLineEnding', [ $this, &$ret, $row, &$classes, &$attribs ] );
262 $attribs = array_filter( $attribs,
263 [ Sanitizer::class,
'isReservedDataAttribute' ],
267 if ( $classes === [] && $attribs === [] && $ret ===
'' ) {
268 wfDebug(
"Dropping Special:DeletedContribution row that could not be formatted\n" );
269 $ret =
"<!-- Could not format Special:DeletedContribution row. -->\n";
271 $attribs[
'class'] = $classes;
272 $ret = Html::rawElement(
'li', $attribs, $ret ) .
"\n";
293 $linkRenderer = $this->getLinkRenderer();
297 'id' => $row->ar_rev_id,
299 'user' => $row->ar_user,
300 'user_text' => $row->ar_user_text,
301 'actor' => $row->ar_actor ??
null,
302 'timestamp' => $row->ar_timestamp,
303 'minor_edit' => $row->ar_minor_edit,
304 'deleted' => $row->ar_deleted,
310 $dellog = $linkRenderer->makeKnownLink(
312 $this->messages[
'deletionlog'],
316 'page' => $page->getPrefixedText()
320 $reviewlink = $linkRenderer->makeKnownLink(
322 $this->messages[
'undeleteviewlink']
326 $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
328 if ( $permissionManager->userHasRight( $user,
'deletedtext' ) ) {
329 $last = $linkRenderer->makeKnownLink(
331 $this->messages[
'diff'],
334 'target' => $page->getPrefixedText(),
335 'timestamp' => $rev->getTimestamp(),
340 $last = htmlspecialchars( $this->messages[
'diff'] );
344 $date = $this->getLanguage()->userTimeAndDate( $rev->getTimestamp(), $user );
346 if ( !$permissionManager->userHasRight( $user,
'undelete' ) ||
347 !$rev->userCan( RevisionRecord::DELETED_TEXT, $user )
349 $link = htmlspecialchars( $date );
351 $link = $linkRenderer->makeKnownLink(
354 [
'class' =>
'mw-changeslist-date' ],
356 'target' => $page->getPrefixedText(),
357 'timestamp' => $rev->getTimestamp()
362 if ( $rev->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
363 $link =
'<span class="history-deleted">' . $link .
'</span>';
366 $pagelink = $linkRenderer->makeLink(
369 [
'class' =>
'mw-changeslist-title' ]
372 if ( $rev->isMinor() ) {
384 $tools = Html::rawElement(
386 [
'class' =>
'mw-deletedcontribs-tools' ],
387 $this->msg(
'parentheses' )->rawParams( $this->getLanguage()->pipeList(
388 [
$last, $dellog, $reviewlink ] ) )->escaped()
391 $separator =
'<span class="mw-changeslist-separator">. .</span>';
392 $ret =
"{$del}{$link} {$tools} {$separator} {$mflag} {$pagelink} {$comment}";
394 # Denote if username is redacted for this edit
395 if ( $rev->isDeleted( RevisionRecord::DELETED_USER ) ) {
396 $ret .=
" <strong>" . $this->msg(
'rev-deleted-user-contribs' )->escaped() .
"</strong>";