346eac633da75f9b769c12c28e0ff9fdb9320fb3
[lhc/web/wiklou.git] / includes / SpecialCategories.php
1 <?php
2 /**
3 *
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
7
8 /**
9 *
10 * @package MediaWiki
11 * @subpackage SpecialPage
12 */
13 class CategoriesPage extends QueryPage {
14
15 function getName() {
16 return "Categories";
17 }
18
19 function isExpensive() {
20 return false;
21 }
22
23 function isSyndicated() { return false; }
24
25 function getPageHeader() {
26 return wfMsgWikiHtml( 'categoriespagetext' );
27 }
28
29 function getSQL() {
30 $NScat = NS_CATEGORY;
31 $dbr =& wfGetDB( DB_SLAVE );
32 $categorylinks = $dbr->tableName( 'categorylinks' );
33 $implicit_groupby = $dbr->implicitGroupby() ? '1' : 'cl_to';
34 $s= "SELECT 'Categories' as type,
35 {$NScat} as namespace,
36 cl_to as title,
37 $implicit_groupby as value,
38 COUNT(*) as count
39 FROM $categorylinks
40 GROUP BY 1,2,3,4";
41 return $s;
42 }
43
44 function sortDescending() {
45 return false;
46 }
47
48 function formatResult( $skin, $result ) {
49 global $wgLang;
50 $title = Title::makeTitle( NS_CATEGORY, $result->title );
51 $plink = $skin->makeLinkObj( $title, $title->getText() );
52 $nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
53 $wgLang->formatNum( $result->count ) );
54 return wfSpecialList($plink, $nlinks);
55 }
56 }
57
58 /**
59 *
60 */
61 function wfSpecialCategories() {
62 list( $limit, $offset ) = wfCheckLimits();
63
64 $cap = new CategoriesPage();
65
66 return $cap->doQuery( $offset, $limit );
67 }
68
69 ?>