X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUnusedcategories.php;h=69c42d5d8625d94a6262069fbdb57603a4eab8b6;hb=44d988fb72215db57f437c33aaeb37a0937f9796;hp=406f794409990fde319afdb1ea83e39ba4e47533;hpb=5eb0d9dfefbed0b6dffde16684225ae3b4f2ab9d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUnusedcategories.php b/includes/specials/SpecialUnusedcategories.php index 406f794409..69c42d5d86 100644 --- a/includes/specials/SpecialUnusedcategories.php +++ b/includes/specials/SpecialUnusedcategories.php @@ -1,5 +1,22 @@ msg( 'unusedcategoriestext' )->parseAsBlock(); + } + + function getQueryInfo() { + return array ( + 'tables' => array ( 'page', 'categorylinks' ), + 'fields' => array ( 'namespace' => 'page_namespace', + 'title' => 'page_title', + 'value' => 'page_title' ), + 'conds' => array ( 'cl_from IS NULL', + 'page_namespace' => NS_CATEGORY, + 'page_is_redirect' => 0 ), + 'join_conds' => array ( 'categorylinks' => array ( + 'LEFT JOIN', 'cl_to = page_title' ) ) + ); } - 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"; + /** + * A should come before Z (bug 30907) + * @return bool + */ + function sortDescending() { + return false; } function formatResult( $skin, $result ) { $title = Title::makeTitle( NS_CATEGORY, $result->title ); - return $skin->makeLinkObj( $title, $title->getText() ); + return Linker::link( $title, htmlspecialchars( $title->getText() ) ); } } - -/** constructor */ -function wfSpecialUnusedCategories() { - list( $limit, $offset ) = wfCheckLimits(); - $uc = new UnusedCategoriesPage(); - return $uc->doQuery( $offset, $limit ); -}