00001 <?php
00016 class WantedCategoriesPage extends WantedQueryPage {
00017
00018 function getName() {
00019 return 'Wantedcategories';
00020 }
00021
00022 function getSQL() {
00023 $dbr = wfGetDB( DB_SLAVE );
00024 list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' );
00025 $name = $dbr->addQuotes( $this->getName() );
00026 return
00027 "
00028 SELECT
00029 $name as type,
00030 " . NS_CATEGORY . " as namespace,
00031 cl_to as title,
00032 COUNT(*) as value
00033 FROM $categorylinks
00034 LEFT JOIN $page ON cl_to = page_title AND page_namespace = ". NS_CATEGORY ."
00035 WHERE page_title IS NULL
00036 GROUP BY cl_to
00037 ";
00038 }
00039
00040 function formatResult( $skin, $result ) {
00041 global $wgLang, $wgContLang;
00042
00043 $nt = Title::makeTitle( $result->namespace, $result->title );
00044 $text = htmlspecialchars( $wgContLang->convert( $nt->getText() ) );
00045
00046 $plink = $this->isCached() ?
00047 $skin->link( $nt, $text ) :
00048 $skin->link(
00049 $nt,
00050 $text,
00051 array(),
00052 array(),
00053 array( 'broken' )
00054 );
00055
00056 $nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
00057 $wgLang->formatNum( $result->value ) );
00058 return wfSpecialList($plink, $nlinks);
00059 }
00060 }
00061
00065 function wfSpecialWantedCategories() {
00066 list( $limit, $offset ) = wfCheckLimits();
00067
00068 $wpp = new WantedCategoriesPage();
00069
00070 $wpp->doQuery( $offset, $limit );
00071 }