Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
SpecialMyuploads
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 3
30
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 3
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
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 */
20
21namespace MediaWiki\Specials\Redirects;
22
23use MediaWiki\SpecialPage\RedirectSpecialPage;
24use MediaWiki\SpecialPage\SpecialPage;
25use MediaWiki\Title\Title;
26use MediaWiki\User\TempUser\TempUserConfig;
27
28/**
29 * Redirect to Special:Listfiles for the current user's name or IP.
30 *
31 * @ingroup SpecialPage
32 */
33class SpecialMyuploads extends RedirectSpecialPage {
34
35    private TempUserConfig $tempUserConfig;
36
37    public function __construct( TempUserConfig $tempUserConfig ) {
38        parent::__construct( 'Myuploads' );
39
40        $this->tempUserConfig = $tempUserConfig;
41        $this->mAllowedRedirectParams = [ 'limit', 'ilshowall', 'ilsearch' ];
42    }
43
44    /**
45     * @param string|null $subpage
46     * @return Title
47     */
48    public function getRedirect( $subpage ) {
49        // Redirect to login for anon users when temp accounts are enabled.
50        if ( $this->tempUserConfig->isEnabled() && $this->getUser()->isAnon() ) {
51            $this->requireLogin();
52        }
53
54        return SpecialPage::getTitleFor( 'Listfiles', $this->getUser()->getName() );
55    }
56
57    /**
58     * Target identifies a specific User. See T109724.
59     *
60     * @since 1.27
61     * @return bool
62     */
63    public function personallyIdentifiableTarget() {
64        return true;
65    }
66}
67/**
68 * Retain the old class name for backwards compatibility.
69 * @deprecated since 1.41
70 */
71class_alias( SpecialMyuploads::class, 'SpecialMyuploads' );