00001 <?php 00010 class UnusedCategoriesPage extends QueryPage { 00011 00012 function isExpensive() { return true; } 00013 00014 function getName() { 00015 return 'Unusedcategories'; 00016 } 00017 00018 function getPageHeader() { 00019 return wfMsgExt( 'unusedcategoriestext', array( 'parse' ) ); 00020 } 00021 00022 function getSQL() { 00023 $NScat = NS_CATEGORY; 00024 $dbr = wfGetDB( DB_SLAVE ); 00025 list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' ); 00026 return "SELECT 'Unusedcategories' as type, 00027 {$NScat} as namespace, page_title as title, page_title as value 00028 FROM $page 00029 LEFT JOIN $categorylinks ON page_title=cl_to 00030 WHERE cl_from IS NULL 00031 AND page_namespace = {$NScat} 00032 AND page_is_redirect = 0"; 00033 } 00034 00035 function formatResult( $skin, $result ) { 00036 $title = Title::makeTitle( NS_CATEGORY, $result->title ); 00037 return $skin->makeLinkObj( $title, $title->getText() ); 00038 } 00039 } 00040 00042 function wfSpecialUnusedCategories() { 00043 list( $limit, $offset ) = wfCheckLimits(); 00044 $uc = new UnusedCategoriesPage(); 00045 return $uc->doQuery( $offset, $limit ); 00046 }