MediaWiki master
SpecialMylog.php
Go to the documentation of this file.
1<?php
8
13
20
21 public function __construct( private readonly TempUserConfig $tempUserConfig ) {
22 parent::__construct( 'Mylog' );
23
24 $this->mAllowedRedirectParams = [ 'type', 'subtype', 'page', 'pattern',
25 'tagfilter', 'tagInvert', 'offset', 'dir', 'offender',
26 'year', 'month', 'day' ];
27 }
28
30 public function execute( $subpage ) {
31 // Redirect to login for anon users when temp accounts are enabled.
32 if ( $this->tempUserConfig->isEnabled() && $this->getUser()->isAnon() ) {
33 $this->requireLogin();
34 }
35 parent::execute( $subpage );
36 }
37
39 public function getRedirect( $subpage ) {
40 if ( $this->tempUserConfig->isEnabled() && $this->getUser()->isAnon() ) {
41 return false;
42 }
43
44 if ( $subpage === null || $subpage === '' ) {
45 return SpecialPage::getSafeTitleFor( 'Log', $this->getUser()->getName() );
46 }
47
48 return SpecialPage::getSafeTitleFor( 'Log', $subpage . '/' . $this->getUser()->getName() );
49 }
50
56 public function personallyIdentifiableTarget() {
57 return true;
58 }
59
65 public function getSubpagesForPrefixSearch() {
66 $subpages = LogPage::validTypes();
67 $subpages[] = 'all';
68 sort( $subpages );
69 return $subpages;
70 }
71}
72
77class_alias( SpecialMylog::class, 'SpecialMylog' );
Class to simplify the use of log pages.
Definition LogPage.php:34
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.
__construct(private readonly TempUserConfig $tempUserConfig)
getRedirect( $subpage)
If the special page is a redirect, then get the Title object it redirects to.False otherwise....
personallyIdentifiableTarget()
Target identifies a specific User.
Interface for temporary user creation config and name matching.