80f46a8798996c7dbd4b72d7a703986ec657c0a1
[lhc/web/wiklou.git] / includes / SpecialUnusedcategories.php
1 <?php
2 /**
3 *
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
7
8 /**
9 *
10 * @package MediaWiki
11 * @subpackage SpecialPage
12 */
13 class UnusedCategoriesPage extends QueryPage {
14
15 function getName() {
16 return 'Unusedcategories';
17 }
18
19 function getPageHeader() {
20 return '<p>' . wfMsg('unusedcategoriestext') . '</p>';
21 }
22
23 function getSQL() {
24 $NScat = NS_CATEGORY;
25 $dbr =& wfGetDB( DB_SLAVE );
26 list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' );
27 return "SELECT 'Unusedcategories' as type,
28 {$NScat} as namespace, page_title as title, page_title as value
29 FROM $page
30 LEFT JOIN $categorylinks ON page_title=cl_to
31 WHERE cl_from IS NULL
32 AND page_namespace = {$NScat}
33 AND page_is_redirect = 0";
34 }
35
36 function formatResult( $skin, $result ) {
37 $title = Title::makeTitle( NS_CATEGORY, $result->title );
38 return $skin->makeLinkObj( $title, $title->getText() );
39 }
40 }
41
42 /** constructor */
43 function wfSpecialUnusedCategories() {
44 list( $limit, $offset ) = wfCheckLimits();
45 $uc = new UnusedCategoriesPage();
46 return $uc->doQuery( $offset, $limit );
47 }
48 ?>