Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| SpecialMobileLanguages | n/a |
0 / 0 |
n/a |
0 / 0 |
4 | n/a |
0 / 0 |
|||
| __construct | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| execute | n/a |
0 / 0 |
n/a |
0 / 0 |
3 | |||||
| 1 | <?php |
| 2 | |
| 3 | use MediaWiki\Exception\BadTitleError; |
| 4 | use MediaWiki\SpecialPage\UnlistedSpecialPage; |
| 5 | use MediaWiki\Title\Title; |
| 6 | |
| 7 | /** |
| 8 | * Redirect from Special:MobileLanguages to the article |
| 9 | * |
| 10 | * @ingroup SpecialPage |
| 11 | * @codeCoverageIgnore |
| 12 | */ |
| 13 | class SpecialMobileLanguages extends UnlistedSpecialPage { |
| 14 | public function __construct() { |
| 15 | parent::__construct( 'MobileLanguages' ); |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * @inheritDoc |
| 20 | */ |
| 21 | public function execute( $subpage ) { |
| 22 | $title = Title::newFromText( $subpage ); |
| 23 | if ( !$title || !$title->canExist() ) { |
| 24 | // Reject invalid titles |
| 25 | // Reject non-wikipage destinations (e.g. Special or Media). |
| 26 | throw new BadTitleError(); |
| 27 | } |
| 28 | $url = $title->getLocalURL() . '#p-lang'; |
| 29 | $this->getOutput()->redirect( $url, '301' ); |
| 30 | } |
| 31 | } |