MediaWiki master
SpecialMypage.php
Go to the documentation of this file.
1<?php
23
27
34
35 private TempUserConfig $tempUserConfig;
36
37 public function __construct( TempUserConfig $tempUserConfig ) {
38 parent::__construct( 'Mypage' );
39
40 $this->tempUserConfig = $tempUserConfig;
41 }
42
47 public function getRedirect( $subpage ) {
48 // Redirect to login for anon users when temp accounts are enabled.
49 if ( $this->tempUserConfig->isEnabled() && $this->getUser()->isAnon() ) {
50 $this->requireLogin();
51 }
52
53 if ( $subpage === null || $subpage === '' ) {
54 return Title::makeTitle( NS_USER, $this->getUser()->getName() );
55 }
56
57 return Title::makeTitle( NS_USER, $this->getUser()->getName() . '/' . $subpage );
58 }
59
66 public function personallyIdentifiableTarget() {
67 return true;
68 }
69}
70
75class_alias( SpecialMypage::class, 'SpecialMypage' );
const NS_USER
Definition Defines.php:67
Helper for any RedirectSpecialPage which redirects the user to a particular article (as opposed to us...
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 the current user's user page.
__construct(TempUserConfig $tempUserConfig)
personallyIdentifiableTarget()
Target identifies a specific User.
Represents a title within MediaWiki.
Definition Title.php:78
Interface for temporary user creation config and name matching.