Rm old options from commandLine.inc days
[mediawiki.git] / includes / specials / SpecialWantedpages.php
bloba42331555e8b9f66040075f04eaf141c96dc7278
1 <?php
2 /**
3 * Implements Special:Wantedpages
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
21 * @ingroup SpecialPage
24 /**
25 * A special page that lists most linked pages that does not exist
27 * @ingroup SpecialPage
29 class WantedPagesPage extends WantedQueryPage {
30 function __construct( $name = 'Wantedpages' ) {
31 parent::__construct( $name );
32 $this->includable( true );
35 function execute( $par ) {
36 $inc = $this->including();
38 if ( $inc ) {
39 $parts = explode( '/', $par, 2 );
40 $this->limit = (int)$parts[0];
41 // @todo FIXME: nlinks is ignored
42 $nlinks = isset( $parts[1] ) && $parts[1] === 'nlinks';
43 $this->offset = 0;
44 } else {
45 $nlinks = true;
47 $this->setListOutput( $inc );
48 $this->shownavigation = !$inc;
49 parent::execute( $par );
52 function getQueryInfo() {
53 global $wgWantedPagesThreshold;
54 $count = $wgWantedPagesThreshold - 1;
55 $query = array(
56 'tables' => array(
57 'pagelinks',
58 'pg1' => 'page',
59 'pg2' => 'page'
61 'fields' => array(
62 'pl_namespace AS namespace',
63 'pl_title AS title',
64 'COUNT(*) AS value'
66 'conds' => array(
67 'pg1.page_namespace IS NULL',
68 "pl_namespace NOT IN ( '" . NS_USER .
69 "', '" . NS_USER_TALK . "' )",
70 "pg2.page_namespace != '" . NS_MEDIAWIKI . "'"
72 'options' => array(
73 'HAVING' => "COUNT(*) > $count",
74 'GROUP BY' => 'pl_namespace, pl_title'
76 'join_conds' => array(
77 'pg1' => array(
78 'LEFT JOIN', array(
79 'pg1.page_namespace = pl_namespace',
80 'pg1.page_title = pl_title'
83 'pg2' => array( 'LEFT JOIN', 'pg2.page_id = pl_from' )
86 // Replacement for the WantedPages::getSQL hook
87 wfRunHooks( 'WantedPages::getQueryInfo', array( &$this, &$query ) );
88 return $query;