Index: branches/robchurch/reports/maintenance/language/messages.inc |
— | — | @@ -988,10 +988,9 @@ |
989 | 989 | 'randompage-nopages', |
990 | 990 | 'randompage-url', |
991 | 991 | 'longpages', |
992 | | - 'longpages-summary', |
| 992 | + 'longpages-header', |
993 | 993 | 'deadendpages', |
994 | | - 'deadendpages-summary', |
995 | | - 'deadendpagestext', |
| 994 | + 'deadendpages-header', |
996 | 995 | 'protectedpages', |
997 | 996 | 'protectedpages-summary', |
998 | 997 | 'protectedpagestext', |
Index: branches/robchurch/reports/maintenance/language/messageTypes.inc |
— | — | @@ -114,7 +114,6 @@ |
115 | 115 | 'booksources-summary', |
116 | 116 | 'ipblocklist-summary', |
117 | 117 | 'listusers-summary', |
118 | | - 'longpages-summary', |
119 | 118 | 'preferences-summary', |
120 | 119 | 'specialpages-summary', |
121 | 120 | 'whatlinkshere-summary', |
— | — | @@ -133,7 +132,6 @@ |
134 | 133 | 'ancientpages-summary', |
135 | 134 | 'newimages-summary', |
136 | 135 | 'userrights-summary', |
137 | | - 'deadendpages-summary', |
138 | 136 | 'protectedpages-summary', |
139 | 137 | 'disambiguations-summary', |
140 | 138 | 'lonelypages-summary', |
Index: branches/robchurch/reports/includes/SpecialLongpages.php |
— | — | @@ -1,33 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * |
5 | | - * @addtogroup SpecialPage |
6 | | - */ |
7 | | - |
8 | | -/** |
9 | | - * |
10 | | - * @addtogroup SpecialPage |
11 | | - */ |
12 | | -class LongPagesPage extends ShortPagesPage { |
13 | | - |
14 | | - function getName() { |
15 | | - return "Longpages"; |
16 | | - } |
17 | | - |
18 | | - function sortDescending() { |
19 | | - return true; |
20 | | - } |
21 | | -} |
22 | | - |
23 | | -/** |
24 | | - * constructor |
25 | | - */ |
26 | | -function wfSpecialLongpages() { |
27 | | - list( $limit, $offset ) = wfCheckLimits(); |
28 | | - |
29 | | - $lpp = new LongPagesPage(); |
30 | | - |
31 | | - $lpp->doQuery( $offset, $limit ); |
32 | | -} |
33 | | - |
34 | | -?> |
Index: branches/robchurch/reports/includes/SpecialDeadendpages.php |
— | — | @@ -1,65 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * |
5 | | - * @addtogroup SpecialPage |
6 | | - */ |
7 | | - |
8 | | -/** |
9 | | - * |
10 | | - * @addtogroup SpecialPage |
11 | | - */ |
12 | | -class DeadendPagesPage extends PageQueryPage { |
13 | | - |
14 | | - function getName( ) { |
15 | | - return "Deadendpages"; |
16 | | - } |
17 | | - |
18 | | - function getPageHeader() { |
19 | | - return wfMsgExt( 'deadendpagestext', array( 'parse' ) ); |
20 | | - } |
21 | | - |
22 | | - /** |
23 | | - * LEFT JOIN is expensive |
24 | | - * |
25 | | - * @return true |
26 | | - */ |
27 | | - function isExpensive( ) { |
28 | | - return 1; |
29 | | - } |
30 | | - |
31 | | - function isSyndicated() { return false; } |
32 | | - |
33 | | - /** |
34 | | - * @return false |
35 | | - */ |
36 | | - function sortDescending() { |
37 | | - return false; |
38 | | - } |
39 | | - |
40 | | - /** |
41 | | - * @return string an sqlquery |
42 | | - */ |
43 | | - function getSQL() { |
44 | | - $dbr = wfGetDB( DB_SLAVE ); |
45 | | - list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' ); |
46 | | - return "SELECT 'Deadendpages' as type, page_namespace AS namespace, page_title as title, page_title AS value " . |
47 | | - "FROM $page LEFT JOIN $pagelinks ON page_id = pl_from " . |
48 | | - "WHERE pl_from IS NULL " . |
49 | | - "AND page_namespace = 0 " . |
50 | | - "AND page_is_redirect = 0"; |
51 | | - } |
52 | | -} |
53 | | - |
54 | | -/** |
55 | | - * Constructor |
56 | | - */ |
57 | | -function wfSpecialDeadendpages() { |
58 | | - |
59 | | - list( $limit, $offset ) = wfCheckLimits(); |
60 | | - |
61 | | - $depp = new DeadendPagesPage(); |
62 | | - |
63 | | - return $depp->doQuery( $offset, $limit ); |
64 | | -} |
65 | | - |
66 | | -?> |
Index: branches/robchurch/reports/includes/reports/LongPagesReport.php |
— | — | @@ -0,0 +1,141 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Report generates a list of long content pages |
| 6 | + * |
| 7 | + * @addtogroup Reports |
| 8 | + * @author Rob Church <robchur@gmail.com> |
| 9 | + */ |
| 10 | +class LongPagesReport 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 'Longpages'; |
| 26 | + } |
| 27 | + |
| 28 | + /** |
| 29 | + * Get a HTML header for the top of the page |
| 30 | + * |
| 31 | + * @return string |
| 32 | + */ |
| 33 | + public function getHeader() { |
| 34 | + global $wgUser, $wgLongPagesThreshold; |
| 35 | + return wfMsgExt( 'longpages-header', 'parse', |
| 36 | + $wgUser->getSkin()->formatSize( $wgLongPagesThreshold ) ); |
| 37 | + } |
| 38 | + |
| 39 | + /** |
| 40 | + * Is it appropriate to allow filtering redirects? |
| 41 | + * |
| 42 | + * @return bool |
| 43 | + */ |
| 44 | + public function allowRedirectFilter() { |
| 45 | + return false; |
| 46 | + } |
| 47 | + |
| 48 | + /** |
| 49 | + * Should redirects be filtered from results? |
| 50 | + * |
| 51 | + * @return bool |
| 52 | + */ |
| 53 | + public function excludeRedirects() { |
| 54 | + return true; |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * Is it appropriate to allow filtering namespaces? |
| 59 | + * |
| 60 | + * @return bool |
| 61 | + */ |
| 62 | + public function allowNamespaceFilter() { |
| 63 | + return true; |
| 64 | + } |
| 65 | + |
| 66 | + /** |
| 67 | + * Get a list of namespaces this report can be run |
| 68 | + * against - false indicates *all* namespaces |
| 69 | + * |
| 70 | + * @return mixed |
| 71 | + */ |
| 72 | + public function getApplicableNamespaces() { |
| 73 | + return array( |
| 74 | + NS_MAIN, |
| 75 | + ) + $GLOBALS['wgContentNamespaces']; |
| 76 | + } |
| 77 | + |
| 78 | + /** |
| 79 | + * Return base SQL for the report |
| 80 | + * |
| 81 | + * @param Database $dbr Database object being queried |
| 82 | + * @return string |
| 83 | + */ |
| 84 | + public function getBaseSql( $dbr ) { |
| 85 | + $page = $dbr->tableName( 'page' ); |
| 86 | + # Even with the improved index, MySQL still has to be |
| 87 | + # forced to use it... |
| 88 | + $index = $dbr->useIndexClause( 'page_len' ); |
| 89 | + return |
| 90 | + "SELECT |
| 91 | + page_id AS rp_id, |
| 92 | + page_namespace AS rp_namespace, |
| 93 | + page_title AS rp_title, |
| 94 | + page_is_redirect AS rp_redirect, |
| 95 | + page_len |
| 96 | + FROM {$page} {$index}"; |
| 97 | + } |
| 98 | + |
| 99 | + /** |
| 100 | + * Return additional WHERE clauses and other conditions |
| 101 | + * to which the paging clauses will be appened when |
| 102 | + * the report runs live |
| 103 | + * |
| 104 | + * @param Database $dbr Database object being queried |
| 105 | + * @return array |
| 106 | + */ |
| 107 | + public function getExtraConditions( $dbr ) { |
| 108 | + return array( |
| 109 | + 'page_len > ' . intval( $GLOBALS['wgLongPagesThreshold'] ) |
| 110 | + ); |
| 111 | + } |
| 112 | + |
| 113 | + /** |
| 114 | + * Given a result object, extract additional parameters |
| 115 | + * as a dictionary for later use |
| 116 | + * |
| 117 | + * @param object $row Result row |
| 118 | + * @return array |
| 119 | + */ |
| 120 | + public function extractParameters( $row ) { |
| 121 | + return array( |
| 122 | + 'page_len' => $row->page_len, |
| 123 | + ); |
| 124 | + } |
| 125 | + |
| 126 | + /** |
| 127 | + * Format an individual result row |
| 128 | + * |
| 129 | + * @param Title $title Result title |
| 130 | + * @param object $row Result row |
| 131 | + * @param array $params Result parameters |
| 132 | + * @param Skin $skin User skin |
| 133 | + * @return string |
| 134 | + */ |
| 135 | + public function formatRow( $title, $row, $params, $skin ) { |
| 136 | + return '<li>' . $skin->makeLinkObj( $title ) . ' [' . $skin->formatSize( $params['page_len'] ) |
| 137 | + . "]</li>\n"; |
| 138 | + } |
| 139 | + |
| 140 | +} |
| 141 | + |
| 142 | +?> |
\ No newline at end of file |
Property changes on: branches/robchurch/reports/includes/reports/LongPagesReport.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 143 | + native |
Index: branches/robchurch/reports/includes/reports/Report.php |
— | — | @@ -362,7 +362,9 @@ |
363 | 363 | public static function getReports() { |
364 | 364 | return array( |
365 | 365 | 'BrokenRedirectsReport', |
| 366 | + 'DeadEndPagesReport', |
366 | 367 | 'DoubleRedirectsReport', |
| 368 | + 'LongPagesReport', |
367 | 369 | 'PopularPagesReport', |
368 | 370 | 'RedirectReport', |
369 | 371 | 'ShortPagesReport', |
Index: branches/robchurch/reports/includes/reports/DeadEndPagesReport.php |
— | — | @@ -0,0 +1,115 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Report generates a list of pages with no outgoing links |
| 6 | + * |
| 7 | + * @addtogroup Reports |
| 8 | + * @author Rob Church <robchur@gmail.com> |
| 9 | + */ |
| 10 | +class DeadEndPagesReport 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 'Deadendpages'; |
| 26 | + } |
| 27 | + |
| 28 | + /** |
| 29 | + * Is it appropriate to allow filtering redirects? |
| 30 | + * |
| 31 | + * @return bool |
| 32 | + */ |
| 33 | + public function allowRedirectFilter() { |
| 34 | + return false; |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * Exclude redirects? |
| 39 | + * |
| 40 | + * @return bool |
| 41 | + */ |
| 42 | + public function excludeRedirects() { |
| 43 | + return true; |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * Get a list of namespaces this report can be run |
| 48 | + * against - false indicates *all* namespaces |
| 49 | + * |
| 50 | + * @return mixed |
| 51 | + */ |
| 52 | + public function getApplicableNamespaces() { |
| 53 | + return array( |
| 54 | + NS_MAIN, |
| 55 | + ) + $GLOBALS['wgContentNamespaces']; |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * Return base SQL for the report |
| 60 | + * |
| 61 | + * @param Database $dbr Database object being queried |
| 62 | + * @return string |
| 63 | + */ |
| 64 | + public function getBaseSql( $dbr ) { |
| 65 | + list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' ); |
| 66 | + return |
| 67 | + "SELECT |
| 68 | + page_id AS rp_id, |
| 69 | + page_namespace AS rp_namespace, |
| 70 | + page_title AS rp_title, |
| 71 | + page_is_redirect AS rp_redirect |
| 72 | + FROM {$page} |
| 73 | + LEFT JOIN {$pagelinks} ON page_id = pl_from"; |
| 74 | + } |
| 75 | + |
| 76 | + /** |
| 77 | + * Return additional WHERE clauses and other conditions |
| 78 | + * to which the paging clauses will be appened when |
| 79 | + * the report runs live |
| 80 | + * |
| 81 | + * @param Database $dbr Database object being queried |
| 82 | + * @return array |
| 83 | + */ |
| 84 | + public function getExtraConditions( $dbr ) { |
| 85 | + return array( |
| 86 | + 'pl_title IS NULL', |
| 87 | + ); |
| 88 | + } |
| 89 | + |
| 90 | + /** |
| 91 | + * Given a result object, extract additional parameters |
| 92 | + * as a dictionary for later use |
| 93 | + * |
| 94 | + * @param object $row Result row |
| 95 | + * @return array |
| 96 | + */ |
| 97 | + public function extractParameters( $row ) { |
| 98 | + return array(); |
| 99 | + } |
| 100 | + |
| 101 | + /** |
| 102 | + * Format an individual result row |
| 103 | + * |
| 104 | + * @param Title $title Result title |
| 105 | + * @param object $row Result row |
| 106 | + * @param array $params Result parameters |
| 107 | + * @param Skin $skin User skin |
| 108 | + * @return string |
| 109 | + */ |
| 110 | + public function formatRow( $title, $row, $params, $skin ) { |
| 111 | + return "<li>" . $skin->makeLinkObj( $title ) . "</li>\n"; |
| 112 | + } |
| 113 | + |
| 114 | +} |
| 115 | + |
| 116 | +?> |
\ No newline at end of file |
Property changes on: branches/robchurch/reports/includes/reports/DeadEndPagesReport.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 117 | + native |
Index: branches/robchurch/reports/includes/AutoLoader.php |
— | — | @@ -172,7 +172,6 @@ |
173 | 173 | 'SpecialBookSources' => 'includes/SpecialBooksources.php', |
174 | 174 | 'EmailConfirmation' => 'includes/SpecialConfirmemail.php', |
175 | 175 | 'ContributionsPage' => 'includes/SpecialContributions.php', |
176 | | - 'DeadendPagesPage' => 'includes/SpecialDeadendpages.php', |
177 | 176 | 'DisambiguationsPage' => 'includes/SpecialDisambiguations.php', |
178 | 177 | 'EmailUserForm' => 'includes/SpecialEmailuser.php', |
179 | 178 | 'WikiRevision' => 'includes/SpecialImport.php', |
— | — | @@ -184,7 +183,6 @@ |
185 | 184 | 'LogReader' => 'includes/SpecialLog.php', |
186 | 185 | 'LogViewer' => 'includes/SpecialLog.php', |
187 | 186 | 'LonelyPagesPage' => 'includes/SpecialLonelypages.php', |
188 | | - 'LongPagesPage' => 'includes/SpecialLongpages.php', |
189 | 187 | 'MIMEsearchPage' => 'includes/SpecialMIMEsearch.php', |
190 | 188 | 'MostcategoriesPage' => 'includes/SpecialMostcategories.php', |
191 | 189 | 'MostimagesPage' => 'includes/SpecialMostimages.php', |
— | — | @@ -286,7 +284,9 @@ |
287 | 285 | 'CachedReportPager' => 'includes/reports/CachedReportPager.php', |
288 | 286 | |
289 | 287 | 'BrokenRedirectsReport' => 'includes/reports/BrokenRedirectsReport.php', |
| 288 | + 'DeadEndPagesReport' => 'includes/reports/DeadEndPagesReport.php', |
290 | 289 | 'DoubleRedirectsReport' => 'includes/reports/DoubleRedirectsReport.php', |
| 290 | + 'LongPagesReport' => 'includes/reports/LongPagesReport.php', |
291 | 291 | 'PopularPagesReport' => 'includes/reports/PopularPagesReport.php', |
292 | 292 | 'RedirectReport' => 'includes/reports/RedirectReport.php', |
293 | 293 | 'ShortPagesReport' => 'includes/reports/ShortPagesReport.php', |
Index: branches/robchurch/reports/includes/DefaultSettings.php |
— | — | @@ -1383,6 +1383,12 @@ |
1384 | 1384 | $wgShortPagesThreshold = 250; |
1385 | 1385 | |
1386 | 1386 | /** |
| 1387 | + * Pages larger than this number of bytes will be |
| 1388 | + * considered "long" for the purposes of Special:Longpages |
| 1389 | + */ |
| 1390 | +$wgLongPagesThreshold = 80 * 1024; |
| 1391 | + |
| 1392 | +/** |
1387 | 1393 | * Maps jobs to their handling classes; extensions |
1388 | 1394 | * can add to this to provide custom jobs |
1389 | 1395 | */ |
Index: branches/robchurch/reports/includes/QueryPage.php |
— | — | @@ -15,10 +15,8 @@ |
16 | 16 | // QueryPage subclass Special page name Limit (false for none, none for the default) |
17 | 17 | //---------------------------------------------------------------------------- |
18 | 18 | array( 'AncientPagesPage', 'Ancientpages' ), |
19 | | - array( 'DeadendPagesPage', 'Deadendpages' ), |
20 | 19 | array( 'DisambiguationsPage', 'Disambiguations' ), |
21 | 20 | array( 'LonelyPagesPage', 'Lonelypages' ), |
22 | | - array( 'LongPagesPage', 'Longpages' ), |
23 | 21 | array( 'MostcategoriesPage', 'Mostcategories' ), |
24 | 22 | array( 'MostimagesPage', 'Mostimages' ), |
25 | 23 | array( 'MostlinkedCategoriesPage', 'Mostlinkedcategories' ), |
Index: branches/robchurch/reports/includes/SpecialPage.php |
— | — | @@ -107,10 +107,10 @@ |
108 | 108 | 'Mostrevisions' => array( 'SpecialPage', 'Mostrevisions' ), |
109 | 109 | 'Fewestrevisions' => array( 'SpecialPage', 'Fewestrevisions' ), |
110 | 110 | 'Shortpages' => 'ShortPagesReport', |
111 | | - 'Longpages' => array( 'SpecialPage', 'Longpages' ), |
| 111 | + 'Longpages' => 'LongPagesReport', |
112 | 112 | 'Newpages' => 'SpecialNewPages',//array( 'IncludableSpecialPage', 'Newpages' ), |
113 | 113 | 'Ancientpages' => array( 'SpecialPage', 'Ancientpages' ), |
114 | | - 'Deadendpages' => array( 'SpecialPage', 'Deadendpages' ), |
| 114 | + 'Deadendpages' => 'DeadEndPagesReport', |
115 | 115 | 'Protectedpages' => array( 'SpecialPage', 'Protectedpages' ), |
116 | 116 | 'Allpages' => array( 'IncludableSpecialPage', 'Allpages' ), |
117 | 117 | 'Prefixindex' => array( 'IncludableSpecialPage', 'Prefixindex' ) , |
Index: branches/robchurch/reports/languages/messages/MessagesEn.php |
— | — | @@ -1597,10 +1597,9 @@ |
1598 | 1598 | 'randompage-nopages' => 'There are no pages in this namespace.', |
1599 | 1599 | 'randompage-url' => 'Special:Random', # don't translate or duplicate this message to other languages |
1600 | 1600 | 'longpages' => 'Long pages', |
1601 | | -'longpages-summary' => '', # only translate this message to other languages if you have to change it |
| 1601 | +'longpages-header' => 'This report lists pages which are longer than $1.', |
1602 | 1602 | 'deadendpages' => 'Dead-end pages', |
1603 | | -'deadendpages-summary' => '', # only translate this message to other languages if you have to change it |
1604 | | -'deadendpagestext' => 'The following pages do not link to other pages in this wiki.', |
| 1603 | +'deadendpages-header' => 'This report lists pages which contain no outgoing links.', |
1605 | 1604 | 'protectedpages' => 'Protected pages', |
1606 | 1605 | 'protectedpages-summary' => '', # only translate this message to other languages if you have to change it |
1607 | 1606 | 'protectedpagestext' => 'The following pages are protected from moving or editing', |