aboutsummaryrefslogtreecommitdiffstats
path: root/includes/SpecialCategories.php
diff options
context:
space:
mode:
authornobody <nobody@localhost>2004-06-27 00:05:32 +0000
committernobody <nobody@localhost>2004-06-27 00:05:32 +0000
commit0c1d741ff4792d486258b390cf50cf3f9e229511 (patch)
tree55961c46b433ade0739763bee2ba3c4843d13751 /includes/SpecialCategories.php
parentd5c8171a3157337557bc54ecb730d7dd35778ca3 (diff)
parent1aaed5fd7c7f4d7ea7abbfc7915bab5954d60a30 (diff)
downloadmediawikicore-1.3.0beta4a.tar.gz
mediawikicore-1.3.0beta4a.zip
This commit was manufactured by cvs2svn to create tag1.3.0beta4a
'REL1_3_0beta4a'.
Diffstat (limited to 'includes/SpecialCategories.php')
-rw-r--r--includes/SpecialCategories.php75
1 files changed, 37 insertions, 38 deletions
diff --git a/includes/SpecialCategories.php b/includes/SpecialCategories.php
index 1a3efca0ccee..6cc493e7ccdf 100644
--- a/includes/SpecialCategories.php
+++ b/includes/SpecialCategories.php
@@ -1,45 +1,44 @@
<?php
+require_once("QueryPage.php");
+
+class CategoriesPage extends QueryPage {
+
+ function getName() {
+ return "Categories";
+ }
+
+ function isExpensive() {
+ return false;
+ }
+
+ function getSQL() {
+ $NScat = NS_CATEGORY;
+ return "SELECT DISTINCT 'Categories' as type,
+ {$NScat} as namespace,
+ cl_to as title,
+ 1 as value
+ FROM categorylinks";
+ }
+
+ function sortDescending() {
+ return false;
+ }
+
+ function formatResult( $skin, $result ) {
+ global $wgLang;
+ $title = Title::makeTitle( NS_CATEGORY, $result->title );
+ return $skin->makeLinkObj( $title, $title->getText() );
+ }
+}
+
function wfSpecialCategories()
{
- global $wgUser, $wgOut , $wgLang;
-
- $sk = $wgUser->getSkin() ;
- $sc = "Special:Categories" ;
-
- # List all existant categories.
- # Note: this list could become *very large*
- $r = "<ol>\n" ;
- $sql = "SELECT cur_title FROM cur WHERE cur_namespace=".Namespace::getCategory() ;
- $res = wfQuery ( $sql, DB_READ ) ;
- while ( $x = wfFetchObject ( $res ) ) {
- $title =& Title::makeTitle( NS_CATEGORY, $x->cur_title );
- $r .= "<li>" ;
- $r .= $sk->makeKnownLinkObj ( $title, $title->getText() ) ;
- $r .= "</li>\n" ;
- }
- wfFreeResult ( $res ) ;
- $r .= "</ol>\n" ;
-
- $r .= "<hr />\n" ;
-
- # Links to category pages that haven't been created.
- # FIXME: This could be slow if there are a lot, but the title index should
- # make it reasonably snappy since we're using an index.
- $cat = wfStrencode( $wgLang->getNsText( NS_CATEGORY ) );
- $sql = "SELECT DISTINCT bl_to FROM brokenlinks WHERE bl_to LIKE \"{$cat}:%\"" ;
- $res = wfQuery ( $sql, DB_READ ) ;
- $r .= "<ol>\n" ;
- while ( $x = wfFetchObject ( $res ) ) {
- $title = Title::newFromDBkey( $x->bl_to );
- $r .= "<li>" ;
- $r .= $sk->makeBrokenLinkObj( $title, $title->getText() ) ;
- $r .= "</li>\n" ;
- }
- wfFreeResult ( $res ) ;
- $r .= "</ol>\n" ;
-
- $wgOut->addHTML ( $r ) ;
+ list( $limit, $offset ) = wfCheckLimits();
+
+ $cap = new CategoriesPage();
+
+ return $cap->doQuery( $offset, $limit );
}
?>