Index: branches/robchurch/reports/maintenance/language/messages.inc |
— | — | @@ -919,7 +919,7 @@ |
920 | 920 | ), |
921 | 921 | 'fewestrevisions' => array( |
922 | 922 | 'fewestrevisions', |
923 | | - 'fewestrevisions-summary', |
| 923 | + 'fewestrevisions-header', |
924 | 924 | ), |
925 | 925 | 'uncategorizedpages' => array( |
926 | 926 | 'uncategorizedpages', |
Index: branches/robchurch/reports/includes/SpecialMostrevisions.php |
— | — | @@ -1,66 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * A special page to show pages in the |
5 | | - * |
6 | | - * @addtogroup SpecialPage |
7 | | - * |
8 | | - * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com> |
9 | | - * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason |
10 | | - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
11 | | - */ |
12 | | - |
13 | | -/** |
14 | | - * @addtogroup SpecialPage |
15 | | - */ |
16 | | -class MostrevisionsPage extends QueryPage { |
17 | | - |
18 | | - function getName() { return 'Mostrevisions'; } |
19 | | - function isExpensive() { return true; } |
20 | | - function isSyndicated() { return false; } |
21 | | - |
22 | | - function getSQL() { |
23 | | - $dbr = wfGetDB( DB_SLAVE ); |
24 | | - list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' ); |
25 | | - return |
26 | | - " |
27 | | - SELECT |
28 | | - 'Mostrevisions' as type, |
29 | | - page_namespace as namespace, |
30 | | - page_title as title, |
31 | | - COUNT(*) as value |
32 | | - FROM $revision |
33 | | - JOIN $page ON page_id = rev_page |
34 | | - WHERE page_namespace = " . NS_MAIN . " |
35 | | - GROUP BY 1,2,3 |
36 | | - HAVING COUNT(*) > 1 |
37 | | - "; |
38 | | - } |
39 | | - |
40 | | - function formatResult( $skin, $result ) { |
41 | | - global $wgLang, $wgContLang; |
42 | | - |
43 | | - $nt = Title::makeTitle( $result->namespace, $result->title ); |
44 | | - $text = $wgContLang->convert( $nt->getPrefixedText() ); |
45 | | - |
46 | | - $plink = $skin->makeKnownLinkObj( $nt, $text ); |
47 | | - |
48 | | - $nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape'), |
49 | | - $wgLang->formatNum( $result->value ) ); |
50 | | - $nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' ); |
51 | | - |
52 | | - return wfSpecialList($plink, $nlink); |
53 | | - } |
54 | | -} |
55 | | - |
56 | | -/** |
57 | | - * constructor |
58 | | - */ |
59 | | -function wfSpecialMostrevisions() { |
60 | | - list( $limit, $offset ) = wfCheckLimits(); |
61 | | - |
62 | | - $wpp = new MostrevisionsPage(); |
63 | | - |
64 | | - $wpp->doQuery( $offset, $limit ); |
65 | | -} |
66 | | - |
67 | | -?> |
Index: branches/robchurch/reports/includes/SpecialFewestrevisions.php |
— | — | @@ -1,65 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Special page for listing the articles with the fewest revisions. |
6 | | - * |
7 | | - * @package MediaWiki |
8 | | - * @addtogroup SpecialPage |
9 | | - * @author Martin Drashkov |
10 | | - */ |
11 | | -class FewestrevisionsPage extends QueryPage { |
12 | | - |
13 | | - function getName() { |
14 | | - return 'Fewestrevisions'; |
15 | | - } |
16 | | - |
17 | | - function isExpensive() { |
18 | | - return true; |
19 | | - } |
20 | | - |
21 | | - function isSyndicated() { |
22 | | - return false; |
23 | | - } |
24 | | - |
25 | | - function getSql() { |
26 | | - $dbr = wfGetDB( DB_SLAVE ); |
27 | | - list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' ); |
28 | | - |
29 | | - return "SELECT 'Fewestrevisions' as type, |
30 | | - page_namespace as namespace, |
31 | | - page_title as title, |
32 | | - COUNT(*) as value |
33 | | - FROM $revision |
34 | | - JOIN $page ON page_id = rev_page |
35 | | - WHERE page_namespace = " . NS_MAIN . " |
36 | | - GROUP BY 1,2,3 |
37 | | - HAVING COUNT(*) > 1"; |
38 | | - } |
39 | | - |
40 | | - function sortDescending() { |
41 | | - return false; |
42 | | - } |
43 | | - |
44 | | - function formatResult( $skin, $result ) { |
45 | | - global $wgLang, $wgContLang; |
46 | | - |
47 | | - $nt = Title::makeTitleSafe( $result->namespace, $result->title ); |
48 | | - $text = $wgContLang->convert( $nt->getPrefixedText() ); |
49 | | - |
50 | | - $plink = $skin->makeKnownLinkObj( $nt, $text ); |
51 | | - |
52 | | - $nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape'), |
53 | | - $wgLang->formatNum( $result->value ) ); |
54 | | - $nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' ); |
55 | | - |
56 | | - return wfSpecialList( $plink, $nlink ); |
57 | | - } |
58 | | -} |
59 | | - |
60 | | -function wfSpecialFewestrevisions() { |
61 | | - list( $limit, $offset ) = wfCheckLimits(); |
62 | | - $frp = new FewestrevisionsPage(); |
63 | | - $frp->doQuery( $offset, $limit ); |
64 | | -} |
65 | | - |
66 | | -?> |
Index: branches/robchurch/reports/includes/reports/FewestRevisionsReport.php |
— | — | @@ -0,0 +1,151 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Report lists pages with the fewest revisions |
| 6 | + * |
| 7 | + * @addtogroup Reports |
| 8 | + * @author Rob Church <robchur@gmail.com> |
| 9 | + */ |
| 10 | +class FewestRevisionsReport 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 'Fewestrevisions'; |
| 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 | + * Should redirects be filtered from results? |
| 39 | + * |
| 40 | + * @return bool |
| 41 | + */ |
| 42 | + public function excludeRedirects() { |
| 43 | + return true; |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * Is it appropriate to allow filtering namespaces? |
| 48 | + * |
| 49 | + * @return bool |
| 50 | + */ |
| 51 | + public function allowNamespaceFilter() { |
| 52 | + return true; |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * Get a list of namespaces this report can be run |
| 57 | + * against - false indicates *all* namespaces |
| 58 | + * |
| 59 | + * @return mixed |
| 60 | + */ |
| 61 | + public function getApplicableNamespaces() { |
| 62 | + return array( |
| 63 | + NS_MAIN, |
| 64 | + ) + $GLOBALS['wgContentNamespaces']; |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * Return base SQL for the report |
| 69 | + * |
| 70 | + * @param Database $dbr Database object being queried |
| 71 | + * @return string |
| 72 | + */ |
| 73 | + public function getBaseSql( $dbr ) { |
| 74 | + list( $page, $revision ) = $dbr->tableNamesN( 'page', 'revision' ); |
| 75 | + return |
| 76 | + "SELECT |
| 77 | + page_id AS rp_id, |
| 78 | + page_namespace AS rp_namespace, |
| 79 | + page_title AS rp_title, |
| 80 | + page_is_redirect AS rp_redirect, |
| 81 | + COUNT(*) AS count |
| 82 | + FROM {$revision} |
| 83 | + LEFT JOIN {$page} ON rev_page = page_id"; |
| 84 | + } |
| 85 | + |
| 86 | + /** |
| 87 | + * Return additional WHERE clauses and other conditions |
| 88 | + * to which the paging clauses will be appened when |
| 89 | + * the report runs live |
| 90 | + * |
| 91 | + * @param Database $dbr Database object being queried |
| 92 | + * @return array |
| 93 | + */ |
| 94 | + public function getExtraConditions( $dbr ) { |
| 95 | + return array(); |
| 96 | + } |
| 97 | + |
| 98 | + /** |
| 99 | + * Get additional SQL to be inserted between the |
| 100 | + * conditions and ORDER clauses when the report is run live |
| 101 | + * |
| 102 | + * @param Database $dbr Database object being queried |
| 103 | + * @return string |
| 104 | + */ |
| 105 | + public function getExtraSql( $dbr ) { |
| 106 | + return ' GROUP BY 1, 2, 3'; |
| 107 | + } |
| 108 | + |
| 109 | + /** |
| 110 | + * Get ORDER BY clauses to be applied when the |
| 111 | + * report is run live |
| 112 | + * |
| 113 | + * @return array |
| 114 | + */ |
| 115 | + public function getOrderingClauses() { |
| 116 | + return array( |
| 117 | + 'count ASC', |
| 118 | + ); |
| 119 | + } |
| 120 | + |
| 121 | + /** |
| 122 | + * Given a result object, extract additional parameters |
| 123 | + * as a dictionary for later use |
| 124 | + * |
| 125 | + * @param object $row Result row |
| 126 | + * @return array |
| 127 | + */ |
| 128 | + public function extractParameters( $row ) { |
| 129 | + return array( |
| 130 | + 'count' => $row->count, |
| 131 | + ); |
| 132 | + } |
| 133 | + |
| 134 | + /** |
| 135 | + * Format an individual result row |
| 136 | + * |
| 137 | + * @param Title $title Result title |
| 138 | + * @param object $row Result row |
| 139 | + * @param array $params Result parameters |
| 140 | + * @param Skin $skin User skin |
| 141 | + * @return string |
| 142 | + */ |
| 143 | + public function formatRow( $title, $row, $params, $skin ) { |
| 144 | + global $wgLang; |
| 145 | + $revs = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape' ), |
| 146 | + $wgLang->formatNum( $params['count'] ) ); |
| 147 | + return "<li>" . $skin->makeLinkObj( $title ) . " ({$revs})</li>\n"; |
| 148 | + } |
| 149 | + |
| 150 | +} |
| 151 | + |
| 152 | +?> |
\ No newline at end of file |
Property changes on: branches/robchurch/reports/includes/reports/FewestRevisionsReport.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 153 | + native |
Index: branches/robchurch/reports/includes/reports/Report.php |
— | — | @@ -380,10 +380,12 @@ |
381 | 381 | 'BrokenRedirectsReport', |
382 | 382 | 'DeadEndPagesReport', |
383 | 383 | 'DoubleRedirectsReport', |
| 384 | + 'FewestRevisionsReport', |
384 | 385 | 'LargestCategoriesReport', |
385 | 386 | 'LongPagesReport', |
386 | 387 | 'MostCategoriesReport', |
387 | 388 | 'MostLinkedPagesReport', |
| 389 | + 'MostRevisionsReport', |
388 | 390 | 'MostUsedImagesReport', |
389 | 391 | 'MostUsedTemplatesReport', |
390 | 392 | 'OrphanedPagesReport', |
Index: branches/robchurch/reports/includes/reports/MostRevisionsReport.php |
— | — | @@ -0,0 +1,151 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Report lists pages with the most revisions |
| 6 | + * |
| 7 | + * @addtogroup Reports |
| 8 | + * @author Rob Church <robchur@gmail.com> |
| 9 | + */ |
| 10 | +class MostRevisionsReport 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 'Mostrevisions'; |
| 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 | + * Should redirects be filtered from results? |
| 39 | + * |
| 40 | + * @return bool |
| 41 | + */ |
| 42 | + public function excludeRedirects() { |
| 43 | + return true; |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * Is it appropriate to allow filtering namespaces? |
| 48 | + * |
| 49 | + * @return bool |
| 50 | + */ |
| 51 | + public function allowNamespaceFilter() { |
| 52 | + return true; |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * Get a list of namespaces this report can be run |
| 57 | + * against - false indicates *all* namespaces |
| 58 | + * |
| 59 | + * @return mixed |
| 60 | + */ |
| 61 | + public function getApplicableNamespaces() { |
| 62 | + return array( |
| 63 | + NS_MAIN, |
| 64 | + ) + $GLOBALS['wgContentNamespaces']; |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * Return base SQL for the report |
| 69 | + * |
| 70 | + * @param Database $dbr Database object being queried |
| 71 | + * @return string |
| 72 | + */ |
| 73 | + public function getBaseSql( $dbr ) { |
| 74 | + list( $page, $revision ) = $dbr->tableNamesN( 'page', 'revision' ); |
| 75 | + return |
| 76 | + "SELECT |
| 77 | + page_id AS rp_id, |
| 78 | + page_namespace AS rp_namespace, |
| 79 | + page_title AS rp_title, |
| 80 | + page_is_redirect AS rp_redirect, |
| 81 | + COUNT(*) AS count |
| 82 | + FROM {$revision} |
| 83 | + LEFT JOIN {$page} ON rev_page = page_id"; |
| 84 | + } |
| 85 | + |
| 86 | + /** |
| 87 | + * Return additional WHERE clauses and other conditions |
| 88 | + * to which the paging clauses will be appened when |
| 89 | + * the report runs live |
| 90 | + * |
| 91 | + * @param Database $dbr Database object being queried |
| 92 | + * @return array |
| 93 | + */ |
| 94 | + public function getExtraConditions( $dbr ) { |
| 95 | + return array(); |
| 96 | + } |
| 97 | + |
| 98 | + /** |
| 99 | + * Get additional SQL to be inserted between the |
| 100 | + * conditions and ORDER clauses when the report is run live |
| 101 | + * |
| 102 | + * @param Database $dbr Database object being queried |
| 103 | + * @return string |
| 104 | + */ |
| 105 | + public function getExtraSql( $dbr ) { |
| 106 | + return ' GROUP BY 1, 2, 3'; |
| 107 | + } |
| 108 | + |
| 109 | + /** |
| 110 | + * Get ORDER BY clauses to be applied when the |
| 111 | + * report is run live |
| 112 | + * |
| 113 | + * @return array |
| 114 | + */ |
| 115 | + public function getOrderingClauses() { |
| 116 | + return array( |
| 117 | + 'count DESC', |
| 118 | + ); |
| 119 | + } |
| 120 | + |
| 121 | + /** |
| 122 | + * Given a result object, extract additional parameters |
| 123 | + * as a dictionary for later use |
| 124 | + * |
| 125 | + * @param object $row Result row |
| 126 | + * @return array |
| 127 | + */ |
| 128 | + public function extractParameters( $row ) { |
| 129 | + return array( |
| 130 | + 'count' => $row->count, |
| 131 | + ); |
| 132 | + } |
| 133 | + |
| 134 | + /** |
| 135 | + * Format an individual result row |
| 136 | + * |
| 137 | + * @param Title $title Result title |
| 138 | + * @param object $row Result row |
| 139 | + * @param array $params Result parameters |
| 140 | + * @param Skin $skin User skin |
| 141 | + * @return string |
| 142 | + */ |
| 143 | + public function formatRow( $title, $row, $params, $skin ) { |
| 144 | + global $wgLang; |
| 145 | + $revs = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape' ), |
| 146 | + $wgLang->formatNum( $params['count'] ) ); |
| 147 | + return "<li>" . $skin->makeLinkObj( $title ) . " ({$revs})</li>\n"; |
| 148 | + } |
| 149 | + |
| 150 | +} |
| 151 | + |
| 152 | +?> |
\ No newline at end of file |
Property changes on: branches/robchurch/reports/includes/reports/MostRevisionsReport.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 153 | + native |
Index: branches/robchurch/reports/includes/AutoLoader.php |
— | — | @@ -182,8 +182,6 @@ |
183 | 183 | 'LogReader' => 'includes/SpecialLog.php', |
184 | 184 | 'LogViewer' => 'includes/SpecialLog.php', |
185 | 185 | 'MIMEsearchPage' => 'includes/SpecialMIMEsearch.php', |
186 | | - 'MostrevisionsPage' => 'includes/SpecialMostrevisions.php', |
187 | | - 'FewestrevisionsPage' => 'includes/SpecialFewestrevisions.php', |
188 | 186 | 'MovePageForm' => 'includes/SpecialMovepage.php', |
189 | 187 | 'NewbieContributionsPage' => 'includes/SpecialNewbieContributions.php', |
190 | 188 | 'SpecialNewPages' => 'includes/SpecialNewpages.php', |
— | — | @@ -278,10 +276,12 @@ |
279 | 277 | 'BrokenRedirectsReport' => 'includes/reports/BrokenRedirectsReport.php', |
280 | 278 | 'DeadEndPagesReport' => 'includes/reports/DeadEndPagesReport.php', |
281 | 279 | 'DoubleRedirectsReport' => 'includes/reports/DoubleRedirectsReport.php', |
| 280 | + 'FewestRevisionsReport' => 'includes/reports/FewestRevisionsReport.php', |
282 | 281 | 'LargestCategoriesReport' => 'includes/reports/LargestCategoriesReport.php', |
283 | 282 | 'LongPagesReport' => 'includes/reports/LongPagesReport.php', |
284 | 283 | 'MostCategoriesReport' => 'includes/reports/MostCategoriesReport.php', |
285 | 284 | 'MostLinkedPagesReport' => 'includes/reports/MostLinkedPagesReport.php', |
| 285 | + 'MostRevisionsReport' => 'includes/reports/MostRevisionsReport.php', |
286 | 286 | 'MostUsedImagesReport' => 'includes/reports/MostUsedImagesReport.php', |
287 | 287 | 'MostUsedTemplatesReport' => 'includes/reports/MostUsedTemplatesReport.php', |
288 | 288 | 'OrphanedPagesReport' => 'includes/reports/OrphanedPagesReport.php', |
Index: branches/robchurch/reports/includes/QueryPage.php |
— | — | @@ -16,8 +16,6 @@ |
17 | 17 | //---------------------------------------------------------------------------- |
18 | 18 | array( 'DisambiguationsPage', 'Disambiguations' ), |
19 | 19 | array( 'MostimagesPage', 'Mostimages' ), |
20 | | - array( 'MostrevisionsPage', 'Mostrevisions' ), |
21 | | - array( 'FewestrevisionsPage', 'Fewestrevisions' ), |
22 | 20 | array( 'UnusedCategoriesPage', 'Unusedcategories' ), |
23 | 21 | array( 'UnusedimagesPage', 'Unusedimages' ), |
24 | 22 | array( 'UnusedtemplatesPage', 'Unusedtemplates' ), |
Index: branches/robchurch/reports/includes/SpecialPage.php |
— | — | @@ -104,8 +104,8 @@ |
105 | 105 | 'Mostlinkedtemplates' => 'MostUsedTemplatesReport', |
106 | 106 | 'Mostcategories' => 'MostCategoriesReport', |
107 | 107 | 'Mostusedimages' => 'MostUsedImagesReport', |
108 | | - 'Mostrevisions' => array( 'SpecialPage', 'Mostrevisions' ), |
109 | | - 'Fewestrevisions' => array( 'SpecialPage', 'Fewestrevisions' ), |
| 108 | + 'Mostrevisions' => 'MostRevisionsReport', |
| 109 | + 'Fewestrevisions' => 'FewestRevisionsReport', |
110 | 110 | 'Shortpages' => 'ShortPagesReport', |
111 | 111 | 'Longpages' => 'LongPagesReport', |
112 | 112 | 'Newpages' => 'SpecialNewPages',//array( 'IncludableSpecialPage', 'Newpages' ), |
Index: branches/robchurch/reports/languages/messages/MessagesEn.php |
— | — | @@ -1528,8 +1528,8 @@ |
1529 | 1529 | 'withoutinterwiki-header' => 'This report lists pages which do not link to other language editions.', |
1530 | 1530 | |
1531 | 1531 | # Fewest revisions report |
1532 | | -'fewestrevisions' => 'Articles with the fewest revisions', |
1533 | | -'fewestrevisions-summary' => '', # only translate this message to other languages if you have to change it |
| 1532 | +'fewestrevisions' => 'Pages with the fewest revisions', |
| 1533 | +'fewestrevisions-header' => 'This report lists pages with the fewest number of revisions on the wiki.', |
1534 | 1534 | |
1535 | 1535 | # Uncategorised pages report |
1536 | 1536 | 'uncategorizedpages' => 'Uncategorized pages', |
— | — | @@ -1586,8 +1586,8 @@ |
1587 | 1587 | 'mostcategories-header' => 'This report lists pages belonging to the largest number of categories.', |
1588 | 1588 | 'mostusedimages' => 'Most used images', |
1589 | 1589 | 'mostusedimages-header' => 'This report lists the most-used images on the wiki.', |
1590 | | -'mostrevisions' => 'Articles with the most revisions', |
1591 | | -'mostrevisions-summary' => '', # only translate this message to other languages if you have to change it |
| 1590 | +'mostrevisions' => 'Pages with the most revisions', |
| 1591 | +'mostrevisions-header' => 'This report lists pages with the greatest number of revisions on the wiki.', |
1592 | 1592 | 'allpages' => 'All pages', |
1593 | 1593 | 'allpages-summary' => '', # only translate this message to other languages if you have to change it |
1594 | 1594 | 'prefixindex' => 'Prefix index', |