Debian Codegraph @

includes/specials/redirects/SpecialMycontributions.php

raw symbols SCIP
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
22 namespace MediaWiki\Specials\Redirects;
23
24 use MediaWiki\SpecialPage\RedirectSpecialPage;
25 use MediaWiki\SpecialPage\SpecialPage;
26 use MediaWiki\Title\Title;
27 use MediaWiki\User\TempUser\TempUserConfig;
28
29 /**
30 * Redirect to Special:Contributions for the current user's name or IP.
31 *
32 * @ingroup SpecialPage
33 */
34 class SpecialMycontributions extends RedirectSpecialPage {
35
36 private TempUserConfig $tempUserConfig;
37
38 /**
39 * @param TempUserConfig $tempUserConfig
40 */
41 public function __construct( TempUserConfig $tempUserConfig ) {
42 parent::__construct( 'Mycontributions' );
43
44 $this->tempUserConfig = $tempUserConfig;
45
46 $this->mAllowedRedirectParams = [ 'limit', 'namespace', 'tagfilter',
47 'offset', 'dir', 'year', 'month', 'feed', 'deletedOnly',
48 'nsInvert', 'associated', 'newOnly', 'topOnly', 'start', 'end',
49 'returnto' ];
50 }
51
52 /**
53 * @param string|null $subpage
54 * @return Title
55 */
56 public function getRedirect( $subpage ) {
57 // Redirect to login for anon users when temp accounts are enabled.
58 if ( $this->tempUserConfig->isEnabled() && $this->getUser()->isAnon() ) {
59 $this->requireLogin();
60 }
61
62 return SpecialPage::getTitleFor( 'Contributions', $this->getUser()->getName() );
63 }
64
65 /**
66 * Target identifies a specific User. See T109724.
67 *
68 * @since 1.27
69 * @return bool
70 */
71 public function personallyIdentifiableTarget() {
72 return true;
73 }
74 }
75 /**
76 * Retain the old class name for backwards compatibility.
77 * @deprecated since 1.41
78 */
79 class_alias( SpecialMycontributions::class, 'SpecialMycontributions' );