summaryrefslogtreecommitdiff
path: root/includes/SpecialCategories.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/SpecialCategories.php')
-rw-r--r--includes/SpecialCategories.php68
1 files changed, 68 insertions, 0 deletions
diff --git a/includes/SpecialCategories.php b/includes/SpecialCategories.php
new file mode 100644
index 00000000..8a6dd5ff
--- /dev/null
+++ b/includes/SpecialCategories.php
@@ -0,0 +1,68 @@
+<?php
+/**
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
+
+/**
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
+class CategoriesPage extends QueryPage {
+
+ function getName() {
+ return "Categories";
+ }
+
+ function isExpensive() {
+ return false;
+ }
+
+ function isSyndicated() { return false; }
+
+ function getPageHeader() {
+ return wfMsgWikiHtml( 'categoriespagetext' );
+ }
+
+ function getSQL() {
+ $NScat = NS_CATEGORY;
+ $dbr =& wfGetDB( DB_SLAVE );
+ $categorylinks = $dbr->tableName( 'categorylinks' );
+ $s= "SELECT 'Categories' as type,
+ {$NScat} as namespace,
+ cl_to as title,
+ 1 as value,
+ COUNT(*) as count
+ FROM $categorylinks
+ GROUP BY cl_to";
+ return $s;
+ }
+
+ function sortDescending() {
+ return false;
+ }
+
+ function formatResult( $skin, $result ) {
+ global $wgLang;
+ $title = Title::makeTitle( NS_CATEGORY, $result->title );
+ $plink = $skin->makeLinkObj( $title, $title->getText() );
+ $nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
+ $wgLang->formatNum( $result->count ) );
+ return wfSpecialList($plink, $nlinks);
+ }
+}
+
+/**
+ *
+ */
+function wfSpecialCategories() {
+ list( $limit, $offset ) = wfCheckLimits();
+
+ $cap = new CategoriesPage();
+
+ return $cap->doQuery( $offset, $limit );
+}
+
+?>