51 public $namespace =
'';
54 private $commentStore;
60 private $revisionFactory;
83 $this->mDb = $loadBalancer->
getConnectionRef( ILoadBalancer::DB_REPLICA,
'contributions' );
84 parent::__construct( $context, $linkRenderer );
85 $msgs = [
'deletionlog',
'undeleteviewlink',
'diff' ];
86 foreach ( $msgs as $msg ) {
87 $this->messages[$msg] = $this->
msg( $msg )->text();
89 $this->target = $target;
90 $this->
namespace = $namespace;
91 $this->hookRunner =
new HookRunner( $hookContainer );
92 $this->commentStore = $commentStore;
93 $this->revisionFactory = $revisionFactory;
97 $query = parent::getDefaultQuery();
98 $query[
'target'] = $this->target;
105 $userCond = [
'actor_name' => $this->target ];
106 $conds = array_merge( $userCond, $this->getNamespaceCond() );
108 if ( !$this->
getAuthority()->isAllowed(
'deletedhistory' ) ) {
109 $conds[] =
$dbr->bitAnd(
'ar_deleted', RevisionRecord::DELETED_USER ) .
' = 0';
110 } elseif ( !$this->
getAuthority()->isAllowedAny(
'suppressrevision',
'viewsuppressed' ) ) {
111 $conds[] =
$dbr->bitAnd(
'ar_deleted', RevisionRecord::SUPPRESSED_USER ) .
112 ' != ' . RevisionRecord::SUPPRESSED_USER;
115 $queryInfo = $this->revisionFactory->getArchiveQueryInfo();
116 $queryInfo[
'conds'] = $conds;
117 $queryInfo[
'options'] = [];
120 $queryInfo[
'join_conds'] = $queryInfo[
'joins'];
121 unset( $queryInfo[
'joins'] );
124 $queryInfo[
'tables'],
125 $queryInfo[
'fields'],
127 $queryInfo[
'join_conds'],
128 $queryInfo[
'options'],
145 $data = [ parent::reallyDoQuery( $offset, $limit, $order ) ];
149 $this->hookRunner->onDeletedContribsPager__reallyDoQuery(
150 $data, $this, $offset, $limit, $order );
155 foreach ( $data as $query ) {
156 foreach ( $query as $i => $row ) {
163 if ( $order === self::QUERY_ASCENDING ) {
170 $result = array_slice( $result, 0, $limit );
173 $result = array_values( $result );
179 return 'ar_timestamp';
186 return $this->target;
193 return $this->namespace;
200 return "<section class='mw-pager-body'>\n";
207 return "</section>\n";
210 private function getNamespaceCond() {
211 if ( $this->
namespace !==
'' ) {
212 return [
'ar_namespace' => (int)$this->
namespace ];
230 if ( $this->revisionFactory->isRevisionRow( $row,
'archive' ) ) {
231 $revRecord = $this->revisionFactory->newRevisionFromArchiveRow( $row );
232 $revId = $revRecord->getId();
234 $attribs[
'data-mw-revid'] = $revId;
235 [ $ret, $classes ] = $this->formatRevisionRow( $row );
240 $this->hookRunner->onDeletedContributionsLineEnding(
241 $this, $ret, $row, $classes, $attribs );
242 $attribs = array_filter( $attribs,
243 [ Sanitizer::class,
'isReservedDataAttribute' ],
247 if ( $classes === [] && $attribs === [] && $ret ===
'' ) {
248 wfDebug(
"Dropping Special:DeletedContribution row that could not be formatted" );
249 $ret =
"<!-- Could not format Special:DeletedContribution row. -->\n";
251 $attribs[
'class'] = $classes;
252 $ret = Html::rawElement(
'li', $attribs, $ret ) .
"\n";
270 private function formatRevisionRow( $row ) {
271 $page = Title::makeTitle( $row->ar_namespace, $row->ar_title );
273 $linkRenderer = $this->getLinkRenderer();
275 $revRecord = $this->revisionFactory->newRevisionFromArchiveRow(
277 RevisionFactory::READ_NORMAL,
284 $dellog = $linkRenderer->makeKnownLink(
286 $this->messages[
'deletionlog'],
290 'page' => $page->getPrefixedText()
294 $reviewlink = $linkRenderer->makeKnownLink(
296 $this->messages[
'undeleteviewlink']
301 if ( $this->
getAuthority()->isAllowed(
'deletedtext' ) ) {
302 $last = $linkRenderer->makeKnownLink(
304 $this->messages[
'diff'],
307 'target' => $page->getPrefixedText(),
308 'timestamp' => $revRecord->getTimestamp(),
313 $last = htmlspecialchars( $this->messages[
'diff'] );
317 $date = $this->getLanguage()->userTimeAndDate( $revRecord->getTimestamp(), $user );
320 !$revRecord->userCan( RevisionRecord::DELETED_TEXT, $this->getAuthority() )
322 $link = htmlspecialchars( $date );
324 $link = $linkRenderer->makeKnownLink(
327 [
'class' =>
'mw-changeslist-date' ],
329 'target' => $page->getPrefixedText(),
330 'timestamp' => $revRecord->getTimestamp()
335 if ( $revRecord->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
337 $link =
'<span class="' . $class .
'">' . $link .
'</span>';
340 $pagelink = $linkRenderer->makeLink(
343 [
'class' =>
'mw-changeslist-title' ]
346 if ( $revRecord->isMinor() ) {
360 [
'class' =>
'mw-deletedcontribs-tools' ],
361 $this->msg(
'parentheses' )->rawParams( $this->getLanguage()->pipeList(
362 [ $last, $dellog, $reviewlink ] ) )->escaped()
368 'deletedcontributions',
372 $separator =
'<span class="mw-changeslist-separator">. .</span>';
373 $ret =
"{$del}{$link} {$tools} {$separator} {$mflag} {$pagelink} {$comment} {$tagSummary}";
375 # Denote if username is redacted for this edit
376 if ( $revRecord->isDeleted( RevisionRecord::DELETED_USER ) ) {
377 $ret .=
" <strong>" . $this->msg(
'rev-deleted-user-contribs' )->escaped() .
"</strong>";
380 return [ $ret, $classes ];
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
static flag( $flag, IContextSource $context=null)
Make an "<abbr>" element for a given change flag.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
static getRevisionDeletedClass(RevisionRecord $revisionRecord)
Returns css class of a deleted revision.
static revComment(RevisionRecord $revRecord, $local=false, $isPublic=false, $useParentheses=true)
Wrap and format the given revision's comment block, if the current user is allowed to view it.
static getRevDeleteLink(Authority $performer, RevisionRecord $revRecord, LinkTarget $title)
Get a revision-deletion link, or disabled link, or nothing, depending on user permissions & the setti...
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Interface for objects which can provide a MediaWiki context on request.