MediaWiki master
SpecialMycontributions.php
Go to the documentation of this file.
1<?php
9
13
20
21 public function __construct( private readonly TempUserConfig $tempUserConfig ) {
22 parent::__construct( 'Mycontributions' );
23
24 $this->mAllowedRedirectParams = [ 'limit', 'namespace', 'tagfilter',
25 'offset', 'dir', 'year', 'month', 'feed', 'deletedOnly',
26 'nsInvert', 'associated', 'newOnly', 'topOnly', 'start', 'end',
27 'returnto' ];
28 }
29
31 public function execute( $subpage ) {
32 // Redirect to login for anon users when temp accounts are enabled.
33 if ( $this->tempUserConfig->isEnabled() && $this->getUser()->isAnon() ) {
34 $this->requireLogin();
35 }
36 parent::execute( $subpage );
37 }
38
40 public function getRedirect( $subpage ) {
41 if ( $this->tempUserConfig->isEnabled() && $this->getUser()->isAnon() ) {
42 return false;
43 }
44
45 return SpecialPage::getTitleFor( 'Contributions', $this->getUser()->getName() );
46 }
47
54 public function personallyIdentifiableTarget() {
55 return true;
56 }
57}
62class_alias( SpecialMycontributions::class, 'SpecialMycontributions' );
Shortcut to construct a special page alias.
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,...
getUser()
Shortcut to get the User executing this instance.
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
getName()
Get the canonical, unlocalized name of this special page without namespace.
Redirect to Special:Contributions for the current user's name or IP.
personallyIdentifiableTarget()
Target identifies a specific User.
__construct(private readonly TempUserConfig $tempUserConfig)
getRedirect( $subpage)
If the special page is a redirect, then get the Title object it redirects to.False otherwise....
Interface for temporary user creation config and name matching.