0788037f36606b268b55dd6662951f2bfe974244
[lhc/web/wiklou.git] / includes / specials / SpecialLonelypages.php
1 <?php
2 /**
3 * Implements Special:Lonelypaages
4 *
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.
9 *
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.
14 *
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
19 *
20 * @file
21 * @ingroup SpecialPage
22 */
23
24 /**
25 * A special page looking for articles with no article linking to them,
26 * thus being lonely.
27 *
28 * @ingroup SpecialPage
29 */
30 class LonelyPagesPage extends PageQueryPage {
31
32 function getName() {
33 return "Lonelypages";
34 }
35 function getPageHeader() {
36 return wfMsgExt( 'lonelypagestext', array( 'parse' ) );
37 }
38
39 function sortDescending() {
40 return false;
41 }
42
43 function isExpensive() {
44 return true;
45 }
46 function isSyndicated() { return false; }
47
48 function getSQL() {
49 $dbr = wfGetDB( DB_SLAVE );
50 list( $page, $pagelinks, $templatelinks ) = $dbr->tableNamesN( 'page', 'pagelinks', 'templatelinks' );
51
52 return
53 "SELECT 'Lonelypages' AS type,
54 page_namespace AS namespace,
55 page_title AS title,
56 page_title AS value
57 FROM $page
58 LEFT JOIN $pagelinks
59 ON page_namespace=pl_namespace AND page_title=pl_title
60 LEFT JOIN $templatelinks
61 ON page_namespace=tl_namespace AND page_title=tl_title
62 WHERE pl_namespace IS NULL
63 AND page_namespace=".NS_MAIN."
64 AND page_is_redirect=0
65 AND tl_namespace IS NULL";
66
67 }
68 }
69
70 /**
71 * Constructor
72 */
73 function wfSpecialLonelypages() {
74 list( $limit, $offset ) = wfCheckLimits();
75
76 $lpp = new LonelyPagesPage();
77
78 return $lpp->doQuery( $offset, $limit );
79 }