From 036e260ce0459c135050a25d980ece4803a405ee Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 24 Apr 2004 08:57:55 +0000 Subject: [PATCH] Fix for namespace world --- includes/SpecialCategories.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/includes/SpecialCategories.php b/includes/SpecialCategories.php index ea39fca35b..faa9860e09 100644 --- a/includes/SpecialCategories.php +++ b/includes/SpecialCategories.php @@ -6,23 +6,27 @@ function wfSpecialCategories() $sk = $wgUser->getSkin() ; $sc = "Special:Categories" ; - $r = "" ; - $r .= "
    \n" ; - $cat = ucfirst ( wfMsg ( "category" ) ) ; + + # List all existant categories. + # Note: this list could become *very large* + $r = "
      \n" ; $sql = "SELECT cur_title FROM cur WHERE cur_namespace=".Namespace::getCategory() ; $res = wfQuery ( $sql, DB_READ ) ; - while ( $x = wfFetchObject ( $res ) ) - { - $t = explode ( ":" , $x->cur_title , 2 ) ; - $t = $t[1] ; + while ( $x = wfFetchObject ( $res ) ) { + $title =& Title::makeTitle( NS_CATEGORY, $x->cur_title ); $r .= "
    1. " ; - $r .= $sk->makeKnownLink ( $x->cur_title , $t ) ; + $r .= $sk->makeKnownLinkObj ( $title, $title->getText() ) ; $r .= "
    2. \n" ; } wfFreeResult ( $res ) ; $r .= "
    \n" ; $r .= "
    \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 .= "
      \n" ; @@ -31,7 +35,7 @@ function wfSpecialCategories() $t = explode ( ":" , $x->bl_to , 2 ) ; $t = $t[1] ; $r .= "
    1. " ; - $r .= $sk->makeBrokenLink ( $x->bl_to ) ; + $r .= $sk->makeBrokenLink( $x->bl_to, $t ) ; $r .= "
    2. \n" ; } wfFreeResult ( $res ) ; -- 2.20.1