summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialUnusedcategories.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2008-08-15 01:29:47 +0200
committerPierre Schmitz <pierre@archlinux.de>2008-08-15 01:29:47 +0200
commit370e83bb0dfd0c70de268c93bf07ad5ee0897192 (patch)
tree491674f4c242e4d6ba0d04eafa305174c35a3391 /includes/specials/SpecialUnusedcategories.php
parentf4debf0f12d0524d2b2427c55ea3f16b680fad97 (diff)
Update auf 1.13.0
Diffstat (limited to 'includes/specials/SpecialUnusedcategories.php')
-rw-r--r--includes/specials/SpecialUnusedcategories.php46
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 );
+}