00001 <?php 00015 class MostcategoriesPage extends QueryPage { 00016 00017 function getName() { return 'Mostcategories'; } 00018 function isExpensive() { return true; } 00019 function isSyndicated() { return false; } 00020 00021 function getSQL() { 00022 $dbr = wfGetDB( DB_SLAVE ); 00023 list( $categorylinks, $page) = $dbr->tableNamesN( 'categorylinks', 'page' ); 00024 return 00025 " 00026 SELECT 00027 'Mostcategories' as type, 00028 page_namespace as namespace, 00029 page_title as title, 00030 COUNT(*) as value 00031 FROM $categorylinks 00032 LEFT JOIN $page ON cl_from = page_id 00033 WHERE page_namespace = " . NS_MAIN . " 00034 GROUP BY page_namespace, page_title 00035 HAVING COUNT(*) > 1 00036 "; 00037 } 00038 00039 function formatResult( $skin, $result ) { 00040 global $wgLang; 00041 $title = Title::makeTitleSafe( $result->namespace, $result->title ); 00042 00043 $count = wfMsgExt( 'ncategories', array( 'parsemag', 'escape' ), $wgLang->formatNum( $result->value ) ); 00044 $link = $skin->link( $title ); 00045 return wfSpecialList( $link, $count ); 00046 } 00047 } 00048 00052 function wfSpecialMostcategories() { 00053 list( $limit, $offset ) = wfCheckLimits(); 00054 00055 $wpp = new MostcategoriesPage(); 00056 00057 $wpp->doQuery( $offset, $limit ); 00058 }