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
21 * @ingroup SpecialPage
25 * A special page that lists most linked pages that does not exist
27 * @ingroup SpecialPage
29 class WantedPagesPage
extends WantedQueryPage
{
32 function __construct( $inc = false, $nlinks = true ) {
33 $this->setListoutput( $inc );
34 $this->nlinks
= $nlinks;
42 global $wgWantedPagesThreshold;
43 $count = $wgWantedPagesThreshold - 1;
44 $dbr = wfGetDB( DB_SLAVE
);
45 $pagelinks = $dbr->tableName( 'pagelinks' );
46 $page = $dbr->tableName( 'page' );
47 $sql = "SELECT 'Wantedpages' AS type,
48 pl_namespace AS namespace,
52 LEFT JOIN $page AS pg1
53 ON pl_namespace = pg1.page_namespace AND pl_title = pg1.page_title
54 LEFT JOIN $page AS pg2
55 ON pl_from = pg2.page_id
56 WHERE pg1.page_namespace IS NULL
57 AND pl_namespace NOT IN ( " . NS_USER
. ", ". NS_USER_TALK
. ")
58 AND pg2.page_namespace != " . NS_MEDIAWIKI
. "
59 GROUP BY pl_namespace, pl_title
60 HAVING COUNT(*) > $count";
62 wfRunHooks( 'WantedPages::getSQL', array( &$this, &$sql ) );
70 function wfSpecialWantedpages( $par = null, $specialPage ) {
71 $inc = $specialPage->including();
74 @list
( $limit, $nlinks ) = explode( '/', $par, 2 );
76 $nlinks = $nlinks === 'nlinks';
79 list( $limit, $offset ) = wfCheckLimits();
83 $wpp = new WantedPagesPage( $inc, $nlinks );
85 $wpp->doQuery( $offset, $limit, !$inc );