Fix #218: Redirects do not support named anchors
[mediawiki.git] / includes / SpecialCategories.php
blobccfd369e6b4a3e3bfd2dfe16a6ae1909782f48a1
1 <?php
2 /**
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
8 /**
11 require_once("QueryPage.php");
13 /**
15 * @package MediaWiki
16 * @subpackage SpecialPage
18 class CategoriesPage extends QueryPage {
20 function getName() {
21 return "Categories";
24 function isExpensive() {
25 return false;
28 function isSyndicated() { return false; }
30 function getPageHeader() {
31 return wfMsgWikiHtml( 'categoriespagetext' );
34 function getSQL() {
35 $NScat = NS_CATEGORY;
36 $dbr =& wfGetDB( DB_SLAVE );
37 $categorylinks = $dbr->tableName( 'categorylinks' );
38 $s= "SELECT 'Categories' as type,
39 {$NScat} as namespace,
40 cl_to as title,
41 1 as value,
42 COUNT(*) as count
43 FROM $categorylinks
44 GROUP BY cl_to";
45 return $s;
48 function sortDescending() {
49 return false;
52 function formatResult( $skin, $result ) {
53 $title = Title::makeTitle( NS_CATEGORY, $result->title );
54 $plink = $skin->makeLinkObj( $title, $title->getText() );
55 $nlinks = wfMsg( 'nlinks', $result->count );
56 return "$plink ($nlinks)";
60 /**
63 function wfSpecialCategories() {
64 list( $limit, $offset ) = wfCheckLimits();
66 $cap = new CategoriesPage();
68 return $cap->doQuery( $offset, $limit );