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