0beb23c7aa6fa47ecd0049d261c1d7c8aad7d944
[lhc/web/wiklou.git] / includes / specials / SpecialLonelypages.php
1 <?php
2 /**
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 * http://www.gnu.org/copyleft/gpl.html
18 */
19
20 /**
21 * @file
22 * @ingroup SpecialPage
23 */
24
25 /**
26 * A special page looking for articles with no article linking to them,
27 * thus being lonely.
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 }