MediaWiki master
SpecialMycontributions.php
Go to the documentation of this file.
1<?php
9
13
20
21 private TempUserConfig $tempUserConfig;
22
23 public function __construct( TempUserConfig $tempUserConfig ) {
24 parent::__construct( 'Mycontributions' );
25
26 $this->tempUserConfig = $tempUserConfig;
27
28 $this->mAllowedRedirectParams = [ 'limit', 'namespace', 'tagfilter',
29 'offset', 'dir', 'year', 'month', 'feed', 'deletedOnly',
30 'nsInvert', 'associated', 'newOnly', 'topOnly', 'start', 'end',
31 'returnto' ];
32 }
33
35 public function execute( $subpage ) {
36 // Redirect to login for anon users when temp accounts are enabled.
37 if ( $this->tempUserConfig->isEnabled() && $this->getUser()->isAnon() ) {
38 $this->requireLogin();
39 }
40 parent::execute( $subpage );
41 }
42
44 public function getRedirect( $subpage ) {
45 if ( $this->tempUserConfig->isEnabled() && $this->getUser()->isAnon() ) {
46 return false;
47 }
48
49 return SpecialPage::getTitleFor( 'Contributions', $this->getUser()->getName() );
50 }
51
58 public function personallyIdentifiableTarget() {
59 return true;
60 }
61}
66class_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.
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.