3 function wfSpecialCategories()
5 global $wgUser, $wgOut , $wgLang;
7 $sk = $wgUser->getSkin() ;
8 $sc = "Special:Categories" ;
10 # List all existant categories.
11 # Note: this list could become *very large*
13 $sql = "SELECT cur_title FROM cur WHERE cur_namespace=".Namespace::getCategory() ;
14 $res = wfQuery ( $sql, DB_READ
) ;
15 while ( $x = wfFetchObject ( $res ) ) {
16 $title =& Title
::makeTitle( NS_CATEGORY
, $x->cur_title
);
18 $r .= $sk->makeKnownLinkObj ( $title, $title->getText() ) ;
21 wfFreeResult ( $res ) ;
26 # Links to category pages that haven't been created.
27 # FIXME: This could be slow if there are a lot, but the title index should
28 # make it reasonably snappy since we're using an index.
29 $cat = wfStrencode( $wgLang->getNsText( NS_CATEGORY
) );
30 $sql = "SELECT DISTINCT bl_to FROM brokenlinks WHERE bl_to LIKE \"{$cat}:%\"" ;
31 $res = wfQuery ( $sql, DB_READ
) ;
33 while ( $x = wfFetchObject ( $res ) ) {
34 $title = Title
::newFromDBkey( $x->bl_to
);
36 $r .= $sk->makeBrokenLinkObj( $title, $title->getText() ) ;
39 wfFreeResult ( $res ) ;
42 $wgOut->addHTML ( $r ) ;