Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
SpecialMylog
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 4
42
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
 getRedirect
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
12
 personallyIdentifiableTarget
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getSubpagesForPrefixSearch
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @file
19 * @ingroup SpecialPage
20 */
21
22namespace MediaWiki\Specials\Redirects;
23
24use LogPage;
25use MediaWiki\SpecialPage\RedirectSpecialPage;
26use MediaWiki\SpecialPage\SpecialPage;
27use MediaWiki\Title\Title;
28
29/**
30 * Special page pointing to current user's Special:Log.
31 *
32 * @ingroup SpecialPage
33 */
34class SpecialMylog extends RedirectSpecialPage {
35    public function __construct() {
36        parent::__construct( 'Mylog' );
37        $this->mAllowedRedirectParams = [ 'type', 'subtype', 'page', 'pattern',
38            'tagfilter', 'tagInvert', 'offset', 'dir', 'offender',
39            'year', 'month', 'day' ];
40    }
41
42    /**
43     * @param string|null $subpage
44     * @return Title
45     */
46    public function getRedirect( $subpage ) {
47        if ( $subpage === null || $subpage === '' ) {
48            return SpecialPage::getSafeTitleFor( 'Log', $this->getUser()->getName() );
49        }
50        return SpecialPage::getSafeTitleFor( 'Log', $subpage . '/' . $this->getUser()->getName() );
51    }
52
53    /**
54     * Target identifies a specific User. See T109724.
55     *
56     * @return bool
57     */
58    public function personallyIdentifiableTarget() {
59        return true;
60    }
61
62    /**
63     * Return an array of subpages that this special page will accept.
64     *
65     * @return string[] subpages
66     */
67    public function getSubpagesForPrefixSearch() {
68        $subpages = LogPage::validTypes();
69        $subpages[] = 'all';
70        sort( $subpages );
71        return $subpages;
72    }
73}
74
75/**
76 * Retain the old class name for backwards compatibility.
77 * @deprecated since 1.41
78 */
79class_alias( SpecialMylog::class, 'SpecialMylog' );