MediaWiki 1.43.1
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
71 public function __construct(
74 RevisionStore $revisionStore,
79 CommentFormatter $commentFormatter,
80 LinkBatchFactory $linkBatchFactory,
84 TempUserConfig $tempUserConfig
85 ) {
86 parent::__construct(
96 'DeletedContributions',
97 'deletedhistory'
98 );
99 $this->revisionStore = $revisionStore;
100 $this->commentFormatter = $commentFormatter;
101 $this->linkBatchFactory = $linkBatchFactory;
102 $this->tempUserConfig = $tempUserConfig;
103 }
104
108 protected function getPager( $target ) {
109 if ( $this->pager === null ) {
110 $this->pager = new DeletedContribsPager(
111 $this->getHookContainer(),
112 $this->getLinkRenderer(),
113 $this->dbProvider,
114 $this->revisionStore,
115 $this->namespaceInfo,
116 $this->commentFormatter,
117 $this->linkBatchFactory,
118 $this->userFactory,
119 $this->getContext(),
120 $this->opts,
121 $target
122 );
123 }
124
125 return $this->pager;
126 }
127
129 public function isIncludable() {
130 return false;
131 }
132
136 protected function getUserLinks(
137 SpecialPage $sp,
138 User $target
139 ) {
140 $tools = parent::getUserLinks( $sp, $target );
141 $linkRenderer = $sp->getLinkRenderer();
142
143 $contributionsLink = $linkRenderer->makeKnownLink(
144 SpecialPage::getTitleFor( 'Contributions', $target->getName() ),
145 $this->msg( 'sp-deletedcontributions-contribs' )->text()
146 );
147 if ( isset( $tools['deletedcontribs'] ) ) {
148 // Swap out the deletedcontribs link for our contribs one
149 $tools = wfArrayInsertAfter(
150 $tools, [ 'contribs' => $contributionsLink ], 'deletedcontribs' );
151 unset( $tools['deletedcontribs'] );
152 } else {
153 $tools['contribs'] = $contributionsLink;
154 }
155
156 return $tools;
157 }
158
160 protected function getResultsPageTitleMessageKey( UserIdentity $target ) {
161 // The following messages are generated here:
162 // * deletedcontributions-title
163 // * deletedcontributions-title-for-ip-when-temporary-accounts-enabled
164 $messageKey = 'deletedcontributions-title';
165 if ( $this->tempUserConfig->isEnabled() && IPUtils::isIPAddress( $target->getName() ) ) {
166 $messageKey .= '-for-ip-when-temporary-accounts-enabled';
167 }
168 return $messageKey;
169 }
170}
171
173class_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.
Creates User objects.
Handles searching prefixes of user names.
UserNameUtils service.
internal since 1.36
Definition User.php:94
getName()
Get the user name, or the IP of an anonymous user.
Definition User.php:1576
Interface for temporary user creation config and name matching.
Interface for objects representing user identity.
Provide primary and replica IDatabase connections.