Add a way for packagers to override some installation details
[mediawiki.git] / includes / specials / SpecialWantedpages.php
blob9f5d52d5cba3d4dabbbd8b5b363ef66c70b79fa7
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 {
31 function __construct( $name = 'Wantedpages' ) {
32 parent::__construct( $name );
33 $this->mIncludable = true;
36 function execute( $par ) {
37 $inc = $this->including();
39 if ( $inc ) {
40 $parts = explode( '/', $par, 2 );
41 $this->limit = (int)$parts[0];
42 // @todo FIXME: nlinks is ignored
43 //$nlinks = isset( $parts[1] ) && $parts[1] === 'nlinks';
44 $this->offset = 0;
45 } else {
46 //$nlinks = true;
48 $this->setListoutput( $inc );
49 $this->shownavigation = !$inc;
50 parent::execute( $par );
53 function getQueryInfo() {
54 global $wgWantedPagesThreshold;
55 $count = $wgWantedPagesThreshold - 1;
56 $query = array(
57 'tables' => array(
58 'pagelinks',
59 'pg1' => 'page',
60 'pg2' => 'page'
62 'fields' => array(
63 'pl_namespace AS namespace',
64 'pl_title AS title',
65 'COUNT(*) AS value'
67 'conds' => array(
68 'pg1.page_namespace IS NULL',
69 "pl_namespace NOT IN ( '" . NS_USER .
70 "', '" . NS_USER_TALK . "' )",
71 "pg2.page_namespace != '" . NS_MEDIAWIKI . "'"
73 'options' => array(
74 'HAVING' => "COUNT(*) > $count",
75 'GROUP BY' => array( 'pl_namespace', 'pl_title' )
77 'join_conds' => array(
78 'pg1' => array(
79 'LEFT JOIN', array(
80 'pg1.page_namespace = pl_namespace',
81 'pg1.page_title = pl_title'
84 'pg2' => array( 'LEFT JOIN', 'pg2.page_id = pl_from' )
87 // Replacement for the WantedPages::getSQL hook
88 wfRunHooks( 'WantedPages::getQueryInfo', array( &$this, &$query ) );
89 return $query;