Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
SpecialRandomRootPage
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
2
 isRedirect
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * Implements Special:Randomrootpage
5 *
6 * Copyright © 2008 Hojjat (aka Huji)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * http://www.gnu.org/copyleft/gpl.html
22 *
23 * @file
24 * @ingroup SpecialPage
25 */
26
27namespace MediaWiki\Specials;
28
29use MediaWiki\Title\NamespaceInfo;
30use Wikimedia\Rdbms\IConnectionProvider;
31use Wikimedia\Rdbms\IExpression;
32use Wikimedia\Rdbms\LikeValue;
33
34class SpecialRandomRootPage extends SpecialRandomPage {
35
36    /**
37     * @param IConnectionProvider $dbProvider
38     * @param NamespaceInfo $nsInfo
39     */
40    public function __construct(
41        IConnectionProvider $dbProvider,
42        NamespaceInfo $nsInfo
43    ) {
44        parent::__construct( $dbProvider, $nsInfo );
45        $this->mName = 'Randomrootpage';
46        $dbr = $dbProvider->getReplicaDatabase();
47        $this->extra[] = $dbr->expr(
48            'page_title',
49            IExpression::NOT_LIKE,
50            new LikeValue( $dbr->anyString(), '/', $dbr->anyString() )
51        );
52    }
53
54    // Don't select redirects
55    public function isRedirect() {
56        return false;
57    }
58}
59
60/**
61 * Retain the old class name for backwards compatibility.
62 * @deprecated since 1.41
63 */
64class_alias( SpecialRandomRootPage::class, 'SpecialRandomRootPage' );