Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| SpecialRandomRootPage | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 | |||
| isRedirect | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Copyright © 2008 Hojjat (aka Huji) |
| 4 | * |
| 5 | * @license GPL-2.0-or-later |
| 6 | * @file |
| 7 | */ |
| 8 | |
| 9 | namespace MediaWiki\Specials; |
| 10 | |
| 11 | use MediaWiki\Title\NamespaceInfo; |
| 12 | use Wikimedia\Rdbms\IConnectionProvider; |
| 13 | use Wikimedia\Rdbms\IExpression; |
| 14 | use Wikimedia\Rdbms\LikeValue; |
| 15 | |
| 16 | /** |
| 17 | * Redirect to a random page that isn't a subpage. |
| 18 | * |
| 19 | * @ingroup SpecialPage |
| 20 | */ |
| 21 | class SpecialRandomRootPage extends SpecialRandomPage { |
| 22 | |
| 23 | public function __construct( |
| 24 | IConnectionProvider $dbProvider, |
| 25 | NamespaceInfo $nsInfo |
| 26 | ) { |
| 27 | parent::__construct( $dbProvider, $nsInfo ); |
| 28 | $this->mName = 'Randomrootpage'; |
| 29 | $dbr = $dbProvider->getReplicaDatabase(); |
| 30 | $this->extra[] = $dbr->expr( |
| 31 | 'page_title', |
| 32 | IExpression::NOT_LIKE, |
| 33 | new LikeValue( $dbr->anyString(), '/', $dbr->anyString() ) |
| 34 | ); |
| 35 | } |
| 36 | |
| 37 | /** @inheritDoc */ |
| 38 | public function isRedirect() { |
| 39 | // Don't select redirects |
| 40 | return false; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Retain the old class name for backwards compatibility. |
| 46 | * @deprecated since 1.41 |
| 47 | */ |
| 48 | class_alias( SpecialRandomRootPage::class, 'SpecialRandomRootPage' ); |