MediaWiki master
SpecialMylog.php
Go to the documentation of this file.
1<?php
22
23use LogPage;
28
35
36 private TempUserConfig $tempUserConfig;
37
41 public function __construct( TempUserConfig $tempUserConfig ) {
42 parent::__construct( 'Mylog' );
43
44 $this->tempUserConfig = $tempUserConfig;
45
46 $this->mAllowedRedirectParams = [ 'type', 'subtype', 'page', 'pattern',
47 'tagfilter', 'tagInvert', 'offset', 'dir', 'offender',
48 'year', 'month', 'day' ];
49 }
50
55 public function getRedirect( $subpage ) {
56 // Redirect to login for anon users when temp accounts are enabled.
57 if ( $this->tempUserConfig->isEnabled() && $this->getUser()->isAnon() ) {
58 $this->requireLogin();
59 }
60
61 if ( $subpage === null || $subpage === '' ) {
62 return SpecialPage::getSafeTitleFor( 'Log', $this->getUser()->getName() );
63 }
64
65 return SpecialPage::getSafeTitleFor( 'Log', $subpage . '/' . $this->getUser()->getName() );
66 }
67
73 public function personallyIdentifiableTarget() {
74 return true;
75 }
76
82 public function getSubpagesForPrefixSearch() {
83 $subpages = LogPage::validTypes();
84 $subpages[] = 'all';
85 sort( $subpages );
86 return $subpages;
87 }
88}
89
94class_alias( SpecialMylog::class, 'SpecialMylog' );
Class to simplify the use of log pages.
Definition LogPage.php:45
Shortcut to construct a special page alias.
Parent class for all special pages.
getUser()
Shortcut to get the User executing this instance.
static getSafeTitleFor( $name, $subpage=false)
Get a localised Title object for a page name with a possibly unvalidated subpage.
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:Log for the current user's name or IP.
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
personallyIdentifiableTarget()
Target identifies a specific User.
__construct(TempUserConfig $tempUserConfig)
Represents a title within MediaWiki.
Definition Title.php:78
Interface for temporary user creation config and name matching.