diff options
Diffstat (limited to 'includes/specials/SpecialUnusedcategories.php')
-rw-r--r-- | includes/specials/SpecialUnusedcategories.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/includes/specials/SpecialUnusedcategories.php b/includes/specials/SpecialUnusedcategories.php new file mode 100644 index 00000000..406f7944 --- /dev/null +++ b/includes/specials/SpecialUnusedcategories.php @@ -0,0 +1,46 @@ +<?php +/** + * @file + * @ingroup SpecialPage + */ + +/** + * @ingroup SpecialPage + */ +class UnusedCategoriesPage extends QueryPage { + + function isExpensive() { return true; } + + function getName() { + return 'Unusedcategories'; + } + + function getPageHeader() { + return wfMsgExt( 'unusedcategoriestext', array( 'parse' ) ); + } + + function getSQL() { + $NScat = NS_CATEGORY; + $dbr = wfGetDB( DB_SLAVE ); + list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' ); + return "SELECT 'Unusedcategories' as type, + {$NScat} as namespace, page_title as title, page_title as value + FROM $page + LEFT JOIN $categorylinks ON page_title=cl_to + WHERE cl_from IS NULL + AND page_namespace = {$NScat} + AND page_is_redirect = 0"; + } + + function formatResult( $skin, $result ) { + $title = Title::makeTitle( NS_CATEGORY, $result->title ); + return $skin->makeLinkObj( $title, $title->getText() ); + } +} + +/** constructor */ +function wfSpecialUnusedCategories() { + list( $limit, $offset ) = wfCheckLimits(); + $uc = new UnusedCategoriesPage(); + return $uc->doQuery( $offset, $limit ); +} |