]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - includes/specials/SpecialLonelypages.php
MediaWiki 1.16.1-scripts
[autoinstallsdev/mediawiki.git] / includes / specials / SpecialLonelypages.php
1 <?php
2 /**
3  * @file
4  * @ingroup SpecialPage
5  */
6
7 /**
8  * A special page looking for articles with no article linking to them,
9  * thus being lonely.
10  * @ingroup SpecialPage
11  */
12 class LonelyPagesPage extends PageQueryPage {
13
14         function getName() {
15                 return "Lonelypages";
16         }
17         function getPageHeader() {
18                 return wfMsgExt( 'lonelypagestext', array( 'parse' ) );
19         }
20
21         function sortDescending() {
22                 return false;
23         }
24
25         function isExpensive() {
26                 return true;
27         }
28         function isSyndicated() { return false; }
29
30         function getSQL() {
31                 $dbr = wfGetDB( DB_SLAVE );
32                 list( $page, $pagelinks, $templatelinks ) = $dbr->tableNamesN( 'page', 'pagelinks', 'templatelinks' );
33
34                 return
35                   "SELECT 'Lonelypages'  AS type,
36                           page_namespace AS namespace,
37                           page_title     AS title,
38                           page_title     AS value
39                      FROM $page
40                 LEFT JOIN $pagelinks
41                        ON page_namespace=pl_namespace AND page_title=pl_title
42                 LEFT JOIN $templatelinks
43                                 ON page_namespace=tl_namespace AND page_title=tl_title
44                     WHERE pl_namespace IS NULL
45                       AND page_namespace=".NS_MAIN."
46                       AND page_is_redirect=0
47                           AND tl_namespace IS NULL";
48
49         }
50 }
51
52 /**
53  * Constructor
54  */
55 function wfSpecialLonelypages() {
56         list( $limit, $offset ) = wfCheckLimits();
57
58         $lpp = new LonelyPagesPage();
59
60         return $lpp->doQuery( $offset, $limit );
61 }