44 private $permissionManager;
47 private $loadBalancer;
50 private $commentStore;
53 private $revisionFactory;
56 private $namespaceInfo;
62 private $userNameUtils;
65 private $userNamePrefixSearch;
87 parent::__construct(
'DeletedContributions',
'deletedhistory' );
88 $this->permissionManager = $permissionManager;
89 $this->loadBalancer = $loadBalancer;
90 $this->commentStore = $commentStore;
91 $this->revisionFactory = $revisionFactory;
92 $this->namespaceInfo = $namespaceInfo;
93 $this->userFactory = $userFactory;
94 $this->userNameUtils = $userNameUtils;
95 $this->userNamePrefixSearch = $userNamePrefixSearch;
109 $out->addModuleStyles( [
110 'mediawiki.interface.helpers.styles',
111 'mediawiki.special.changeslist',
117 $opts->add(
'target',
'' );
118 $opts->add(
'namespace',
'' );
119 $opts->add(
'limit', 20 );
121 $opts->fetchValuesFromRequest( $this->
getRequest() );
122 $opts->validateIntBounds(
'limit', 0,
123 $this->
getConfig()->
get( MainConfigNames::QueryPageDefaultLimit ) );
125 if ( $par !==
null ) {
127 $par = $this->userNameUtils->getCanonical( $par, UserRigorOptions::RIGOR_NONE );
128 $opts->setValue(
'target', (
string)$par );
131 $ns = $opts->getValue(
'namespace' );
132 if ( $ns !==
null && $ns !==
'' ) {
133 $opts->setValue(
'namespace', intval( $ns ) );
136 $this->mOpts = $opts;
138 $target = trim( $opts->getValue(
'target' ) );
139 if ( !strlen( $target ) ) {
145 $userObj = $this->userFactory->newFromName( $target, UserRigorOptions::RIGOR_NONE );
151 $this->
getSkin()->setRelevantUser( $userObj );
153 $target = $userObj->getName();
155 $out->addSubtitle( $this->getSubTitle( $userObj ) );
156 $out->setPageTitle( $this->
msg(
'deletedcontributions-title', $target ) );
166 $this->revisionFactory,
168 $opts->getValue(
'namespace' )
170 if ( !$pager->getNumRows() ) {
171 $out->addWikiMsg(
'nocontribs' );
176 # Show a message about replica DB lag, if applicable
177 $lag = $pager->getDatabase()->getSessionLagStatus()[
'lag'];
179 $out->showLagWarning( $lag );
183 '<p>' . $pager->getNavigationBar() .
'</p>' .
185 '<p>' . $pager->getNavigationBar() .
'</p>' );
187 # If there were contributions, and it was a valid user or IP, show
188 # the appropriate "footer" message - WHOIS tools, etc.
189 $message = IPUtils::isIPAddress( $target ) ?
190 'sp-contributions-footer-anon' :
191 'sp-contributions-footer';
193 if ( !$this->
msg( $message )->isDisabled() ) {
195 "<div class='mw-contributions-footer'>\n$1\n</div>",
196 [ $message, $target ]
206 private function getSubTitle( $userObj ) {
208 if ( $userObj->isAnon() ) {
209 $user = htmlspecialchars( $userObj->getName() );
211 $user = $linkRenderer->makeLink( $userObj->getUserPage(), $userObj->getName() );
214 $nt = $userObj->getUserPage();
215 $talk = $nt->getTalkPage();
220 $this->permissionManager,
224 $contributionsLink = $linkRenderer->makeKnownLink(
226 $this->msg(
'sp-deletedcontributions-contribs' )->text()
228 if ( isset( $tools[
'deletedcontribs'] ) ) {
231 $tools, [
'contribs' => $contributionsLink ],
'deletedcontribs' );
232 unset( $tools[
'deletedcontribs'] );
234 $tools[
'contribs'] = $contributionsLink;
240 $block = DatabaseBlock::newFromTarget( $userObj, $userObj );
241 if ( $block !==
null && $block->getType() != DatabaseBlock::TYPE_AUTO ) {
242 if ( $block->getType() == DatabaseBlock::TYPE_RANGE ) {
243 $nt = $this->namespaceInfo->getCanonicalName(
NS_USER )
244 .
':' . $block->getTargetName();
256 'showIfEmpty' =>
false,
258 'sp-contributions-blocked-notice',
259 $userObj->getName() # Support GENDER in
'sp-contributions-blocked-notice'
261 'offset' =>
'' # don
't use $this->getRequest() parameter offset
267 return $this->msg( 'contribsub2
' )->rawParams( $user, $links )->params( $userObj->getName() );
273 private function getForm() {
274 $opts = $this->mOpts;
280 'label-message
' => 'sp-contributions-username
',
281 'default' => $opts->getValue( 'target
' ),
286 'type
' => 'namespaceselect
',
287 'name
' => 'namespace',
288 'label-message
' => 'namespace',
293 HTMLForm::factory( 'ooui
', $formDescriptor, $this->getContext() )
294 ->setWrapperLegendMsg( 'sp-contributions-search
' )
295 ->setSubmitTextMsg( 'sp-contributions-submit
' )
296 // prevent setting subpage and 'target
' parameter at the same time
297 ->setTitle( $this->getPageTitle() )
300 ->displayForm( false );
311 public function prefixSearchSubpages( $search, $limit, $offset ) {
312 $search = $this->userNameUtils->getCanonical( $search );
314 // No prefix suggestion for invalid user
317 // Autocomplete subpage as user list - public to allow caching
318 return $this->userNamePrefixSearch
319 ->search( UserNamePrefixSearch::AUDIENCE_PUBLIC, $search, $limit, $offset );
322 protected function getGroupName() {
wfArrayInsertAfter(array $array, array $insert, $after)
Insert an array into another array after the specified key.
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
A class containing constants representing the names of configuration variables.
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
static getUserLinks(SpecialPage $sp, User $target, PermissionManager $permissionManager=null, HookRunner $hookRunner=null)
Links to different places.
Implements Special:DeletedContributions to display archived revisions.
execute( $par)
Special page "deleted user contributions".
__construct(PermissionManager $permissionManager, ILoadBalancer $loadBalancer, CommentStore $commentStore, RevisionFactory $revisionFactory, NamespaceInfo $namespaceInfo, UserFactory $userFactory, UserNameUtils $userNameUtils, UserNamePrefixSearch $userNamePrefixSearch)
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getSkin()
Shortcut to get the skin being used for this instance.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
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.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getRequest()
Get the WebRequest being used for this instance.
getLanguage()
Shortcut to get user's language.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.