MediaWiki master
SpecialDeletedContributions.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Specials;
22
40use Wikimedia\IPUtils;
42
49 private ?DeletedContribsPager $pager = null;
50
51 private RevisionStore $revisionStore;
52 private CommentFormatter $commentFormatter;
53 private LinkBatchFactory $linkBatchFactory;
54 private TempUserConfig $tempUserConfig;
55
56 public function __construct(
59 RevisionStore $revisionStore,
64 CommentFormatter $commentFormatter,
65 LinkBatchFactory $linkBatchFactory,
69 TempUserConfig $tempUserConfig
70 ) {
71 parent::__construct(
81 'DeletedContributions',
82 'deletedhistory'
83 );
84 $this->revisionStore = $revisionStore;
85 $this->commentFormatter = $commentFormatter;
86 $this->linkBatchFactory = $linkBatchFactory;
87 $this->tempUserConfig = $tempUserConfig;
88 }
89
93 protected function getPager( $target ) {
94 if ( $this->pager === null ) {
95 $this->pager = new DeletedContribsPager(
96 $this->getHookContainer(),
97 $this->getLinkRenderer(),
98 $this->dbProvider,
99 $this->revisionStore,
100 $this->namespaceInfo,
101 $this->commentFormatter,
102 $this->linkBatchFactory,
103 $this->userFactory,
104 $this->getContext(),
105 $this->opts,
106 $target
107 );
108 }
109
110 return $this->pager;
111 }
112
114 public function isIncludable() {
115 return false;
116 }
117
121 protected function getUserLinks(
122 SpecialPage $sp,
123 User $target
124 ) {
125 $tools = parent::getUserLinks( $sp, $target );
126 $linkRenderer = $sp->getLinkRenderer();
127
128 $contributionsLink = $linkRenderer->makeKnownLink(
129 SpecialPage::getTitleFor( 'Contributions', $target->getName() ),
130 $this->msg( 'sp-deletedcontributions-contribs' )->text()
131 );
132 if ( isset( $tools['deletedcontribs'] ) ) {
133 // Swap out the deletedcontribs link for our contribs one
134 $tools = wfArrayInsertAfter(
135 $tools, [ 'contribs' => $contributionsLink ], 'deletedcontribs' );
136 unset( $tools['deletedcontribs'] );
137 } else {
138 $tools['contribs'] = $contributionsLink;
139 }
140
141 return $tools;
142 }
143
145 protected function getResultsPageTitleMessageKey( UserIdentity $target ) {
146 // The following messages are generated here:
147 // * deletedcontributions-title
148 // * deletedcontributions-title-for-ip-when-temporary-accounts-enabled
149 $messageKey = 'deletedcontributions-title';
150 if ( $this->tempUserConfig->isEnabled() && IPUtils::isIPAddress( $target->getName() ) ) {
151 $messageKey .= '-for-ip-when-temporary-accounts-enabled';
152 }
153 return $messageKey;
154 }
155}
156
158class_alias( SpecialDeletedContributions::class, 'SpecialDeletedContributions' );
wfArrayInsertAfter(array $array, array $insert, $after)
Insert an array into another array after the specified key.
This is the main service interface for converting single-line comments from various DB comment fields...
A service class for checking permissions To obtain an instance, use MediaWikiServices::getInstance()-...
Service for looking up page revisions.
Parent class for all special pages.
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,...
getContext()
Gets the context this SpecialPage is executed in.
Implements Special:DeletedContributions to display archived revisions.
__construct(PermissionManager $permissionManager, IConnectionProvider $dbProvider, RevisionStore $revisionStore, NamespaceInfo $namespaceInfo, UserNameUtils $userNameUtils, UserNamePrefixSearch $userNamePrefixSearch, UserOptionsLookup $userOptionsLookup, CommentFormatter $commentFormatter, LinkBatchFactory $linkBatchFactory, UserFactory $userFactory, UserIdentityLookup $userIdentityLookup, DatabaseBlockStore $blockStore, TempUserConfig $tempUserConfig)
isIncludable()
Whether it's allowed to transclude the special page via {{Special:Foo/params}}.to override bool
getUserLinks(SpecialPage $sp, User $target)
Links to different places.This function is also called in DeletedContributionsPage array
getResultsPageTitleMessageKey(UserIdentity $target)
string Message key for the results page title
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Provides access to user options.
Create User objects.
Handles searching prefixes of user names.
UserNameUtils service.
User class for the MediaWiki software.
Definition User.php:120
getName()
Get the user name, or the IP of an anonymous user.
Definition User.php:1608
Interface for temporary user creation config and name matching.
Service for looking up UserIdentity.
Interface for objects representing user identity.
Provide primary and replica IDatabase connections.