MediaWiki master
SpecialMylog.php
Go to the documentation of this file.
1<?php
8
13
20
21 private TempUserConfig $tempUserConfig;
22
23 public function __construct( TempUserConfig $tempUserConfig ) {
24 parent::__construct( 'Mylog' );
25
26 $this->tempUserConfig = $tempUserConfig;
27
28 $this->mAllowedRedirectParams = [ 'type', 'subtype', 'page', 'pattern',
29 'tagfilter', 'tagInvert', 'offset', 'dir', 'offender',
30 'year', 'month', 'day' ];
31 }
32
34 public function execute( $subpage ) {
35 // Redirect to login for anon users when temp accounts are enabled.
36 if ( $this->tempUserConfig->isEnabled() && $this->getUser()->isAnon() ) {
37 $this->requireLogin();
38 }
39 parent::execute( $subpage );
40 }
41
43 public function getRedirect( $subpage ) {
44 if ( $this->tempUserConfig->isEnabled() && $this->getUser()->isAnon() ) {
45 return false;
46 }
47
48 if ( $subpage === null || $subpage === '' ) {
49 return SpecialPage::getSafeTitleFor( 'Log', $this->getUser()->getName() );
50 }
51
52 return SpecialPage::getSafeTitleFor( 'Log', $subpage . '/' . $this->getUser()->getName() );
53 }
54
60 public function personallyIdentifiableTarget() {
61 return true;
62 }
63
69 public function getSubpagesForPrefixSearch() {
70 $subpages = LogPage::validTypes();
71 $subpages[] = 'all';
72 sort( $subpages );
73 return $subpages;
74 }
75}
76
81class_alias( SpecialMylog::class, 'SpecialMylog' );
Class to simplify the use of log pages.
Definition LogPage.php:35
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.
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.
__construct(TempUserConfig $tempUserConfig)
Interface for temporary user creation config and name matching.