Index: branches/robchurch/reports/maintenance/language/messages.inc |
— | — | @@ -957,9 +957,8 @@ |
958 | 958 | 'nviews', |
959 | 959 | 'nchanges', |
960 | 960 | 'specialpage-empty', |
961 | | - 'lonelypages', |
962 | | - 'lonelypages-summary', |
963 | | - 'lonelypagestext', |
| 961 | + 'orphanedpages', |
| 962 | + 'orphanedpages-header', |
964 | 963 | 'unusedcategories', |
965 | 964 | 'unusedimages', |
966 | 965 | 'popularpages', |
Index: branches/robchurch/reports/maintenance/language/messageTypes.inc |
— | — | @@ -131,7 +131,6 @@ |
132 | 132 | 'userrights-summary', |
133 | 133 | 'protectedpages-summary', |
134 | 134 | 'disambiguations-summary', |
135 | | - 'lonelypages-summary', |
136 | 135 | 'unusedtemplates-summary', |
137 | 136 | 'fewestrevisions-summary', |
138 | 137 | 'variantname-zh-cn', |
Index: branches/robchurch/reports/includes/SpecialLonelypages.php |
— | — | @@ -1,60 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * |
5 | | - * @addtogroup SpecialPage |
6 | | - */ |
7 | | - |
8 | | -/** |
9 | | - * A special page looking for articles with no article linking to them, |
10 | | - * thus being lonely. |
11 | | - * @addtogroup SpecialPage |
12 | | - */ |
13 | | -class LonelyPagesPage extends PageQueryPage { |
14 | | - |
15 | | - function getName() { |
16 | | - return "Lonelypages"; |
17 | | - } |
18 | | - function getPageHeader() { |
19 | | - return wfMsgExt( 'lonelypagestext', array( 'parse' ) ); |
20 | | - } |
21 | | - |
22 | | - function sortDescending() { |
23 | | - return false; |
24 | | - } |
25 | | - |
26 | | - function isExpensive() { |
27 | | - return true; |
28 | | - } |
29 | | - function isSyndicated() { return false; } |
30 | | - |
31 | | - function getSQL() { |
32 | | - $dbr = wfGetDB( DB_SLAVE ); |
33 | | - list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' ); |
34 | | - |
35 | | - return |
36 | | - "SELECT 'Lonelypages' AS type, |
37 | | - page_namespace AS namespace, |
38 | | - page_title AS title, |
39 | | - page_title AS value |
40 | | - FROM $page |
41 | | - LEFT JOIN $pagelinks |
42 | | - ON page_namespace=pl_namespace AND page_title=pl_title |
43 | | - WHERE pl_namespace IS NULL |
44 | | - AND page_namespace=".NS_MAIN." |
45 | | - AND page_is_redirect=0"; |
46 | | - |
47 | | - } |
48 | | -} |
49 | | - |
50 | | -/** |
51 | | - * Constructor |
52 | | - */ |
53 | | -function wfSpecialLonelypages() { |
54 | | - list( $limit, $offset ) = wfCheckLimits(); |
55 | | - |
56 | | - $lpp = new LonelyPagesPage(); |
57 | | - |
58 | | - return $lpp->doQuery( $offset, $limit ); |
59 | | -} |
60 | | - |
61 | | -?> |
Index: branches/robchurch/reports/includes/reports/Report.php |
— | — | @@ -381,6 +381,7 @@ |
382 | 382 | 'DeadEndPagesReport', |
383 | 383 | 'DoubleRedirectsReport', |
384 | 384 | 'LongPagesReport', |
| 385 | + 'OrphanedPagesReport', |
385 | 386 | 'PopularPagesReport', |
386 | 387 | 'RedirectReport', |
387 | 388 | 'ShortPagesReport', |
Index: branches/robchurch/reports/includes/reports/OrphanedPagesReport.php |
— | — | @@ -0,0 +1,95 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Report generates a list of pages with no incoming links |
| 6 | + * |
| 7 | + * @addtogroup Reports |
| 8 | + * @author Rob Church <robchur@gmail.com> |
| 9 | + */ |
| 10 | +class OrphanedPagesReport extends Report { |
| 11 | + |
| 12 | + /** |
| 13 | + * Constructor |
| 14 | + */ |
| 15 | + public function __construct() { |
| 16 | + parent::__construct(); |
| 17 | + } |
| 18 | + |
| 19 | + /** |
| 20 | + * Get the name of the report |
| 21 | + * |
| 22 | + * @return string |
| 23 | + */ |
| 24 | + public function getName() { |
| 25 | + return 'Orphanedpages'; |
| 26 | + } |
| 27 | + |
| 28 | + /** |
| 29 | + * Is it appropriate to allow filtering redirects? |
| 30 | + * |
| 31 | + * @return bool |
| 32 | + */ |
| 33 | + public function allowRedirectFilter() { |
| 34 | + return true; |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * Get a list of namespaces this report can be run |
| 39 | + * against - false indicates *all* namespaces |
| 40 | + * |
| 41 | + * @return mixed |
| 42 | + */ |
| 43 | + public function getApplicableNamespaces() { |
| 44 | + return false; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Return base SQL for the report |
| 49 | + * |
| 50 | + * @param Database $dbr Database object being queried |
| 51 | + * @return string |
| 52 | + */ |
| 53 | + public function getBaseSql( $dbr ) { |
| 54 | + list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' ); |
| 55 | + return |
| 56 | + "SELECT |
| 57 | + page_id AS rp_id, |
| 58 | + page_namespace AS rp_namespace, |
| 59 | + page_title AS rp_title, |
| 60 | + page_is_redirect AS rp_redirect |
| 61 | + FROM {$page} |
| 62 | + LEFT JOIN {$pagelinks} ON |
| 63 | + pl_namespace = page_namespace |
| 64 | + AND pl_title = page_title"; |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * Return additional WHERE clauses and other conditions |
| 69 | + * to which the paging clauses will be appened when |
| 70 | + * the report runs live |
| 71 | + * |
| 72 | + * @param Database $dbr Database object being queried |
| 73 | + * @return array |
| 74 | + */ |
| 75 | + public function getExtraConditions( $dbr ) { |
| 76 | + return array( |
| 77 | + 'pl_from IS NULL', |
| 78 | + ); |
| 79 | + } |
| 80 | + |
| 81 | + /** |
| 82 | + * Format an individual result row |
| 83 | + * |
| 84 | + * @param Title $title Result title |
| 85 | + * @param object $row Result row |
| 86 | + * @param array $params Result parameters |
| 87 | + * @param Skin $skin User skin |
| 88 | + * @return string |
| 89 | + */ |
| 90 | + public function formatRow( $title, $row, $params, $skin ) { |
| 91 | + return "<li>" . $skin->makeLinkObj( $title ) . "</li>\n"; |
| 92 | + } |
| 93 | + |
| 94 | +} |
| 95 | + |
| 96 | +?> |
\ No newline at end of file |
Property changes on: branches/robchurch/reports/includes/reports/OrphanedPagesReport.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 97 | + native |
Index: branches/robchurch/reports/includes/AutoLoader.php |
— | — | @@ -181,7 +181,6 @@ |
182 | 182 | 'DBLockForm' => 'includes/SpecialLockdb.php', |
183 | 183 | 'LogReader' => 'includes/SpecialLog.php', |
184 | 184 | 'LogViewer' => 'includes/SpecialLog.php', |
185 | | - 'LonelyPagesPage' => 'includes/SpecialLonelypages.php', |
186 | 185 | 'MIMEsearchPage' => 'includes/SpecialMIMEsearch.php', |
187 | 186 | 'MostcategoriesPage' => 'includes/SpecialMostcategories.php', |
188 | 187 | 'MostimagesPage' => 'includes/SpecialMostimages.php', |
— | — | @@ -285,6 +284,7 @@ |
286 | 285 | 'DeadEndPagesReport' => 'includes/reports/DeadEndPagesReport.php', |
287 | 286 | 'DoubleRedirectsReport' => 'includes/reports/DoubleRedirectsReport.php', |
288 | 287 | 'LongPagesReport' => 'includes/reports/LongPagesReport.php', |
| 288 | + 'OrphanedPagesReport' => 'includes/reports/OrphanedPagesReport.php', |
289 | 289 | 'PopularPagesReport' => 'includes/reports/PopularPagesReport.php', |
290 | 290 | 'RedirectReport' => 'includes/reports/RedirectReport.php', |
291 | 291 | 'ShortPagesReport' => 'includes/reports/ShortPagesReport.php', |
Index: branches/robchurch/reports/includes/SpecialPage.php |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | 'Listusers' => array( 'SpecialPage', 'Listusers' ), |
92 | 92 | 'Statistics' => array( 'SpecialPage', 'Statistics' ), |
93 | 93 | 'Randompage' => array( 'SpecialPage', 'Randompage' ), |
94 | | - 'Lonelypages' => array( 'SpecialPage', 'Lonelypages' ), |
| 94 | + 'Orphanedpages' => 'OrphanedPagesReport', |
95 | 95 | 'Uncategorizedpages' => 'UncategorisedPagesReport', |
96 | 96 | 'Uncategorizedcategories' => array( 'SpecialRedirect', 'Uncategorizedpages', array( 'namespace' => NS_CATEGORY ) ), |
97 | 97 | 'Uncategorizedimages' => array( 'SpecialRedirect', 'Uncategorizedpages', array( 'namespace' => NS_IMAGE ) ), |
Index: branches/robchurch/reports/languages/messages/MessagesEn.php |
— | — | @@ -364,7 +364,7 @@ |
365 | 365 | 'Listusers' => array( 'Listusers', 'Userlist' ), |
366 | 366 | 'Statistics' => array( 'Statistics' ), |
367 | 367 | 'Randompage' => array( 'Random', 'Randompage' ), |
368 | | - 'Lonelypages' => array( 'Lonelypages', 'Orphanedpages' ), |
| 368 | + 'Orphanedpages' => array( 'Orphanedpages', 'Lonelypages' ), |
369 | 369 | 'Uncategorizedpages' => array( 'Uncategorizedpages' ), |
370 | 370 | 'Uncategorizedcategories' => array( 'Uncategorizedcategories' ), |
371 | 371 | 'Uncategorizedimages' => array( 'Uncategorizedimages' ), |
— | — | @@ -1566,9 +1566,8 @@ |
1567 | 1567 | 'nrevisions' => '$1 {{PLURAL:$1|revision|revisions}}', |
1568 | 1568 | 'nviews' => '$1 {{PLURAL:$1|view|views}}', |
1569 | 1569 | 'specialpage-empty' => 'There are no results for this report.', |
1570 | | -'lonelypages' => 'Orphaned pages', |
1571 | | -'lonelypages-summary' => '', # only translate this message to other languages if you have to change it |
1572 | | -'lonelypagestext' => 'The following pages are not linked from other pages in this wiki.', |
| 1570 | +'orphanedpages' => 'Orphaned pages', |
| 1571 | +'orphanedpages-header' => 'This report lists pages which have no incoming links.', |
1573 | 1572 | 'unusedcategories' => 'Unused categories', |
1574 | 1573 | 'unusedimages' => 'Unused files', |
1575 | 1574 | 'popularpages' => 'Popular pages', |